protected function Init()
 {
     $this->page = new Page(Request::GetData('page'));
     $selectedID = Request::GetData('selected');
     $this->selected = $selectedID ? PageContent::Schema()->ByID($selectedID) : null;
     if (!$this->page->Exists()) {
         Response::Redirect(BackendRouter::ModuleUrl(new SiteList()));
         return true;
     }
     $this->area = new Area(Request::GetData('area'));
     if (!$this->area->Exists()) {
         $params = array('site' => $this->page->GetSite()->GetID());
         Response::Redirect(BackendRouter::ModuleUrl(new PageTree(), $params));
         return true;
     }
     $this->tree = new PageContentTreeProvider($this->page, $this->area);
     $this->pageContent = $this->tree->TopMost();
     $this->hasContents = (bool) $this->pageContent;
     return parent::Init();
 }
Example #2
0
 /**
  * Creates a new page url selector
  * @param string $prefix The prefix
  * @param string $label The selector label
  * @param Page $page The pre-selected page
  */
 function __construct($prefix, $label = '', Page $page = null)
 {
     $this->disabledPageIDs = array();
     $this->prefix = $prefix;
     $this->label = $label;
     $this->site = null;
     $this->pageField = Input::Hidden($prefix . 'Page');
     if ($page && $page->Exists()) {
         $this->name = $page->GetName();
         $this->pageField->SetValue($page->GetID());
     }
 }
Example #3
0
 /**
  * The link for the back button
  * @return string Returns the url to the page tree
  */
 protected function BackLink()
 {
     $params = array('site' => $this->site->GetID());
     if ($this->page->Exists()) {
         $params['selected'] = $this->page->GetID();
     } else {
         if ($this->previous) {
             $params['selected'] = $this->previous->GetID();
         } else {
             if ($this->parent) {
                 $params['selected'] = $this->parent->GetID();
             }
         }
     }
     return BackendRouter::ModuleUrl(new PageTree(), $params);
 }
 /**
  * Gets the page's member groups
  * @param Page $page
  * @return Membergroup[] Returns the member groups assigned to the page
  */
 static function PageMembergroups(Page $page)
 {
     if (!$page->Exists()) {
         return array();
     }
     $sql = Access::SqlBuilder();
     $tblPmg = PageMembergroup::Schema()->Table();
     $tblMg = Membergroup::Schema()->Table();
     $join = $sql->Join($tblPmg);
     $joinCondition = $sql->Equals($tblPmg->Field('MemberGroup'), $tblMg->Field('ID'));
     $where = $sql->Equals($tblPmg->Field('Page'), $sql->Value($page->GetID()));
     $orderBy = $sql->OrderList($sql->OrderAsc($tblMg->Field('Name')));
     return Membergroup::Schema()->Fetch(false, $where, $orderBy, null, 0, null, $join, JoinType::Inner(), $joinCondition);
 }