예제 #1
0
파일: Blocks.php 프로젝트: kokkez/shineisp
 /**
  * showblock
  * Handle the XML Blocks 
  * @param unknown_type $side
  */
 public function showblock($side)
 {
     $ns = new Zend_Session_Namespace('Admin');
     $languageID = Languages::get_language_id($ns->lang);
     $record = array();
     $blocks = array();
     // Get the main variables
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $customskin = Settings::findbyParam('adminskin');
     $skin = !empty($customskin) ? $customskin : "base";
     // call the placeholder view helper for each side parsed
     echo $this->view->placeholder($side);
     // Get all the xml blocks
     $xmlblocks = Shineisp_Commons_Layout::getBlocks($module, $side, $controller, $skin);
     if (!empty($xmlblocks)) {
         $blocks['reference'] = $xmlblocks;
     }
     if (!empty($blocks['reference'])) {
         $blocks['reference'] = Shineisp_Commons_Utilities::columnSort($blocks['reference'], 'position');
     }
     if (isset($blocks['reference']['block'])) {
         $this->Iterator($blocks['reference'], $side);
     } elseif (isset($blocks['reference'][0])) {
         foreach ($blocks['reference'] as $block) {
             $this->Iterator($block, $side);
         }
     }
     $this->view->module = $module;
     $this->view->controller = $controller;
     $this->view->action = $action;
 }
예제 #2
0
파일: Blocks.php 프로젝트: kokkez/shineisp
 /**
  * showblock
  * Handle the Cms blocks and XML Blocks 
  * @param unknown_type $side
  */
 public function showblock($side)
 {
     $ns = new Zend_Session_Namespace();
     $languageID = $ns->langid;
     $record = array();
     $blocks = array();
     // Get the main variables
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $customskin = Settings::findbyParam('skin');
     $skin = !empty($customskin) ? $customskin : "blank";
     // call the placeholder view helper for each side parsed
     echo $this->view->placeholder($side);
     // Get all the xml blocks
     $xmlblocks = Shineisp_Commons_Layout::getBlocks($module, $side, $controller, $skin);
     // HOMEPAGE BLOCKS
     // If the controller called is the homepage, event detail page or a cms page ...
     // #################
     if ($controller == "index") {
         $record = CmsPages::findbyvar('homepage', $ns->lang);
         $var = Zend_Controller_Front::getInstance()->getRequest()->getParam('url');
         if (!empty($var)) {
             $record = CmsPages::findbyvar($var, $ns->lang);
         }
     } elseif ($controller == "cms") {
         $var = Zend_Controller_Front::getInstance()->getRequest()->getParam('url');
         $record = CmsPages::findbyvar($var, $ns->lang);
     }
     // Load the xml found in the recordset
     if (!empty($record['blocks'])) {
         // Load the xml into an array
         $xmlobject = simplexml_load_string($record['blocks']);
         // Get the blocks from the xml structure
         if (count($xmlobject)) {
             $i = 0;
             foreach ($xmlobject as $block) {
                 $blocks['reference'][$i]['block']['name'] = (string) $block;
                 $blocks['reference'][$i]['side'] = (string) $block['side'];
                 $blocks['reference'][$i]['position'] = (string) $block['position'];
                 $i++;
             }
         }
     }
     // Join every block in one unique blocks structure
     if (!empty($xmlblocks)) {
         if (!empty($blocks['reference'])) {
             $blocks['reference'] = array_merge($xmlblocks, $blocks['reference']);
         } else {
             $blocks['reference'] = $xmlblocks;
         }
     }
     if (!empty($blocks['reference'])) {
         $blocks['reference'] = Shineisp_Commons_Utilities::columnSort($blocks['reference'], 'position');
     }
     if (isset($blocks['reference']['block'])) {
         $this->Iterator($blocks['reference'], $side);
     } elseif (isset($blocks['reference'][0])) {
         foreach ($blocks['reference'] as $block) {
             $this->Iterator($block, $side);
         }
     }
     if (Settings::findbyParam('debug')) {
         echo "<div class=\"alert alert-info\"><h4>{$side} <small>({$skin})</small></h4>Path: {$module}/{$controller}/{$action}</div>";
     }
     $this->view->module = $module;
     $this->view->controller = $controller;
     $this->view->action = $action;
 }