function creatModule($ext_id) { $obj_extension = YiiExtensions::getInstance(); $obj_ext = $obj_extension->loadExt($ext_id); $obj_module = YiiModule::getInstance(); $obj_row = $obj_module->loadItem(0); $obj_row->title = $obj_ext->title; $obj_row->alias = $obj_ext->alias; $obj_row->module = $obj_ext->name; $obj_row->status = 0; $obj_row->store(); return $obj_row->id; }
function deleteExt() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to modify extension"); $this->redirect(Router::buildLink("cpanel")); } $cid = Request::getVar('cid'); //$cid = 1; $obj_ext = YiiExtensions::getInstance(); $obj_tblExt = $obj_ext->loadExt($cid); if ($obj_tblExt->required == 1) { YiiMessage::raseNotice("System is require extention: {$obj_tblExt->name}"); $this->redirect(Router::buildLink("installer", array('view' => 'manager'))); } //neu ma app: kiem tra menu co dang su dung ext nay khong thi unpublish di if ($obj_tblExt->type == "app") { Yii::app()->db->createCommand()->update(TBL_MENU_ITEM, array('status' => 0), 'app = \'' . $obj_tblExt->folder . '\''); } //neu ma module: kiem tra co module nao duoc tao ra khong thi unpublish di if ($obj_tblExt->type == "module") { // $obj_module = YiiModule::getInstance(); // $items = $obj_module->loadItems(null, 'module = \''. $obj_tblExt->folder.'\''); Yii::app()->db->createCommand()->update(TBL_MODULES, array('status' => 0), 'module = \'' . $obj_tblExt->folder . '\''); } //neu ma theme: thi kiem tra xem co dang la theme default khong }
function getScope($fields = " title text, name value ") { $obj_ext = YiiExtensions::getInstance(); $list_scope = $obj_ext->loadApps($fields); return $list_scope; }