Esempio n. 1
0
 /**
  * Get file node properties.
  *
  * @param string $path
  * @param Curry_Tree $tree
  * @param int $depth
  * @return array
  */
 public function getNodeJson($path, $tree, $depth)
 {
     $p = $tree->objectToJson($path, $tree, $depth);
     if (!$p['isFolder']) {
         $p['href'] = (string) url('', array('module', 'view' => 'Edit', 'file' => $path));
     } else {
         $p['expand'] = true;
     }
     return $p;
 }
Esempio n. 2
0
 /**
  * Constructor
  *
  * @param ModelCriteria|string $modelOrQuery A query object, or model class as string.
  * @param array $options
  */
 public function __construct($modelOrQuery, array $options = array())
 {
     if (is_string($modelOrQuery)) {
         $this->model = $modelOrQuery;
         $this->query = PropelQuery::from($this->model);
     } else {
         if ($modelOrQuery instanceof ModelCriteria) {
             $this->query = $modelOrQuery;
             $this->model = $this->query->getModelName();
         } else {
             throw new Exception('Invalid argument');
         }
     }
     parent::__construct($options);
 }
Esempio n. 3
0
 /**
  * Constructor
  *
  * @param string $root
  * @param array $options
  */
 public function __construct($root, array $options = array())
 {
     $this->setRoot($root);
     parent::__construct($options);
 }
Esempio n. 4
0
 /**
  * Get page tree node properties.
  *
  * @param Page $page
  * @param Curry_Tree $tree
  * @param int $depth
  * @return array
  */
 public function getPageTreeNode($page, Curry_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'] = (string) url('', array('module', 'view' => self::getPageView($page), 'page_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 (self::isTemplatePage($page)) {
         if ($page === self::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;
 }