/** * True if page can be appended * @param Page $page The page before * @return bool */ protected function CanCreateAfter() { $parent = $this->tree->ParentOf($this->page); if ($parent) { return BackendModule::Guard()->Allow(BackendAction::Create(), $parent); } return BackendModule::Guard()->GrantAddPageToSite($this->page->GetSite())->ToBool(); }
/** * Adds a page and all of its children * @param Page $page The current page */ private function AddPageBranch(Page $page) { $this->AddPage($page); $child = $this->pageTree->FirstChildOf($page); while ($child) { $this->AddPageBranch($child); $child = $this->pageTree->NextOf($child); } }
protected function ParentID() { $parent = $this->tree->ParentOf($this->page); return $parent ? $parent->GetID() : '0'; }
/** * * @return Page Returns the next page after the current page */ protected function NextPage() { $page = $this->page; $this->page = $this->tree->NextOf($this->page); return $page; }