示例#1
0
 public function __construct()
 {
     if (get_class($this) === 'Pinet_Module') {
         // Skipping the CI Load
         return;
     }
     self::$instance =& $this;
     $this->CI =& get_instance();
     $this->load = $this->CI->load;
     $module_path = dirname(get_class_script_path(get_class($this)));
     $this->CI->load->add_package_path($module_path);
     $this->CI->addTemplateDir($module_path . '/views');
 }
 public function handle($i)
 {
     $template = $i->call_method;
     // Yes, this is a little bit tricky, since the render inteceptor is added after the desigin, and try to not interfere with the origin design.
     $args = $i->args;
     $CI =& get_instance();
     if (method_exists($CI, 'getTheme')) {
         $theme = $CI->getTheme();
     }
     $module =& get_current_module();
     if (isset($module)) {
         // We're in a module
         $module_path = dirname(get_class_script_path(get_class($module)));
         if (method_exists($module, 'getTheme')) {
             $theme = $module->getTheme();
         }
         if (isset($theme)) {
             ci_log('Adding the path %s', $module_path . '/views/themes/' . $theme . '/');
             $CI->addTemplateDir($module_path . '/views/themes/' . $theme . '/');
             ci_log('The template dirs is ', $CI->smarty->template_dir);
         }
     } else {
         // We're in a controller
         if (isset($theme)) {
             $CI->addTemplateDir(FCPATH . APPPATH . '/views/themes/' . $theme);
         }
     }
     if (isset($theme)) {
         if (isset($CI->sasscompiler)) {
             foreach (array(APPPATH, 'pinet/') as $d) {
                 $p = FCPATH . $d . 'static/scss/themes/' . $theme . '/';
                 ci_log('Adding the include path for scss %s', $p);
                 $CI->sasscompiler->addIncludePath($p, 0);
             }
         }
     }
 }
示例#3
0
 public function loadConfig()
 {
     $path = dirname(get_class_script_path($this)) . '/widget.json';
     if (file_exists($path)) {
         $json = file_get_contents($path);
         $this->config = json_decode($json);
         ci_log('The config is ', $this->config);
     } else {
         show_error(lang_f('Cant\'t find configuration file for widget %s', get_class($this)));
     }
 }