update(get_class($this), 'allowed_actions',array( 'ViewCurrentStories', 'UpdateStories', 'SetAdminSS', )); Config::inst()->update(get_class($this->owner), 'allowed_actions',array( 'ViewCurrentStories', 'UpdateStories', 'SetAdminSS', )); } // Update Stories Industry and Order function UpdateStories(){ foreach($_POST['industry'] as $story_id => $industry){ $story = SiteTree::get_by_id("UserStory",$story_id); $story->UserStoriesIndustryID = $industry; $story->Sort = $_POST['order'][$story_id]; $story->Video = $_POST['video'][$story_id]; $story->Title = $_POST['title'][$story_id]; $story->ShowVideo = ($_POST['video'][$story_id])? true : false; $story->write(); $story->publish("Live","Stage"); } $this->owner->setMessage('Success', 'User Stories saved.'); } function SetAdminSS() { if(isset($_GET['ID']) && is_numeric($_GET['ID'])) { $UserStory = $_GET['ID']; }else{ die(); } $showinAdmin = ($_GET['Set'] == 1)? 1 : 0; $story = SiteTree::get_by_id("UserStory", $UserStory); $parent = UserStoryHolder::get()->first(); if(!$parent){ $this->owner->setMessage('Error', 'could not publish user story bc there is not any available parent page(UserStoryHolder).'); Controller::curr()->redirectBack(); } $story->ShowInAdmin = $showinAdmin; $story->setParent($parent); // Should set the ID once the Holder is created... $story->write(); $story->publish("Live","Stage"); $this->owner->setMessage('Success', '' . $story->Title . ' updated.'); Controller::curr()->redirectBack(); } function UserStoriesIndustries(){ return UserStoriesIndustry::get()->filter('Active', 1); } }