コード例 #1
0
ファイル: ZAdminController.php プロジェクト: kimthangatm/zcms
 /**
  * @overwrite function initialize
  */
 public function initialize()
 {
     //Get module name
     if (method_exists($this->dispatcher, 'getModuleName')) {
         $this->_module = $this->dispatcher->getModuleName();
     }
     //Get controller name
     $this->_controller = $this->dispatcher->getControllerName();
     //Get action name
     $this->_action = $this->dispatcher->getActionName();
     //Get template default
     $this->_defaultTemplate = $this->config->backendTemplate->defaultTemplate;
     //Get logged user
     $this->_user = $this->session->get('auth');
     //Add toolbar helper
     $this->_toolbar = ZToolbarHelper::getInstance($this->_module, $this->_controller);
     if ($this->_autoTranslateToolbar) {
         if ($this->_action === 'index') {
             $this->_toolbar->addHeaderPrimary('m_admin_' . $this->_module . '_' . $this->_controller);
             $this->_toolbar->addHeaderSecond('m_admin_' . $this->_module);
         } else {
             $this->_toolbar->addHeaderPrimary('m_admin_' . $this->_module . '_' . $this->_controller . '_' . $this->_action);
             $this->_toolbar->addHeaderSecond('m_admin_' . $this->_module . '_' . $this->_controller);
         }
         $this->_toolbar->addBreadcrumb('m_admin_' . $this->_module);
         $this->_toolbar->addBreadcrumb('m_admin_' . $this->_module . '_' . $this->_controller);
     }
     //Add basic variables
     $this->_initBasicViewVariables();
     $this->assets->collection('js_footer');
     $this->assets->collection('css_header');
     $this->_debugModel();
 }
コード例 #2
0
ファイル: ZTemplate.php プロジェクト: kimthangatm/zcms
 /**
  * Before render
  *
  * @param PEvent $event
  * @param PView $view
  * @return PView
  */
 public function beforeRender($event, $view)
 {
     $view->setVar('_limit', $view->getDI()->get('config')->pagination->limit);
     if (isset($view->_sortColumn) && isset($view->_filter)) {
         $filter = array_column($view->_sortColumn, 'filter');
         if (!empty($filter)) {
             $filterForm = new ZFormFilter($filter, $view->_filter);
             $view->setVar('_filterColumn', $filterForm->getForm());
         }
     }
     $view->setVar('_toolbarHelpers', ZToolbarHelper::getInstance($this->moduleBaseName, $view->getControllerName()));
 }