Exemple #1
0
 /**
  * Get page tree node properties.
  *
  * @param \Page $page
  * @param Tree $tree
  * @param int $depth
  * @return array
  */
 public function getPageTreeNode($page, Tree $tree, $depth = 0)
 {
     $p = $tree->objectToJson($page, $tree, $depth);
     if ($page->getWorkingPageRevisionId() && $page->getWorkingPageRevisionId() !== $page->getActivePageRevisionId()) {
         $p['title'] .= '*';
         $p['addClass'] = 'page-unpublished';
     }
     $p['expand'] = true;
     $p['href'] = $this->page->url(array('id' => $page->getPageId()));
     // Mark active node
     if (isset($_GET['page_id']) && $_GET['page_id'] == $page->getPageId()) {
         $p['activate'] = $p['focus'] = $p['select'] = true;
     }
     // Icon
     $p['iconClass'] = 'no-icon';
     if (\Curry_Backend_Page::isTemplatePage($page)) {
         if ($page === \Curry_Backend_Page::getTemplatePage()) {
             $p['title'] .= ' <span class="icon-columns"></span>';
         }
     } else {
         $icon = "";
         if (!$page->getEnabled()) {
             $icon .= '<span class="icon-lock" title="Inactive"></span>';
         }
         if (!$page->getVisible()) {
             $icon .= '<span class="icon-eye-close" title="Do not show in menu"></span>';
         }
         if ($page->getRedirectMethod()) {
             $icon .= '<span class="icon-link" title="Redirect"></span>';
         }
         if ($icon) {
             $p['title'] .= " {$icon}";
         }
     }
     return $p;
 }
Exemple #2
0
 protected static function getBasePageSelect(Page $page = null, $basePageId = null, $advanced = false)
 {
     $pages = array('' => '[ Do not inherit ]');
     $templatePage = Curry_Backend_Page::getTemplatePage();
     if ($templatePage) {
         $pages['Templates'] = PagePeer::getSelect($templatePage);
         if ($advanced) {
             $pages['Pages'] = array_diff_key(PagePeer::getSelect(), $pages['Templates']);
         } else {
             if ($basePageId && !array_key_exists($basePageId, $pages['Templates'])) {
                 $basePage = PageQuery::create()->findPk($basePageId);
                 $pages['Pages'] = array($basePageId => $basePage ? $basePage->getName() : '<Unknown>');
             }
         }
     } else {
         $pages += PagePeer::getSelect();
     }
     $dependantPages = array();
     if ($page) {
         $dependantPages = ArrayHelper::objectsToArray($page->getDependantPages(), null, 'getPageId');
         $dependantPages[] = $page->getPageId();
     }
     $pageSelect = array('select', array('label' => 'Base page', 'multiOptions' => $pages, 'value' => $basePageId, 'description' => 'The page which content and templates will be inherited from.', 'disable' => $dependantPages, 'onchange' => "\$(this).closest('form').find('.base-preview').attr('src', '" . url('', array('module', 'view' => 'BasePreview')) . "&page_id=' + \$(this).val());"));
     $imageElement = array('rawHtml', array('label' => 'Preview', 'value' => '<img src="' . url('', array('module', 'view' => 'BasePreview', 'page_id' => $basePageId)) . '" class="base-preview" />'));
     return array($pageSelect, $imageElement);
 }