/** {@inheritdoc} */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $placement = $this->getPlacement(); $separator = $this->getSeparator(); $attr = array('onchange' => '$(this).prev().val(this.value.split("|")[1]); this.selectedIndex = 0;'); $options = array('' => 'Select page...'); foreach (PageQuery::create()->orderByBranch()->find() as $page) { if (Curry_Backend_Page::isTemplatePage($page)) { continue; } $options[$page->getPageId() . '|' . $page->getUrl()] = str_repeat(Curry_Core::SELECT_TREE_PREFIX, $page->getLevel()) . $page->getName(); } $options = Curry_Html::createSelectOptions($options, ''); $markup = Curry_Html::createTag('select', $attr, $options); switch ($placement) { case 'PREPEND': $content = $markup . $separator . $content; break; case 'APPEND': default: $content = $content . $separator . $markup; } return $content; }
/** * 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; }