Esempio n. 1
0
 /**
  * Gets a listing of all currently installed modules and whether they are active or not
  * @return void
  */
 public function action_all()
 {
     $modules = Jx_Modules::get_all();
     $data = array();
     foreach ($modules as $name => $values) {
         $obj = new stdClass();
         $obj->name = ucfirst($name);
         $obj->id = $values['id'];
         $obj->active = Jx_Modules::isActivated($name);
         $obj->permanent = Jx_Modules::isPermanent($name);
         $obj->version = Jx_Modules::getVersion($name);
         $data[] = $obj;
     }
     $this->template->data = $data;
     $this->template->success = true;
 }
Esempio n. 2
0
 public function before()
 {
     $this->session = Session::instance();
     $this->config = Kohana::config('loader');
     //search all activated modules for media and normalize in the
     //config array
     //Jx_Debug::dump(Jx_Modules::get_all());
     foreach (Jx_Modules::get_all() as $mod => $arr) {
         $basePath = MODPATH . $mod . DS . 'media' . DS . $mod . DS;
         if ($arr['activated'] && file_exists($basePath)) {
             $create = false;
             $jsPath = null;
             $cssPath = null;
             $imgPath = null;
             $imgUrl = null;
             if (is_dir($basePath . 'js')) {
                 $jsPath = $basePath . 'js' . DS;
                 $create = true;
             }
             if (is_dir($basePath . 'css')) {
                 $cssPath = $basePath . 'css' . DS;
                 $create = true;
             }
             $img = false;
             if (is_dir($basePath . 'images')) {
                 $imgPath = $basePath . 'images' . DS;
                 $imgUrl = '../images/';
                 $create = true;
                 $img = true;
             }
             if ($create && $img) {
                 $this->config['repos'][$mod] = array('imageUrl' => $imgUrl, 'paths' => array('js' => $jsPath, 'css' => $cssPath, 'images' => $imgPath));
                 //Jx_Debug::dump($this->config['repos'][$mod], 'config for '.$mod);
             } elseif ($create) {
                 $this->config['repos'][$mod] = array('paths' => array('js' => $jsPath, 'css' => $cssPath));
                 //Jx_Debug::dump($this->config['repos'][$mod], 'config for '.$mod);
             }
         }
     }
     //Jx_Debug::dump($this->config);
 }