コード例 #1
0
ファイル: Interface.php プロジェクト: laiello/digitalus-cms
 /**
  * Render the action script and assign the the view for use
  * in the layout script. Render the layout script and append
  * to the Response's body.
  *
  * @param string $script
  * @param string $name
  */
 public function renderScript($script, $name = null)
 {
     $this->_actionScript = $script;
     if (null === $name) {
         $name = $this->getResponseSegment();
     }
     //load the common helpers
     Digitalus_View_RegisterHelpers::register($this->view);
     //do not add the layout script to any of the public controllers
     //these are the controllers that render module parts
     $request = $this->getRequest();
     // assign action script name to view.
     $this->view->actionScript = $script;
     if ($request->getModuleName() != 'public' && $request->getControllerName() != 'public' && !$request->isXmlHttpRequest()) {
         //add the script path to admin
         $this->view->addScriptPath('./application/admin/views/scripts/assets');
         $this->view->addScriptPath('./templates/admin');
         $this->_loadAdminUser();
         $this->_loadAdminMenu();
         $this->_loadSidebar();
         $this->_loadMainForm();
         $this->_loadOptions();
         // render layout script and append to Response's body
         $layoutScript = $this->getLayoutScript();
         $layoutContent = $this->view->render($layoutScript);
     } else {
         $layoutContent = $this->view->render($this->view->actionScript);
     }
     $this->getResponse()->appendBody($layoutContent, $name);
     $this->setNoRender();
 }
コード例 #2
0
 /**
  * this function routes all requests that come in to the default module to the index controller / index action
  *
  * @param zend_controller_request $request
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if (!$request->isXmlHttpRequest()) {
         //load the module, controller, and action for reference
         $this->module = $request->getModuleName();
         $this->controller = $request->getControllerName();
         $this->action = $request->getActionName();
         //load the section
         if (isset($this->sections[$this->controller])) {
             $this->section = $this->sections[$this->controller];
         } else {
             $this->section = $this->defaultSection;
         }
         if ($this->_isAdminPage($request)) {
             $this->view->isAdminPage = true;
             //load config
             $config = Zend_Registry::get('config');
             //setup layout
             $options = array('layout' => $config->design->adminLayout, 'layoutPath' => $config->design->adminLayoutFolder, 'contentKey' => 'form');
             $this->layout = Zend_Layout::startMvc($options);
             $this->view = $this->layout->getView();
             //load the common helpers
             Digitalus_View_RegisterHelpers::register($this->view);
             $this->view->setScriptPath($config->filepath->adminViews);
             //load language files
             $translate = null;
             foreach ($config->language->translations as $locale => $translation) {
                 if (is_object($translate)) {
                     $translate->addTranslation($config->language->path . '/' . $translation . '.csv', $locale);
                 } else {
                     $translate = new Zend_Translate('csv', $config->language->path . '/' . $translation . '.csv', $locale);
                 }
             }
             $locale = $config->language->defaultLocale;
             #                $translate->setLocale($locale);
             $translate->setCache(Zend_Registry::get('cache'));
             $this->view->translate = $translate;
             //page links
             $this->view->toolbarLinks = array();
         }
     }
 }
コード例 #3
0
ファイル: Initializer.php プロジェクト: laiello/digitalus-cms
 /**
  * Initialize the admin interface
  *
  * @return void
  */
 protected function _initInterface()
 {
     if (!$this->_request->isXmlHttpRequest()) {
         //load the module, controller, and action for reference
         $module = $this->_request->getModuleName();
         $controller = $this->_request->getControllerName();
         if ('public' != $module && 'public' != $controller) {
             // Get config
             $config = Zend_Registry::get('config');
             // Setup layout
             $options = array('layout' => $config->design->adminLayout, 'layoutPath' => $config->design->adminLayoutFolder, 'contentKey' => 'form');
             $this->layout = Zend_Layout::startMvc($options);
             $this->view = $this->layout->getView();
             // Load the common helpers
             Digitalus_View_RegisterHelpers::register($this->view);
             $this->view->setScriptPath($config->filepath->adminViews);
             // add helpers
             $this->view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
             $this->view->jQuery()->setLocalPath($this->view->getBaseUrl() . '/scripts/jquery/' . self::JQUERY_VERSION);
             $this->view->jQuery()->setUiLocalPath($this->view->getBaseUrl() . '/scripts/jquery/' . self::JQUERY_UI_VERSION);
             $this->view->jQuery()->addStylesheet($this->view->getBaseUrl() . '/scripts/jquery/ui-theme/' . self::JQUERY_UI_THEME);
             $this->view->jQuery()->enable();
             $this->view->jQUery()->uiEnable();
             // Page links
             $this->view->toolbarLinks = array();
         }
     }
 }