Ejemplo n.º 1
0
 /**
  * 
  * @param string $moduleName
  * @return boolean
  */
 public static function getModuleIdByName($moduleName)
 {
     $returnValue = false;
     $resultModule = Module::getIdByParameter('name', $moduleName);
     if (count($resultModule) > 0) {
         $returnValue = $resultModule[0];
     }
     return $returnValue;
 }
Ejemplo n.º 2
0
 /**
  * 
  * @throws \Exception
  */
 protected function preInstall()
 {
     $newModuleId = Module::getIdByParameter('name', $this->moduleInfo['shortname']);
     if (count($newModuleId) == 0) {
         $params = array('name' => $this->moduleInfo['shortname'], 'alias' => $this->moduleInfo['name'], 'description' => $this->moduleInfo['description'], 'author' => implode(", ", $this->moduleInfo['author']), 'name' => $this->moduleInfo['shortname'], 'version' => $this->moduleInfo['version'], 'isactivated' => '0', 'isinstalled' => '0');
         Module::insert($params);
         $newModuleId = Module::getIdByParameter('name', $this->moduleInfo['shortname']);
         $this->moduleId = $newModuleId[0];
     } else {
         throw new \Exception("Module already installed");
     }
 }
Ejemplo n.º 3
0
 /**
  * 
  * @param integer $moduleId
  */
 public function setDependencies($moduleId = null)
 {
     if (is_array($moduleId)) {
         $currentModule = $moduleId[0];
     } else {
         $currentModule = $moduleId;
     }
     foreach ($this->moduleInfo['dependencies'] as $dependency) {
         $parentId = ModuleModel::getIdByParameter('name', $dependency['name']);
         if (count($parentId) > 0) {
             ModuleDependency::insert(array('parent_id' => $parentId[0], 'child_id' => $currentModule));
         }
     }
 }