コード例 #1
0
ファイル: Abstract.php プロジェクト: BGCX262/zym-svn-to-git
 /**
  * Load the model
  * 
  * @throws Exception
  * @param string $modelName
  * @param string $module
  * @param string $modelPrefix
  */
 public function loadModel($modelName, $module = null, $modelPrefix = null)
 {
     $modelName = ucfirst($modelName);
     $fileName = $modelName . '.php';
     if (!$module) {
         $module = $this->_request->getModuleName();
     }
     if (!$modelPrefix) {
         $modelPrefix = $this->_modelPrefix;
     }
     if ($modelPrefix) {
         $modelName = ucfirst($modelPrefix) . '_' . $modelName;
     }
     $modelName = str_ireplace('_', '/', $modelName);
     if (class_exists($modelName, false)) {
         return true;
     }
     $controllerDirectory = $this->_dispatcher->getControllerDirectory($module);
     $moduleDirectory = dirname($controllerDirectory);
     $modelDirectory = $moduleDirectory . '/' . $this->_modelDirectory;
     Zend_Loader::loadFile($fileName, $modelDirectory, true);
     if (!class_exists($modelName, false)) {
         throw new Zym_Loader_Exception('Failed to load class "' . $modelName . '"');
     }
     return true;
 }
コード例 #2
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();
         }
     }
 }
コード例 #3
0
ファイル: Initializer.php プロジェクト: ngukho/ducbui-cms
 private function _isAdminPage()
 {
     $module = $this->_request->getModuleName();
     $controller = $this->_request->getControllerName();
     if ($module != 'public' && $controller != 'public') {
         return true;
     }
 }
コード例 #4
0
ファイル: Abstract.php プロジェクト: BGCX262/zym-svn-to-git
 /**
  * Load the model
  *
  * @throws Exception
  * @param string $modelName
  * @param string $modelPrefix
  * @param string $module
  */
 public function loadModel($modelName, $modelPrefix = null, $module = null)
 {
     $modelName = ucfirst($modelName);
     if (!$module) {
         $module = $this->_request->getModuleName();
     }
     if (!$modelPrefix) {
         $modelPrefix = $this->_modelPrefix;
     }
     if ($modelPrefix) {
         $modelName = ucfirst($modelPrefix) . '/' . $modelName;
     }
     $modelName = str_ireplace('_', '/', $modelName);
     $controllerDirectory = $this->_dispatcher->getControllerDirectory($module);
     $moduleDirectory = dirname($controllerDirectory);
     $filePath = array($moduleDirectory, $this->_modelDirectory, $modelName);
     $file = implode('/', $filePath) . '.php';
     if (file_exists($file)) {
         require_once $file;
     } else {
         throw new Exception(sprintf('File "%s" could not be loaded', $file));
     }
 }