/**
  * Returns the root and first content element in a page and area
  * @return PageContent Returns the first and root content
  */
 function TopMost()
 {
     $sql = Access::SqlBuilder();
     $tbl = PageContent::Schema()->Table();
     $where = $sql->Equals($tbl->Field('Page'), $sql->Value($this->page->GetID()))->And_($sql->Equals($tbl->Field('Area'), $sql->Value($this->area->GetID())))->And_($sql->IsNull($tbl->Field('Parent')))->And_($sql->IsNull($tbl->Field('Previous')));
     return PageContent::Schema()->First($where);
 }
 /**
  * The edit/create url base parameters
  */
 protected function EditParams()
 {
     $params = array();
     $params['page'] = $this->page->GetID();
     $params['area'] = $this->area->GetID();
     return $params;
 }
示例#3
0
 /**
  * Gets the content tree url
  * @param Area $area
  * @return string Returns the page content tree url
  */
 protected function AreaUrl(Area $area)
 {
     $params = array();
     $params['page'] = $this->page->GetID();
     $params['area'] = $area->GetID();
     return BackendRouter::ModuleUrl(new PageContentTree(), $params);
 }
示例#4
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);
 }
示例#5
0
 /**
  * Saves the page selection
  */
 protected function OnSuccess()
 {
     $allParams = array();
     foreach ($this->oblParams as $param) {
         $allParams[$param] = $this->Value($param);
     }
     $optParams = $this->serializer->LinesToArray($this->Value('OptionalParameters'));
     foreach ($optParams as $name => $value) {
         if (!isset($allParams[$name])) {
             $allParams[$name] = $value;
         }
     }
     $this->SetJSFieldValue('#' . $this->prefix . 'Params', $this->serializer->ArrayToLines($allParams));
     $this->SetJSFieldValue('#' . $this->prefix . 'Page', $this->page->GetID());
     $this->SetJSFieldValue('#' . $this->prefix . 'Fragment', $this->Value('Fragment'));
     $this->SetJSHtml('#' . $this->prefix . 'Url', FrontendRouter::PageUrl($this->page, $allParams, $this->Value('Fragment')));
     $this->CloseModal();
 }
示例#6
0
 /**
  * Checks if the page was disabled
  * @param Page $page The page to check
  * @return boolean Returns true if the page is not selectable
  */
 protected function IsDisabled(Page $page)
 {
     return in_array($page->GetID(), $this->disabledPageIDs);
 }
 /**
  * Returns the first child of the page
  * @param Page $item
  * @return Page Returns the first child
  */
 public function FirstChildOf($item)
 {
     $sql = Access::SqlBuilder();
     $tbl = Page::Schema()->Table();
     if ($item) {
         $where = $sql->Equals($tbl->Field('Parent'), $sql->Value($item->GetID()))->And_($sql->IsNull($tbl->Field('Previous')));
         return Page::Schema()->First($where);
     } else {
         return $this->TopMost();
     }
 }
示例#8
0
 public function DisablePage(Page $page)
 {
     $this->disabledPageIDs[] = $page->GetID();
 }
示例#9
0
 /**
  * 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);
 }
示例#10
0
 /**
  * The link for the back button
  * @return string Returns the url to the page tree
  */
 protected function BackLink()
 {
     $params = array('site' => $this->page->GetSite()->GetID());
     $params['selected'] = $this->page->GetID();
     return BackendRouter::ModuleUrl(new PageTree(), $params);
 }
示例#11
0
 /**
  * The page end comment
  * @param Page $page
  * @return CommentLine
  */
 function PageEndComment(Page $page)
 {
     $text = str_replace('{0}', $page->GetID(), self::END_PAGE_COMMENT);
     return new CommentLine($text);
 }
示例#12
0
 /**
  * The last log item that is directly related to the page
  * @param Page $page The page
  * @return LogItem Returns the log item
  */
 static function LastPageLog(Page $page)
 {
     $tblLogPage = LogPage::Schema()->Table();
     $tblLogItem = LogItem::Schema()->Table();
     $sql = Access::SqlBuilder();
     $orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed')));
     $joinCond = $sql->Equals($tblLogPage->Field('LogItem'), $tblLogItem->Field('ID'));
     $where = $sql->Equals($tblLogPage->Field('Page'), $sql->Value($page->GetID()));
     return LogItem::Schema()->First($where, $orderBy, null, $sql->Join($tblLogPage), JoinType::Inner(), $joinCond);
 }