Example #1
0
 public function load($module)
 {
     $m = explode(".", $module);
     if (count($m) == 2 && $m[1] != '') {
         $name = lcfirst($m[1]);
         $class = ucfirst($name) . "Module";
         $basePath = $m[0] == "app" ? Setting::getAppPath() : Setting::getApplicationPath();
         $alias = ($m[0] == "app" ? 'app' : 'application') . ".modules.{$name}.{$class}";
         $path = $basePath . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $name;
         $classPath = $path . DIRECTORY_SEPARATOR . $class . ".php";
         $this->name = $name;
         $this->alias = $alias;
         $this->path = $path;
         $this->classPath = $classPath;
         if (is_file($this->classPath)) {
             $this->module = ModuleGenerator::init($alias, 'load');
             $this->accessType = $this->module->checkAccessType();
             $this->defaultRule = $this->module->defaultRule;
             $this->rolesRule = $this->module->rolesRule;
             $this->usersRule = $this->module->usersRule;
             $this->acSource = $this->module->acSource;
             $this->imports = $this->module->loadImport();
         } else {
             $this->module = null;
         }
     }
 }
Example #2
0
 public static function create($classAlias)
 {
     $module = ModuleGenerator::init($classAlias);
 }