Beispiel #1
0
 function parse($html = null, $blockName = 'document', $blockParams = null)
 {
     $blockParams = (array) $blockParams;
     $blockParams += array('id' => null);
     if ($blockParams['id']) {
         $oldVars = $this->vars;
         $this->vars = SlNode::get($blockParams['id'], array('auth' => true));
     }
     if ($blockName === 'NodeView') {
         $skin = empty(SL::getInstance()->view->params['named']['skin']) ? Inflector::camelize($this->_getVar('CmsNode.skin')) : Inflector::camelize(SL::getInstance()->view->params['named']['skin']);
         $skin = $skin && Pheme::init("NodeView{$skin}") ? "NodeView{$skin}" : "NodeViewDefault";
     } else {
         $skin = $blockName;
     }
     if ($skin != $blockName) {
         PhemeParser::$parseCallStack[] = Pheme::get($skin);
         $result = parent::parse($html, $skin);
         array_pop(PhemeParser::$parseCallStack);
     } else {
         $result = parent::parse($html, $skin);
     }
     if (isset($oldVars)) {
         $this->vars = $oldVars;
     }
     return $result;
 }
Beispiel #2
0
 /**
  * Class constructor.
  *
  * @param string $method Method producing the error
  * @param array $messages Error messages
  */
 function __construct($method, $messages)
 {
     $this->_requested = !SL::getInstance()->main;
     // Make a more user-friendly "No Database Connection"
     if ($method === 'missingTable') {
         $db = @ConnectionManager::getDataSource('default');
         if (!$db->isConnected()) {
             $method = 'dbConnectionError';
         }
     }
     parent::__construct($method, $messages);
 }
Beispiel #3
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;
     }
 }