Example #1
0
 public static function doUpdateIndex(Page $page)
 {
     // Re-index related pages
     $pages = $page->getDependantPages();
     $pages[] = $page;
     foreach ($pages as $page) {
         Curry_Backend_Indexer::updateItem($page);
     }
 }
Example #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);
 }