public function view($id)
 {
     $this->set('tag', $tag = $this->CmsTag->read(null, $id));
     if (!$tag) {
         $this->cakeError();
     }
     if ($tag['CmsTag']['node_id']) {
         $this->set('node', $node = SlNode::get($tag['CmsTag']['node_id']));
     }
     if ($node) {
         $this->set('title', $node['CmsNode']['title']);
     } else {
         $this->set('title', $tag['CmsTag']['name']);
     }
     // get all nodes associated with the CmsTag
     $this->set('nodes', SlNode::find('all', array('conditions' => array('TagFilter.id' => $id), 'link' => array('CmsNodesTags' => array('TagFilter' => array('class' => 'CmsTag', 'conditions' => 'TagFilter.id = CmsNodesTags.tag_id', 'fields' => array('TagFilter.id')))))));
 }
Beispiel #2
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('id' => false, 'skin' => null);
     if ($blockName === 'NodeIndex') {
         $skin = empty(SL::getInstance()->view->params['named']['skin']) ? Inflector::camelize($blockParams['skin']) : Inflector::camelize(SL::getInstance()->view->params['named']['skin']);
         $skin = $skin && Pheme::init("NodeIndex{$skin}") ? "NodeIndex{$skin}" : "NodeIndexDefault";
     } else {
         $skin = $blockName;
     }
     $this->vars['ajaxId'] = SL::uniqid();
     if ($blockParams['id'] === false) {
         $nodes = $this->_getVar('nodes');
     } else {
         if ($blockParams['id'] === 0) {
             $blockParams['id'] = null;
         }
         $nodes = SlNode::find('all', array('conditions' => array('CmsNode.parent_id' => $blockParams['id'], 'CmsNode.visible' => true), 'order' => array('CmsNode.lft' => 'asc'), 'auth' => 'index'));
     }
     if ($nodes) {
         foreach ($nodes as &$node) {
             $node['href'] = h(SlNode::url($node));
         }
         $this->blocks["loop"]->params[0] =& $nodes;
         if ($skin != $blockName) {
             PhemeParser::$parseCallStack[] = Pheme::get($skin);
         }
         PhemeParser::$parseCallStack[] = Pheme::get('NodeView');
         $html = parent::parse($html, $skin);
         array_pop(PhemeParser::$parseCallStack);
         if ($skin != $blockName) {
             array_pop(PhemeParser::$parseCallStack);
         }
         return $html;
     }
 }
 public function admin_index()
 {
     $this->set('cmsNodes', SlNode::find('all', array('conditions' => array('CmsNode.model' => 'CmsContactForm', 'CmsNode.plugin' => $this->plugin))));
 }