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
 /**
  * Retrieve a module admin instance
  *
  * If we are on 2.6 this will be the a XoopsModuleAdmin instance.
  * Older systems with the Frameworks based admin class will get
  * an instance of this class which provides compatible methods
  * built from the old Frameworks version.
  *
  * **Always use this to get the ModuleAdmin instance if you use
  * anything (even the static methods) of this class.**
  *
  * @return object a ModuleAdmin instance.
  *
  * @since  1.0
  */
 public static function getInstance()
 {
     static $instance;
     if ($instance === null) {
         if (class_exists('\\Xoops\\Module\\Admin', true)) {
             $instance = new \Xoops\Module\Admin();
             self::$ModuleAdmin = $instance;
         } else {
             \Xmf\Loader::loadFile(\XoopsBaseConfig::get('root-path') . '/Frameworks/moduleclasses/moduleadmin/moduleadmin.php');
             self::$ModuleAdmin = new \ModuleAdmin();
             $instance = new \Xmf\Module\Admin();
         }
     }
     return $instance;
 }