コード例 #1
0
ファイル: IndexController.php プロジェクト: kokkez/shineisp
 public function indexAction()
 {
     $ns = new Zend_Session_Namespace();
     $locale = $ns->lang;
     Shineisp_Commons_Utilities::log("ShineISP starts now from " . $_SERVER['SERVER_ADDR']);
     if (empty($ns->customer)) {
         $this->view->dashboard = true;
     } else {
         $this->view->dashboard = false;
     }
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     // Call the static Homepage
     $homepage = CmsPages::findbyvar("homepage", $locale);
     if (!empty($homepage['body'])) {
         // Set the custom layout of the page
         if (!empty($homepage['pagelayout'])) {
             $this->getHelper('layout')->setLayout($homepage['pagelayout']);
         }
         // Set the keywords of the page
         if (!empty($homepage['keywords'])) {
             $this->view->headMeta()->setName('keywords', $homepage['keywords']);
         }
         // Set the body of the page
         $this->view->content = $homepage['body'];
     }
     $this->view->headertitle = "S: " . Shineisp_Registry::get('ISP')->slogan;
 }
コード例 #2
0
ファイル: CmsController.php プロジェクト: kokkez/shineisp
 public function pageAction()
 {
     $var = $this->getRequest()->getParam('url');
     $ns = new Zend_Session_Namespace();
     $locale = $ns->lang;
     if (!empty($var)) {
         $page = CmsPages::findbyvar($var, $locale);
         if ($page['active'] == false) {
             return $this->_helper->redirector('index', 'index', 'default');
         }
         // Set the Metatag information
         $this->view->headTitle(" | " . $page['title']);
         if (!empty($page['keywords'])) {
             $this->view->headMeta()->setName('keywords', $page['keywords']);
         }
         if (!empty($page['body'])) {
             $this->view->headMeta()->setName('description', $page['body'] ? Shineisp_Commons_Utilities::truncate(strip_tags($page['body'])) : '-');
         }
         $this->view->headertitle = $page['title'];
         // Set the page content
         $this->view->data = $page;
         // Set the subheader
         $this->view->headerdata = $this->CreateSubHeader($page);
     }
     if (!empty($page['xmllayout'])) {
         Shineisp_Commons_Layout::updateLayout($this->view, $page['xmllayout']);
     }
     if (!empty($page['pagelayout'])) {
         $this->getHelper('layout')->setLayout("cms/" . $page['pagelayout']);
     }
     if (!empty($page['layout'])) {
         return $this->_helper->viewRenderer($page['layout']);
     } else {
         return $this->_helper->viewRenderer('1column');
     }
 }
コード例 #3
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;
 }