Esempio n. 1
0
 /**
  * Add the appropriate view scripts directories for a given request.
  * This is pretty much the glue between the plugin broker and the
  * View object, since it uses data from the plugin broker to determine what
  * script paths will be available to the view.  
  * 
  * @param Zend_Controller_Request_Abstract $request Request object.
  * @return void
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     // Getting the module name from the request object is pretty much the main
     // reason why this needs to be in a controller plugin and can't be localized
     // to the view script.
     $moduleName = $request->getModuleName();
     $isPluginModule = !in_array($moduleName, array('default', null));
     $themeType = is_admin_theme() ? 'admin' : 'public';
     $pluginScriptDirs = $this->_pluginMvc->getViewScriptDirs($themeType);
     // Remove the current plugin, if any, from the set of "normal" plugin paths
     if ($isPluginModule && isset($pluginScriptDirs[$moduleName])) {
         $currentPluginScriptDirs = $pluginScriptDirs[$moduleName];
         unset($pluginScriptDirs[$moduleName]);
     }
     // Add all the "normal" plugin paths
     foreach ($pluginScriptDirs as $modulePaths) {
         $this->_addPathsToView($modulePaths);
     }
     // Add the theme and core paths
     $this->_addThemePaths($themeType);
     // Add plugin and theme-override paths for current plugin
     if ($isPluginModule) {
         if (isset($currentPluginScriptDirs)) {
             $this->_addPathsToView($currentPluginScriptDirs);
         }
         $this->_addOverridePathForPlugin($themeType, $moduleName);
     }
 }