protected static function _runModuleInstall($module) { $moduleLocationDir = GMP_MODULES_DIR; if (!empty($module['ex_plug_dir'])) { $moduleLocationDir = utilsGmp::getPluginDir($module['ex_plug_dir']); } if (is_dir($moduleLocationDir . $module['code'])) { importClassGmp($module['code'], $moduleLocationDir . $module['code'] . DS . 'mod.php'); $moduleClass = toeGetClassNameGmp($module['code']); $moduleObj = new $moduleClass($m); if ($moduleObj) { $moduleObj->install(); } } }
protected static function _runModuleInstall($module, $action = 'install') { $moduleLocationDir = GMP_MODULES_DIR; if (!empty($module['ex_plug_dir'])) { $moduleLocationDir = utilsGmp::getPluginDir($module['ex_plug_dir']); } if (is_dir($moduleLocationDir . $module['code'])) { if (!class_exists($module['code'] . strFirstUp(GMP_CODE))) { importClassGmp($module['code'], $moduleLocationDir . $module['code'] . DS . 'mod.php'); } $moduleClass = toeGetClassNameGmp($module['code']); $moduleObj = new $moduleClass($module); if ($moduleObj) { $moduleObj->{$action}(); } } }
function toeCreateObjGmp($class, $params) { $className = toeGetClassNameGmp($class); $obj = NULL; if (class_exists('ReflectionClass')) { $reflection = new ReflectionClass($className); try { $obj = $reflection->newInstanceArgs($params); } catch (ReflectionException $e) { // If class have no constructor $obj = $reflection->newInstanceArgs(); } } else { $obj = new $className(); call_user_func_array(array($obj, '__construct'), $params); } return $obj; }
protected function _createController() { if (!file_exists($this->getModDir() . 'controller.php')) { return false; // EXCEPTION!!! } if ($this->_controller) { return true; } if (file_exists($this->getModDir() . 'controller.php')) { $className = ''; if (import($this->getModDir() . 'controller.php')) { $className = toeGetClassNameGmp($this->getCode() . 'Controller'); } if (!empty($className)) { $this->_controller = new $className($this->getCode()); $this->_controller->init(); return true; } } return false; }
protected function _extractModules() { $activeModules = $this->getTable('modules')->innerJoin($this->getTable('modules_type'), 'type_id')->get($this->getTable('modules')->alias() . '.*, ' . $this->getTable('modules_type')->alias() . '.label as type_name'); if ($activeModules) { foreach ($activeModules as $m) { $code = $m['code']; $moduleLocationDir = GMP_MODULES_DIR; if (!empty($m['ex_plug_dir'])) { $moduleLocationDir = utilsGmp::getExtModDir($m['ex_plug_dir']); } if (is_dir($moduleLocationDir . $code)) { $this->_allModules[$m['code']] = 1; if ((bool) $m['active']) { importClassGmp($code . strFirstUp(GMP_CODE), $moduleLocationDir . $code . DS . 'mod.php'); $moduleClass = toeGetClassNameGmp($code); if (class_exists($moduleClass)) { $this->_modules[$code] = new $moduleClass($m); $this->_modules[$code]->setParams((array) json_decode($m['params'])); if (is_dir($moduleLocationDir . $code . DS . 'tables')) { $this->_extractTables($moduleLocationDir . $code . DS . 'tables' . DS); } } } } } } //$operationTime = microtime(true) - $startTime; }
protected function _createView($name = '') { if (empty($name)) { $name = $this->getCode(); } $parentModule = frameGmp::_()->getModule($this->getCode()); $className = ''; if (importGmp($parentModule->getModDir() . 'views' . DS . $name . '.php')) { $className = toeGetClassNameGmp($name . 'View'); } if ($className) { $view = new $className(); $view->setCode($this->getCode()); return $view; } return NULL; }