function SetAdminSS() { if (isset($_GET['ID']) && is_numeric($_GET['ID'])) { $UserStory = $_GET['ID']; } else { die; } $showinAdmin = isset($_GET['Set']) && intval($_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', '<b>' . $story->Title . '</b> updated.'); $this->owner->redirectBack(); }
function AddUserStory() { if (isset($_GET['ID']) && is_numeric($_GET['ID'])) { $ID = $_GET['ID']; } else { die; } $parent = UserStoryHolder::get()->first(); if (!$parent) { $this->owner->setMessage('Error', 'could not add an user story bc there is not any available parent page(UserStoryHolder).'); Controller::curr()->redirectBack(); } $userStory = new UserStory(); $userStory->Title = $_GET['label']; $userStory->DeploymentID = $ID; $userStory->UserStoriesIndustryID = $_GET['industry']; $userStory->CompanyName = $_GET['org']; $userStory->CaseStudyTitle = $_GET['org']; $userStory->ShowInAdmin = 1; $userStory->setParent($parent); // Should set the ID once the Holder is created... $userStory->write(); //$userStory->publish("Live", "Stage"); $userStory->flushCache(); $this->owner->setMessage('Success', '<b>' . $userStory->Title . '</b> added as User Story.'); Controller::curr()->redirectBack(); }