Exemplo n.º 1
0
 private function AddTypeField()
 {
     $name = 'Type';
     $value = $this->page->Exists() ? $this->page->GetType() : (string) PageType::Normal();
     $field = new Select($name, $value);
     $types = PageType::AllowedValues();
     $ex404 = FrontendRouter::Page404($this->site);
     foreach ($types as $type) {
         if ($type == (string) PageType::NotFound() && $ex404 && !$ex404->Equals($this->page)) {
             continue;
         }
         $field->AddOption($type, Trans('Core.PageForm.Type.' . ucfirst($type)));
     }
     $this->AddField($field);
 }
Exemplo n.º 2
0
 /**
  * Renders the complete page by requiring the page layout
  * @return string Returns the page contents
  */
 function Render()
 {
     self::$currentPage = $this->page;
     self::$Title = self::$currentPage->GetTitle();
     self::$Description = self::$currentPage->GetDescription();
     self::$Keywords = self::$currentPage->GetKeywords();
     if ($this->page->GetType() == (string) PageType::NotFound()) {
         header('HTTP/1.0 404 Not Found');
     } else {
         if ($this->page->GetType() !== (string) PageType::Normal()) {
             throw new \Exception('Internal phine error: not normal page called');
         }
     }
     ob_start();
     require PathUtil::LayoutTemplate($this->layout);
     $result = ob_get_clean();
     $replacer = new Replacer();
     return $replacer->RealizeVariables($result);
 }
Exemplo n.º 3
0
 private function PageAllowed(Page $page)
 {
     if ($page->GetType() != (string) PageType::Normal() || $page->GetSitemapRelevance() == 0) {
         return false;
     }
     return $this->guard->Allow(Action::Read(), $page);
 }