Example #1
0
 /**
  * Initialize parent::__constuct calls this after verifying module object.
  *
  * @return void
  */
 public function init()
 {
     if (!class_exists('XoopsGroupPermHandler', true)) {
         Loader::loadFile(\XoopsBaseConfig::get('root-path') . '/kernel/groupperm.php');
     }
     $this->mid = $this->module->getVar('mid');
     $this->dirname = $this->module->getVar('dirname');
     $this->db = \XoopsDatabaseFactory::getConnection();
     $this->perm = new \XoopsGroupPermHandler($this->db);
     if (class_exists('Xoops', false)) {
         $this->xoops = \Xoops::getInstance();
     }
 }
Example #2
0
 /**
  * get a handler instance and store in $this->_handlers
  *
  * @param string $name name of handler to load
  *
  * @return void
  */
 private function _initHandler($name)
 {
     $this->addLog('INIT ' . $name . ' HANDLER');
     if (!isset($this->_handlers[$name])) {
         $hnd_file = \XoopsBaseConfig::get('root-path') . "/modules/{$this->dirname}/class/{$name}.php";
         if (file_exists($hnd_file)) {
             include_once $hnd_file;
         }
         $class = ucfirst(strtolower($this->dirname)) . ucfirst(strtolower($name)) . 'Handler';
         if (class_exists($class)) {
             $db = \XoopsDatabaseFactory::getConnection();
             $this->_handlers[$name] = new $class($db);
             $this->addLog("Loading class '{$class}'");
         } else {
             $this->addLog("ERROR :: Class '{$class}' could not be loaded");
         }
     }
 }