public static function execApiMethod($method, $moduleArr) { $data = array(); $paramNum = func_num_args(); if (2 < $paramNum) { $params = func_get_args(); $args = array_slice($params, 2, count($params)); } else { $args = array(); } $enableModule = Module::model()->fetchAllEnabledModule(); foreach ($moduleArr as $module) { if (array_key_exists($module, $enableModule)) { $class = ucfirst($module) . "Api"; if (class_exists($class)) { $api = new $class(); if ($args) { $data[$module] = call_user_func_array(array($api, $method), $args); } else { $data[$module] = $api->{$method}(); } } } } return $data; }
public function checkModule($attribute) { if (Module::model()->exists('name=:name AND only_one=1', array(':name' => $this->module)) && Tree::model()->exists('id<>:id AND module=:module', array(':id' => !$this->isNewRecord ? $this->id : 0, ':module' => $this->module))) { $treeName = Tree::model()->find('module=:module', array(':module' => $this->module)); $this->addError($attribute, 'Модуль уже используется в разделе «' . $treeName->name . '»'); } }
public function actionSetup() { $formSubmit = EnvUtil::submitCheck("formhash"); if ($formSubmit) { $data =& $_POST; foreach (array("sendemail", "sendsms", "sendmessage") as $field) { if (!empty($data[$field])) { $ids = array_keys($data[$field]); $idstr = implode(",", $ids); Notify::model()->updateAll(array($field => 1), sprintf("FIND_IN_SET(id,'%s')", $idstr)); Notify::model()->updateAll(array($field => 0), sprintf("NOT FIND_IN_SET(id,'%s')", $idstr)); } else { Notify::model()->updateAll(array($field => 0)); } } CacheUtil::update("NotifyNode"); $this->success(Ibos::lang("Save succeed", "message")); } else { $nodeList = Notify::model()->getNodeList(); foreach ($nodeList as &$node) { $node["moduleName"] = Module::model()->fetchNameByModule($node["module"]); } $this->render("setup", array("nodeList" => $nodeList)); } }
public function fetchAllEnabledMenu() { $allEnabledModules = Module::model()->fetchAllEnabledModule(); $enabledModStr = implode(",", array_keys($allEnabledModules)); $criteria = array("condition" => "(FIND_IN_SET(`module`, '{$enabledModStr}') OR iscustom=1) AND disabled=0", "order" => "`sort` ASC"); $menus = $this->fetchAllSortByPk("id", $criteria); return $menus; }
public function run() { //Yii::import('Xpress.models.Module'); $criteria = new CDbCriteria(); $criteria->condition = "enabled = true AND has_back_end = 'y'"; $criteria->order = 'ordering ASC'; $modules = Module::model()->findAll($criteria); $this->render('module_backend_menus_system', array('modules' => $modules)); }
public function actionIndex() { $moduleId = $this->get('id', ''); $model = Module::model()->find('name = :name', array(':name' => $moduleId)); if ($model && $this->generateRoutes($moduleId)) { $features = $this->getFeatures($moduleId); } $roles = AuthItem::model()->findAll('type = 2'); $this->render('index', array('model' => $model, 'features' => $features, 'roles' => $roles)); }
/** * get all modules of system * valid current module is exist * * @param string $module * * @return array */ protected function getModules($module) { $modules = Module::model()->findAll(); if (count($modules)) { $modules = CHtml::listData($modules, 'name', 'friendly_name'); } if (empty($module) === false && $module != 'system' && !array_key_exists($module, $modules)) { throw new CHttpException(500, 'Invalid module'); } return $modules; }
public function testCreate() { $model = new Module(); $model->crashreport_id = 1; $model->name = 'user32.dll'; $model->file_version = '6.1.0.7600'; $model->sym_load_status = 0; $model->loaded_debug_info_id = null; $saved = $model->save(); $this->assertTrue($saved); $model = Module::model()->find('name="user32.dll"'); $this->assertTrue($model != null); }
protected function init() { $this->setLicence(); $this->_enabledModule = Module::model()->fetchAllEnabledModule(); foreach ($this->getEnabledModule() as $module) { $config = CJSON::decode($module["config"], true); if (isset($config["configure"]) && array_key_exists("modules", $config["configure"])) { if (isset($config["behaviors"])) { $this->setBehaviors($config["behaviors"]); } parent::configure($config["configure"]); } } parent::init(); }
public function actionStatus() { $moduleStatus = EnvUtil::getRequest("type"); $module = EnvUtil::getRequest("module"); if (Ibos::app()->getRequest()->getIsAjaxRequest()) { $status = 0; if ($moduleStatus == "disabled") { $status = 1; } $changeStatus = Module::model()->modify($module, array("disabled" => $status)); Nav::model()->updateAll(array("disabled" => $status), "module = :module", array(":module" => $module)); CacheUtil::update(array("setting", "nav")); ModuleUtil::updateConfig($module); $this->ajaxReturn(array("IsSuccess" => $changeStatus), "json"); } }
public static function getModulesByTeacher($id){ $modules = Yii::app()->db->createCommand(array( 'select' => array('idModule'), 'from' => 'teacher_module', 'where' => 'idTeacher=:id', 'order' => 'idModule', 'params' => array(':id' => $id), ))->queryAll(); $count = count($modules); for($i = 0;$i < $count;$i++){ $modules[$i]["title"] = Module::model()->findByPk($modules[$i]["idModule"])->module_name; } return (!empty($modules))?$modules:[]; }
public function actionSave() { $q = $_POST['q']; $arr = explode(";;", $q); $num = 1; foreach ($arr as $elem) { $arrElem = explode("||", $elem); $mod = Module::model()->findByPk($arrElem[0]); $mod->name = $arrElem[1]; $mod->controller = $arrElem[2]; $mod->icon = $arrElem[3]; $mod->parent_id = $arrElem[4]; $mod->order = $num; $mod->save(); $num++; } }
public function actionIndex() { $modules = Module::model()->fetchAllClientModule(); $widgetModule = $modules; foreach ($widgetModule as $index => $module) { $conf = CJSON::decode($module["config"]); $param = $conf["param"]; if (!isset($param["indexShow"]) || !isset($param["indexShow"]["widget"])) { unset($widgetModule[$index]); } } $moduleArr = ConvertUtil::getSubByKey($widgetModule, "module"); $moduleSetting = MainUtil::execApiMethod("loadSetting", $moduleArr); $data = array("modules" => $modules, "widgetModule" => $widgetModule, "moduleSetting" => CJSON::encode($moduleSetting), "menus" => MenuPersonal::model()->fetchMenuByUid(Ibos::app()->user->uid)); $this->setPageTitle(Ibos::lang("Home office")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Home office")))); $this->render("index", $data); }
function fetchModules() { $userLevelId = Yii::app()->user->userLevelId; $arrIdParentModule = array(); // fetch parent id join with privilages $criteria = new CDbCriteria(); $criteria->distinct = true; $criteria->select = 't.p_id'; $criteria->join = 'LEFT JOIN module_privilage as mp ON t.id = mp.module_id'; $criteria->condition = 'mp.user_level_id = :userLevelId'; $criteria->params = array(":userLevelId" => $userLevelId); $modules = Module::model()->findAll($criteria); for ($x = 0; $x < count($modules); $x++) { $arrIdParentModule[] = $modules[$x]->p_id; } // fetch parent $criteria = new CDbCriteria(); $criteria->addInCondition('id', $arrIdParentModule, 'OR'); $modules = Module::model()->findAll($criteria); return $modules; }
public function actionPayNow(){ if (!isset($_POST['module']) ) { Yii::app()->user->setFlash('error', "<br>Будь-ласка, оберіть курс та модуль для оплати."); $this->redirect(Yii::app()->request->urlReferrer); } $permission = new Permissions(); $lectures = Yii::app()->db->createCommand(array( 'select' => array('id'), 'from' => 'lectures', 'where' => 'idModule=:id', 'params' => array(':id'=>$_POST["module"]), ))->queryAll(); $count = count($lectures); for($i = 0; $i < $count; $i++){ $permission->setRead($_POST['user'], $lectures[$i]["id"]); } Yii::app()->user->setFlash('pay', '<br /><h4>Вітаємо!</h4> Модуль <strong>'. Module::model()->findByPk($_POST["module"])->module_name.'</strong> курса <strong>'. Course::model()->findByPk($_POST['course'])->course_name.'</strong> оплачено. <br />Тепер у Вас є доступ до усіх лекцій цього модуля. <h4>Enjoy it!</h4>'); $this->redirect(Yii::app()->request->urlReferrer); }
public function actionIndex() { $systemInfo = EnvUtil::getSystemInfo(); $databaseSize = DatabaseUtil::getDatabaseSize(); list($dataSize, $dataUnit) = explode(" ", $databaseSize); $appClosed = Setting::model()->fetchSettingValueByKey("appclosed"); $newVersion = Ibos::app()->setting->get("newversion"); $getSecurityUrl = Ibos::app()->urlManager->createUrl("dashboard/index/getsecurity"); $mainModule = Module::model()->fetchByPk("main"); $authkey = Ibos::app()->setting->get("config/security/authkey"); $unit = Setting::model()->fetchSettingValueByKey("unit"); $license = Setting::model()->fetchSettingValueByKey("license"); $licenseUrl = $this->getLicenseUrl(unserialize($unit), $authkey); if (isset($_GET["attachsize"])) { $attachSize = Attachment::model()->getTotalFilesize(); $attachSize = is_numeric($attachSize) ? ConvertUtil::sizeCount($attachSize) : Ibos::lang("Unknow"); } else { $attachSize = ""; } $data = array("sys" => $systemInfo, "dataSize" => $dataSize, "dataUnit" => $dataUnit, "appClosed" => $appClosed, "newVersion" => $newVersion, "getSecurityUrl" => $getSecurityUrl, "installDate" => $mainModule["installdate"], "authkey" => $authkey, "license" => unserialize($license), "licenseUrl" => $licenseUrl, "attachSize" => $attachSize); $this->render("index", $data); }
public function actionGetAllByWorkflows(array $workflowIds) { $sql = 'SELECT DISTINCT module FROM ' . SITE_ID . '_setting WHERE workflow_id IN (' . implode(',', $workflowIds) . ') ORDER BY module'; $rows = app()->db->createCommand($sql)->queryAll(); $modules = array(); foreach ($rows as $row) { $module = $row['module']; // System module if (empty($module)) { $modules['module_system'] = 'System'; } else { $model = Module::model()->find("name = '{$module}'"); if (!empty($model)) { $modules[$model->name] = $module; } } } return $this->result = $modules; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Module::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionSvnInfo() { $svn_info_root_path = Yii::getPathOfAlias('runtime') . '/rev.txt'; // get old rev $old_rev = $this->getRevisionNumberFromSvnFile($svn_info_root_path); // get root svn info to know get current rev $current_rev = ''; $res = shell_exec('svn info ' . $_SERVER['DOCUMENT_ROOT'] . ' > ' . $svn_info_root_path); $current_rev = $this->getRevisionNumberFromSvnFile($svn_info_root_path); // begin to get svn info based on that rev if ($current_rev != '') { $svn_info_items = array(); $svn_info_items['SVN info of root'] = $this->getSvnInfo('', $current_rev); // delete file of old rev $runtime_path = Yii::getPathOfAlias('runtime'); if ($old_rev != '' && $current_rev != $old_rev) { $old_root_path = $runtime_path . '/' . $old_rev . '.txt'; if (file_exists($old_root_path)) { unlink($old_root_path); } } // get modules $modules = Module::model()->findAll(); foreach ($modules as $module) { $title = 'SVN info of ' . $module->name . ' module'; $svn_info_items[$title] = $this->getSvnInfo($module->name, $current_rev); // delete file of old rev if ($old_rev != '' && $current_rev != $old_rev) { $old_module_path = $runtime_path . '/' . strtolower($module->name) . '_' . $old_rev . '.txt'; if (file_exists($old_module_path)) { unlink($old_module_path); } } } $this->render('svn_info', array('svn_info_items' => $svn_info_items)); } }
public function validationBeforeDelete() { $usedInModule = array(); $this->onDeleteMessage = 'Cannot delete "' . $this->name . '", data already used in ('; $criteria = new CDbCriteria(); $criteria->compare('p_id', $this->id); $models = Module::model()->findAll($criteria); if (count($models) > 0) { $usedInModule[] = 'Module'; } if (count($usedInModule) > 0) { sort($usedInModule); foreach ($usedInModule as $value) { $this->onDeleteMessage .= $value . ', '; } $this->onDeleteMessage = substr($this->onDeleteMessage, 0, strlen($this->onDeleteMessage) - 2); $this->onDeleteMessage .= '). Please delete related data first before delete it!'; return false; } else { return true; } }
public function getCourseInfoById(){ $courseId = Module::model()->findByPk($this->idModule)->course; $course = Course::model()->findByPk($courseId); return array( 'courseTitle' => $course->course_name, 'courseLang' => $course->language, ); }
public function actionTranslate() { $sqlsm = ""; $sqlm = ""; $i = 0; $authorities = Authority::model()->findAll(); foreach ($authorities as $r) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'authorities','authority_" . htmlentities($r->id, ENT_QUOTES, 'UTF-8') . "_charge');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($r->charge, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; echo "<br/>"; $numbers = Numbers::model()->findAll(); $sqlsm = ""; $sqlm = ""; $i = 34; foreach ($numbers as $s) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'numbers','numbers_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_field');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->field, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; echo "<br/>"; $services = Service::model()->findAll(); $sqlsm = ""; $sqlm = ""; $i = 68; foreach ($services as $s) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','services_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','services_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; echo "<br/>"; $modules = Module::model()->findAll(); $sqlsm = ""; $sqlm = ""; foreach ($modules as $s) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','module_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','module_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; echo "<br/>"; $departments = Department::model()->findAll(); $sqlsm = ""; $sqlm = ""; $i = 157; foreach ($departments as $s) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'departments','department_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; echo "<br/>"; $specialities = Speciality::model()->findAll(); $sqlsm = ""; $sqlm = ""; foreach ($specialities as $s) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'departments','speciality_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; echo "<br/>"; $news = News::model()->findAll(); $sqlsm = ""; $sqlm = ""; $i = 229; foreach ($news as $s) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'news','news_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_title');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'news','news_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; echo "<br/>"; $doctors = Doctor::model()->findAll(); $sqlsm = ""; $sqlm = ""; $i = 406; foreach ($doctors as $s) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_specialty');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->specialism, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_fellowship');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->fellowship, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_interests');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->interests, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; echo "<br/>"; $sqlm = ""; $con = mysqli_connect("166.63.0.204", "webcont_dba", "lN_Q*PR]FN[E", "webcont_hm"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con, "SELECT id_mdc, especialidad_mdc, fellowship_mdc, intereses_mdc FROM medicos"); $j = 406; while ($row = mysqli_fetch_array($result)) { $sqlm .= "update `Message` set translation='" . $row['fellowship_mdc'] . "' where id=" . $j++ . " and language='en';<br>"; $sqlm .= "update `Message` set translation='" . $row['especialidad_mdc'] . "' where id=" . $j++ . " and language='en';<br>"; $sqlm .= "update `Message` set translation='" . $row['intereses_mdc'] . "' where id=" . $j++ . " and language='en';<br>"; } mysqli_close($con); echo $sqlm; echo "<br/>"; $firstaids = FirstAid::model()->findAll(); $sqlsm = ""; $sqlm = ""; $i = 1263; foreach ($firstaids as $s) { $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'firstaid','" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_title');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'firstaid','" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>"; $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>"; $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>"; } echo $sqlsm; echo $sqlm; }
public static function generateModulesList($course=1){ $modules = Module::model()->findAllByAttributes(array('course' => $course)); $count = count($modules); $result = []; for($i = 0; $i < $count; $i++){ $result[$i]['id'] = $modules[$i]->module_ID; $result[$i]['alias'] = $modules[$i]->module_name; } return $result; }
public function actionModulesDataTable() { // Regenerate the module config file $this->api('Xpress.Settings.generateModuleConfig'); // Detect modules in the code base, find new modules $detectedModules = $this->api('Xpress.Settings.detectModules'); $modules = Module::model()->findAll(new CDbCriteria(array('index' => 'name'))); $newModules = array(); foreach ($detectedModules as $id => $path) { if (!isset($modules[$id])) { if ($id != 'Install') { include_once Yii::getPathOfAlias($path) . ".php"; $new = new Module(); $new->id = $id; $class = $id . 'Module'; $class = new $class($id, null); try { $new->attributes = $class->MetaData; } catch (Exception $ex) { $new->name = $new->friendly_name = $id; } $newModules[] = $new; } } } // Installed modules $model = new Module('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Module'])) { $model->attributes = $_GET['Module']; } $data = CMap::mergeArray($model->search()->getData(), $newModules); // foreach($model->search()->getData() as $model) { // $data[] = array( // $model->name, // $model->description, // 'Permission', // $model->version, // $model->enabled, // true // ); // } echo CJSON::encode(array('data' => $data)); }
public function addNewModule($idCourse, $newModuleName, $lang){ $module = new Module(); $module->course = $idCourse; $order = Module::model()->count("course=$idCourse and `order`>0"); $module->order = ++$order; $module->alias = 'module'.$order; $module->language = $lang; //$teacher = Teacher::model()->find('user_id=:user', array(':user' => Yii::app()->user->getId()))->teacher_id; $module->module_name = $newModuleName; //var_dump($newModuleName);die(); if($module->validate()) { $module->save(); } return $order; }
public function actionShowModules(){ $first = '<select name="module" onchange="javascript:selectLecture();">'; $criteria = new CDbCriteria(); $criteria->select = 'module_ID, module_name'; $criteria->order = '`order` ASC'; $criteria->addCondition('course='.$_POST['course']); $rows = Module::model()->findAll($criteria); $result = $first.'<option value="">Всі модулі</option> <optgroup label="Виберіть модуль">'; foreach ($rows as $numRow => $row) { $result = $result.'<option value="'.$row['module_ID'].'">'.$row['module_name'].'</option>'; }; $last = '</select>'; echo $result.$last; }
return TRUE; } else { return FALSE; } } $userLevel = Yii::app()->user->level_id; $modules = Module::model()->findAll("parent_id = '0' ORDER BY `order` ASC"); $ctrl = Yii::app()->controller->id; $act = Yii::app()->controller->action->id; foreach ($modules as $m) { if (isAda($userLevel, $m->id)) { if ($ctrl == $m->controller) { echo '<li class="active"><a class="accordion-toggle" href="' . Yii::app()->request->baseUrl . "/" . $m->controller . '">' . '<span class="' . $m->icon . '"></span> ' . '<span class="sidebar-title">' . $m->name . '</span></a>'; echo "</li>"; } else { $child = Module::model()->findAll("parent_id = '" . $m->id . "' ORDER BY `order` ASC"); echo '<li>'; $parent = ""; if (count($child) == 0) { $parent = '<a class="" href="' . Yii::app()->request->baseUrl . "/" . $m->controller . "/" . $m->action . '"> <span class="' . $m->icon . '"></span> <span class="sidebar-title">' . $m->name . '</span> </a>'; echo '<li ' . ($ctrl == $m->controller ? "class='active'" : "") . '>' . $parent; } else { $strChild = ""; $ada = FALSE; foreach ($child as $c) { if (isAda($userLevel, $c->id)) { if ($ctrl == $c->controller) { $ada = TRUE;
echo $form->labelEx($model, 'url'); ?> <?php echo $form->textField($model, 'url', array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'url'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'p_id'); ?> <?php echo $form->dropDownList($model, 'p_id', array('0' => 'Parent') + CHtml::listData(Module::model()->getParents()->findAll(), 'id', 'name'), NULL); ?> <?php echo $form->error($model, 'p_id'); ?> </div> </td> <td style="width: 50%; vertical-align: top;"> <div class="row" id="input_privilages"> <?php echo $form->labelEx($model, 'hasPrivilage'); ?> <?php printCheckboxList($userLevel, 0, 'privilages[]', $preCheckedArray); ?> <?php
public function getIcon() { $controller = Yii::app()->controller->id; $data = Module::model()->findByAttributes(array("controller" => $controller)); return "<i class='" . $data->icon . "'></i>"; }
/** * Inactive module * * @return XException */ public function deactivate() { $module = Module::model()->find('name=:name', array(':name' => $this->getName())); if (is_object($module)) { //Deactive module in db $module->enabled = false; if (!$module->save()) { return errorHandler()->getException(); } //Call clear cache service Application::api('Xpress.Cache.clearCache'); //Update module file for current workflow Application::api('Xpress.Settings.generateModuleConfig'); } }