protected function Init() { $this->site = new Site(Request::GetData('site')); $selectedID = Request::GetData('selected'); $this->selected = $selectedID ? Page::Schema()->ByID($selectedID) : null; if (!$this->site->Exists()) { Response::Redirect(BackendRouter::ModuleUrl(new SiteList())); return true; } $this->tree = new PageTreeProvider($this->site); $this->page = $this->tree->TopMost(); $this->hasPages = (bool) $this->page; return parent::Init(); }
/** * Adds the user group field */ private function AddUserGroupField() { $name = 'UserGroup'; $field = new Select($name, ''); $field->AddOption('', Trans('Core.SiteForm.NoGroup')); if ($this->site->Exists() && $this->site->GetUserGroup()) { $field->SetValue($this->site->GetUserGroup()->GetID()); } DBSelectUtil::AddUserGroupOptions($field); $this->AddField($field); }
/** * Initializes the form * @return boolean */ protected function Init() { $this->page = new Page(Request::GetData('page')); $this->parent = Page::Schema()->ByID(Request::GetData('parent')); $this->previous = Page::Schema()->ByID(Request::GetData('previous')); $this->site = $this->page->Exists() ? $this->page->GetSite() : Site::Schema()->ByID(Request::GetData('site')); $this->dateFormat = Trans('Core.DateFormat'); $this->InitPageRights(); if (!$this->page->Exists() && !$this->site->Exists()) { Response::Redirect(BackendRouter::ModuleUrl(new SiteList())); return true; } $this->AddLayoutField(); $this->AddNameField(); $this->AddUrlField(); $this->AddTitleField(); $this->AddDescriptionField(); $this->AddKeywordsField(); $this->AddMenuAccessField(); $this->AddUserGroupField(); $this->AddGuestsOnlyField(); $this->AddMemberGroupField(); $this->AddPublishField(); $this->AddSubmit(); $this->AddPublishFromDateField(); $this->AddPublishFromHourField(); $this->AddPublishFromMinuteField(); $this->AddPublishToDateField(); $this->AddPublishToHourField(); $this->AddPublishToMinuteField(); $this->AddSitemapRelevanceField(); $this->AddSitemapChangeFrequencyField(); $this->AddTypeField(); $this->AddRedirectTargetSelector(); return parent::Init(); }