Ejemplo n.º 1
0
 /**
  * Gets the last page modification log item
  * @param Page $page The page
  * @param Interfaces\IContainerReferenceResolver $resolver
  * @return LogItem Returns the last log item that changed anything related to the page
  */
 static function LastPageModLog(Page $page, Interfaces\IContainerReferenceResolver $resolver)
 {
     $lastLog = self::LastPageLog($page);
     $pageContents = PageContent::Schema()->FetchByPage(false, $page);
     foreach ($pageContents as $pageContent) {
         $content = $pageContent->GetContent();
         $contentLog = self::LastContentModLog($content, $resolver);
         if (self::IsAfter($contentLog, $lastLog)) {
             $lastLog = $contentLog;
         }
     }
     $layoutLog = self::LastLayoutLog($page->GetLayout());
     if (self::IsAfter($layoutLog, $lastLog)) {
         $lastLog = $layoutLog;
     }
     return $lastLog;
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 protected function TableSchema()
 {
     return PageContent::Schema();
 }
 /**
  * Gets the first child of the item or the top most if the given item is null
  * @param PageContent $item
  * @return PageContent
  */
 public function FirstChildOf($item)
 {
     if ($item) {
         $sql = Access::SqlBuilder();
         $tbl = PageContent::Schema()->Table();
         $where = $sql->Equals($tbl->Field('Parent'), $sql->Value($item->GetID()))->And_($sql->IsNull($tbl->Field('Previous')));
         return PageContent::Schema()->First($where);
     } else {
         return $this->TopMost();
     }
 }