Ejemplo n.º 1
0
 public function actionSave()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify setting");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $post = Request::get();
     $db_info = $post['config']['database'];
     $connectionString = '\'mysql:dbname=' . $db_info['databasename'] . ';host=' . $db_info['hostname'] . '\'';
     $this->setConfig('main', 'connectionString', $connectionString, 'db', "\\s*\\,\\s*\\'errorHandler");
     $this->setConfig('main', 'username', '\'' . $db_info['username'] . '\'', 'db', "\\s*\\,\\s*\\'errorHandler");
     $this->setConfig('main', 'tablePrefix', '\'' . $db_info['prefix'] . '\'', 'db', "\\s*\\,\\s*\\'errorHandler");
     $this->setConfig('main', 'adminEmail', '\'' . $post['config']['main']['adminEmail'] . '\'', 'params');
     $this->setConfig('main', 'permission', '\'' . $post['config']['main']['permission'] . '\'', 'params');
     $this->setConfig('main', 'copyright', '\'' . $post['config']['main']['copyright'] . '\'', 'params');
     $this->writeConfig('main');
     $this->setConfig('backend', 'timeout', '\'' . $post['config']['backend']['sessionlifetime'] . '\'', 'params');
     $this->setConfig('backend', 'timeout2', '\'' . $post['config']['backend']['sessionlifetime2'] . '\'', 'params');
     $this->setConfig('backend', 'sessionName', 'md5("' . $post['config']['backend']['sessionname'] . '")', 'session');
     $this->writeConfig('backend');
     $this->setConfig('frontend', 'timeout', '\'' . $post['config']['site']['sessionlifetime'] . '\'', 'params');
     $this->setConfig('frontend', 'timeout2', '\'' . $post['config']['site']['sessionlifetime2'] . '\'', 'params');
     $this->setConfig('frontend', 'offlineMessage', '\'' . $post['config']['site']['offlinemessage'] . '\'', 'params');
     $this->setConfig('frontend', 'siteoffline', $post['config']['site']['offline'], 'params');
     $this->setConfig('frontend', 'sessionName', 'md5("' . $post['config']['site']['sessionname'] . '")', 'session');
     $this->setConfig('frontend', 'sef', '\'' . $post['config']['site']['sef'] . '\'', 'params');
     $this->setConfig('frontend', 'sef_suffix', '\'' . $post['config']['site']['sef_suffix'] . '\'', 'params');
     $this->setConfig('frontend', 'sef_urlsuffix', '\'' . $post['config']['site']['sef_urlsuffix'] . '\'', 'params');
     $this->writeConfig('frontend');
     YiiMessage::raseSuccess("Successfully saved changes config");
     //        $this->pageTitle = "Home page Display";
     $this->redirect(Router::buildLink("cpanel", array("view" => "sysconfig")));
 }
Ejemplo n.º 2
0
 function store()
 {
     global $mainframe, $db, $user;
     $post = $_POST;
     $arr_team_table = Request::getVar('arr_team_table', null);
     $arr_team_table = json_decode($arr_team_table, true);
     $model = Tournament::getInstance();
     global $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to change Tournament");
         $this->redirect(Router::buildLink("gamesport", array('view' => 'tournament')));
     }
     $tourID = Request::getVar('tourID', 0);
     $db = Yii::app()->db;
     foreach ($arr_team_table as $table_num => $team_tables) {
         if (count($team_tables)) {
             $stt = 1;
             foreach ($team_tables as $teamID => $team) {
                 if ($team == null) {
                     continue;
                 }
                 if ($team['ordering'] == null or $team['ordering'] == 0) {
                     $team['ordering'] = $stt;
                 }
                 $query = "UPDATE " . TBL_GS_TEAM_REGISTER_TOUR . " SET table_num = {$table_num}" . " ,ordering = " . $team['ordering'] . " ,mdate = now()" . " ,modified_by = {$user->id}" . " WHERE tourID = {$tourID} AND teamID = {$teamID}";
                 $command = $db->createCommand($query);
                 $command->execute();
                 $stt++;
             }
         }
     }
     return true;
 }
Ejemplo n.º 3
0
 public function actionDisplay()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to visit page");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $this->addBarTitle("Resource <small>[manager]</small>", "user");
     $this->render('default');
 }
Ejemplo n.º 4
0
 public function actionDisplay()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to visit page");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $this->addIconToolbar("New", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'new')), "new");
     $this->addIconToolbar("Edit", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'edit')), "edit", 1, 1, "Please select a item from the list to edit");
     $this->addIconToolbar("Publish", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'publish')), "publish");
     $this->addIconToolbar("Unpublish", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'unpublish')), "unpublish");
     $this->addIconToolbar("Delete", Router::buildLink("permission", array('view' => 'resource', 'layout' => 'remove')), "trash", 1, 1, "Please select a item from the list to Remove");
     $this->addBarTitle("Resource <small>[tree]</small>", "user");
     $model = Resource::getInstance();
     $items = $model->getItems();
     $this->render('default', array('items' => $items));
 }
Ejemplo n.º 5
0
 function store()
 {
     global $mainframe, $db, $user;
     $tourID = Request::getVar('tourID', 0);
     $post = $_POST;
     $model = Matches::getInstance();
     global $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to change Tournament");
         $this->redirect(Router::buildLink("gamesport", array('view' => 'tournament')));
     }
     $tourID = Request::getVar('tourID', 0);
     $db = Yii::app()->db;
     $matches_data_table = json_decode($post['matches_data_table']);
     $matches_make_first_data = $post['matches_make_first_data'];
     if ($matches_make_first_data == 1) {
         $model->make_matches($tourID, $matches_data_table);
     }
     return true;
 }
Ejemplo n.º 6
0
 function actionGrant()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to visit page");
         $this->redirect(Router::buildLink("cpanel"));
     }
     global $user;
     $cid = Request::getVar('cid', 0);
     $obj_user = YiiUser::getInstance();
     $obj_user = $obj_user->getUser($cid);
     $this->addBarTitle("Grant user <small>[{$obj_user->username}]</small>", "user");
     $this->addIconToolbar("Save", Router::buildLink("permission", array('view' => 'users', 'layout' => 'save')), "save");
     $this->addIconToolbar("Apply", Router::buildLink("permission", array('view' => 'users', 'layout' => 'apply')), "apply");
     $this->addIconToolbar("Close", Router::buildLink("permission", array('view' => 'users', 'layout' => 'cancel')), "cancel");
     $this->pageTitle = "Edit grant";
     $model_resource = Resource::getInstance();
     $model = Users::getInstance();
     $items = $model_resource->getItems();
     $all_granted = $model->getGranted();
     $lists = $model->getListGrant();
     $this->render('grant', array("items" => $items, "all_granted" => $all_granted, "lists" => $lists));
 }
Ejemplo n.º 7
0
 static function checking()
 {
     global $user, $mainframe;
     if ($user->isSuperAdmin()) {
         return true;
     }
     $backEnd = $mainframe->isBackEnd();
     $string_url = CheckPerMission::get_fullurl();
     $arr_url = CheckPerMission::get_arr_url();
     $arr_resource = CheckPerMission::getResources($backEnd, $arr_url);
     $query_user = "******" . TBL_RSM_RESOURCE_XREF . " WHERE object_type = 1 AND objectID = {$user->id}";
     $query_group = "SELECT * FROM " . TBL_RSM_RESOURCE_XREF . " WHERE object_type = 2 AND objectID = {$user->groupID}";
     $arr_granted = CheckPerMission::getGranted($user->id, 1);
     $arr_Ggranted = CheckPerMission::getGranted($user->groupID, 2);
     $table_ext = YiiTables::getInstance(TBL_EXTENSIONS);
     $ext_default_1 = $table_ext->loadColumn("name", "allowall = 1 ");
     if (count($arr_resource)) {
         // step 1: check allow user
         // neu co cho phep thi return true
         // neu khong thay noi gi thi sang s2
         foreach ($arr_resource as $resource) {
             if (in_array($resource->id, $arr_granted['allow'])) {
                 return true;
             }
         }
         // step 2: check deny user
         // neu co bi cam thi redirect
         // neu khong thay noi gi thi sang s3
         foreach ($arr_resource as $resource) {
             if (in_array($resource->id, $arr_granted['deny'])) {
                 YiiMessage::raseNotice($resource->redirect_msg);
                 Yii::app()->getRequest()->redirect($resource->redirect_url);
                 return true;
             }
         }
         // step 3: check allow group
         // neu co cho phep thi return true
         // neu khong thay noi gi thi sang s4
         foreach ($arr_resource as $resource) {
             if (in_array($resource->app, $arr_Ggranted)) {
                 return true;
             }
         }
     }
     // kiem tra mac dinh
     $cur_app = Request::getVar('app');
     if (in_array($cur_app, $ext_default_1)) {
         // neu app hien tai nam trong so app duoc phep thi return true
         return true;
     } else {
         // khong duoc truy cap
         if ($mainframe->isBackEnd()) {
             YiiMessage::raseNotice("Your account not have permissin to visit page");
             if ($cur_app == "cpanel") {
                 // ra trang chu froent-end
                 Yii::app()->getRequest()->redirect("/");
             } else {
                 Yii::app()->getRequest()->redirect("?app=cpanel");
             }
         } else {
             return true;
         }
     }
 }
Ejemplo n.º 8
0
 function changeStatus($cid, $value)
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify module");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $obj_module = YiiModule::getInstance();
     $obj_row = $obj_module->loadItem($cid);
     $obj_row->status = $value;
     $obj_row->store();
 }
Ejemplo n.º 9
0
 function registration($data_post)
 {
     $tbl_user = YiiTables::getInstance(TBL_USERS, null, true);
     $cond = "mobile = '" . $data_post['mobile'] . "'";
     $bool = $tbl_user->getTotal($cond);
     if ($bool) {
         YiiMessage::raseNotice("Your telephone number is already registered");
         return false;
     }
     $cond = " username =  '******'username'] . "'";
     $bool = $tbl_user->getTotal($cond);
     if ($bool) {
         YiiMessage::raseNotice("username is already registered");
         return false;
     }
     $data_post['password'] = md5($data_post['password']);
     $tbl_user->bind($data_post);
     $tbl_user->store();
     $this->setLogin($tbl_user->id);
 }
Ejemplo n.º 10
0
 public function storeItem()
 {
     global $mainframe, $user;
     $cid = Request::getVar("id", 0);
     $obj_table = YiiArticle::getInstance();
     $obj_table = $obj_table->loadItem($cid);
     $obj_table->bind($_POST);
     if ($obj_table->id == 0) {
         $obj_table->created_by = $user->id;
     } else {
         // check quyen so huu
         global $user;
         if (!($bool = $user->modifyChecking($obj_table->created_by))) {
             $obj_users = YiiUser::getInstance();
             $item_user = $obj_users->getUser($obj_table->created_by);
             YiiMessage::raseNotice("Your account not have permission to modify resource of: {$item_user->username}");
             $this->redirect(Router::buildLink("articles"));
             return false;
         }
     }
     $obj_table->modified_by = $user->id;
     $obj_table->store();
     YiiMessage::raseSuccess("Successfully save Article");
     return $obj_table->id;
 }
Ejemplo n.º 11
0
 function changepass()
 {
     global $mainframe;
     $user = $mainframe->getUser();
     $db = $this->db;
     $password = Request::getVar("password");
     $newpassword = Request::getVar("new-password");
     $renewpassword = Request::getVar("renew-password");
     if ($password != "") {
         if (md5($password) != $user->password) {
             YiiMessage::raseNotice('Type old password !!!');
             return FALSE;
         }
     }
     if ($newpassword == "") {
         YiiMessage::raseNotice('Type new password !!!');
         return FALSE;
     }
     if ($newpassword !== $renewpassword) {
         YiiMessage::raseNotice('Type verifi password !!!');
         return FALSE;
     }
     $tbl_user = YiiTables::getInstance(TBL_USERS, null, true);
     $tbl_user->load($user->id);
     $tbl_user->password = md5($newpassword);
     $tbl_user->store();
     return true;
 }
Ejemplo n.º 12
0
 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
 }
Ejemplo n.º 13
0
 function actionRemove()
 {
     global $user;
     $cids = Request::getVar("cid", 0);
     $obj_table = YiiTables::getInstance(TBL_VIDEOS);
     if (count($cids) > 0) {
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             $obj_table->load($cid);
             if (!($bool = $user->modifyChecking($obj_table->created_by))) {
                 $obj_users = YiiUser::getInstance();
                 $item_user = $obj_users->getUser($obj_table->created_by);
                 YiiMessage::raseNotice("Your account not have permission to delete video: {$obj_table->title}");
                 $this->redirect(Router::buildLink("videos"));
                 return false;
             }
             //check item first
             $obj_table->remove($cid);
         }
     }
     YiiMessage::raseSuccess("Successfully remove Video(s)");
     $this->redirect(Router::buildLink("videos"));
 }
Ejemplo n.º 14
0
 function actionRemove()
 {
     global $user;
     $model = new Group();
     $mode_user = new Users();
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to add/edit group");
         $this->redirect(Router::buildLink("users", array('view' => 'group')));
     }
     $cids = Request::getVar("cid", 0);
     if (count($cids) > 0) {
         $obj_table = YiiUser::getInstance();
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             $list_user = $mode_user->getUsers($cid, null, true);
             $list_group = $model->getItems($cid);
             if (empty($list_user) and empty($list_group)) {
                 $obj_table->removeGroup($cid);
             } else {
                 YiiMessage::raseNotice("Group user have something account/sub group");
                 $this->redirect(Router::buildLink("users", array('view' => 'group')));
                 return false;
             }
         }
     }
     YiiMessage::raseSuccess("Successfully delete GroupUser(s)");
     $this->redirect(Router::buildLink("users", array("view" => "group")));
 }
Ejemplo n.º 15
0
 function actionRemove()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to remove menu item");
         $this->redirect(Router::buildLink("menus", array("view" => 'menutype')));
     }
     $menuID = Request::getInt('menu', "");
     $cids = Request::getVar("cid", 0);
     $table_menu = YiiTables::getInstance(TBL_MENU_ITEM);
     if (count($cids) > 0) {
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             //check item first
             $table_menu->remove($cid);
         }
     }
     YiiMessage::raseSuccess("Successfully remove Menuitem(s)");
     $this->redirect(Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID)));
 }
Ejemplo n.º 16
0
 function actionTree()
 {
     global $user;
     $tmpl = Request::getVar('tmpl', null);
     $modelUser = new Users();
     $modelGroup = new Group();
     $this->addBarTitle("Users <small>[tree]</small>", "user");
     $groupID = Request::getVar('groupID', $user->groupID);
     $group = $modelGroup->getItem($user->groupID);
     if ($group->parentID != 1) {
         if (!$user->groupChecking($groupID)) {
             $group = $modelGroup->getItem($user->groupID);
             YiiMessage::raseNotice("Your account not have permission to visit page");
             $this->redirect(Router::buildLink("cpanel"));
         }
     }
     $group = $modelGroup->getItem($groupID);
     $list_user = $modelUser->getUsers($groupID, " leader DESC, id ASC ");
     $arr_group = $modelUser->getGroups($groupID);
     if ($tmpl == null) {
         $this->render('tree', array("objGroup" => $group, "list_user" => $list_user, 'arr_group' => $arr_group));
     } else {
         if ($tmpl == 'app') {
             $this->render('treegroup', array("objGroup" => $group, "list_user" => $list_user, 'arr_group' => $arr_group));
             die;
         }
     }
 }
Ejemplo n.º 17
0
 /**
  * Function progress get team by tour ID
  */
 function actionList($id = 2)
 {
     $id = Request::getVar("tour_id", $id);
     $model = Teams::getInstance();
     global $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to add/edit Team");
         $this->redirect(Router::buildLink("gamesport", array('view' => 'teams')));
     }
     $items = $model->ListTeam($id);
     echo json_encode($items);
 }
Ejemplo n.º 18
0
 public function actionChangepass()
 {
     global $mainframe, $user;
     if (!$mainframe->isLogin()) {
         YiiMessage::raseNotice('Please login before change password !!!');
         $this->redirect(Router::buildLink('user', array('layout' => 'login')));
     }
     if (isset($_POST['submitform'])) {
         $model = User::getInstance();
         if ($model->changepass()) {
             YiiMessage::raseSuccess('Change pass successfully !!!');
             $this->redirect(Router::buildLink('user'));
         }
     }
     $this->render('changepass');
 }
Ejemplo n.º 19
0
 public function actionUploadext()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to install extension");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $pack_install = $_FILES['install_package'];
     if ($pack_install == null or $pack_install['error'] != 0) {
         YiiMessage::raseWarning("Unable to find install package");
         $this->redirect(Router::buildLink("installer"));
     }
     // $YiiFile = new YiiFile;
     $path_file_pach_install = PATH_TMP . $pack_install['name'];
     YiiFile::upload($pack_install['tmp_name'], $path_file_pach_install);
     $file_info = pathinfo($path_file_pach_install);
     if (strtolower($file_info['extension']) != "zip") {
         YiiMessage::raseWarning("Invalid extension install package");
         YiiFile::delete($path_file_pach_install);
         $this->redirect(Router::buildLink("installer"));
     }
     $filename = $file_info['filename'];
     $zip = new ZipArchive();
     $res = $zip->open($path_file_pach_install);
     $path_extact = PATH_TMP . $filename;
     if ($res === TRUE) {
         $zip->extractTo($path_extact);
         $zip->close();
     } else {
         YiiMessage::raseWarning("Invalid extract file install package");
         YiiFile::delete($path_file_pach_install);
         $this->redirect(Router::buildLink("installer"));
     }
     $files_xml = YiiFolder::files($path_extact, "\\.xml", 1, true);
     if (count($files_xml) == 0) {
         YiiFile::delete($path_file_pach_install);
         YiiFolder::delete($path_extact);
         YiiMessage::raseWarning("Invalid extension install package");
         $this->redirect(Router::buildLink("installer"));
     }
     $xml = null;
     foreach ($files_xml as $file_xml) {
         $xml = simplexml_load_file($file_xml);
         if (!$xml) {
             unset($xml);
             continue;
         }
         if ($xml->getName() != 'extension') {
             unset($xml);
             continue;
         }
         $type = (string) $xml->attributes()->type;
         if (!in_array($type, array("app", "module"))) {
             unset($xml);
             continue;
         }
     }
     $type = (string) $xml->attributes()->type;
     $row_ext = YiiTables::getInstance(TBL_EXTENSIONS);
     $arr_info = array();
     $arr_info['title'] = (string) $xml->title;
     $arr_info['name'] = (string) $xml->name;
     $arr_info['alias'] = $this->convertalias($arr_info['title']);
     $arr_info['author'] = (string) $xml->author;
     $arr_info['version'] = (string) $xml->version;
     $arr_info['creationDate'] = (string) $xml->creationDate;
     $arr_info['description'] = (string) $xml->description;
     $arr_info['type'] = (string) $xml->attributes()->type;
     $arr_info['folder'] = trim(preg_replace('/[^\\w\\d]+/is', '', $row_ext->title));
     $arr_info['client'] = (string) $xml->attributes()->client;
     if ($arr_info['client'] == "") {
         $arr_info['client'] = 1;
     }
     $row_ext->loadRow("*", "title = '" . $arr_info['title'] . "' OR alias = '" . $arr_info['alias'] . "'");
     $ext_new = false;
     if ($row_ext->id == 0) {
         $row_ext->cdate = date("Y-m-d H:i:s");
         $ext_new = true;
     }
     $row_ext->mdate = date("Y-m-d H:i:s");
     $row_ext->bind($arr_info);
     $path_ext = PATH_MODULES . $row_ext->folder;
     if ($row_ext->type == "app" and $row_ext->client == 1) {
         $path_ext = PATH_APPS_FRONT . $row_ext->folder;
     } else {
         if ($row_ext->type == "app" and $row_ext->client == 0) {
             $path_ext = PATH_APPS_BACKEND . $row_ext->folder;
         }
     }
     if (!YiiFolder::create($path_ext, 0775)) {
         YiiMessage::raseWarning("FILESYSTEM ERROR Could not create directory");
         YiiFile::delete($path_file_pach_install);
         YiiFolder::delete($path_extact);
         $this->redirect(Router::buildLink("installer"));
     }
     $bool = YiiFolder::copy($path_extact, $path_ext, '', 1);
     if ($row_ext->type == "module" and $ext_new == true) {
         $row_module = YiiTables::getInstance(TBL_MODULES);
         $row_module->title = $row_ext->title;
         $row_module->alias = $row_ext->alias;
         $row_module->cdate = date("Y-m-d H:i:s");
         $row_module->mdate = date("Y-m-d H:i:s");
         $row_module->module = $row_ext->folder;
         $row_module->status = 0;
         $row_module->store();
     }
     YiiFile::delete($path_file_pach_install);
     YiiFolder::delete($path_extact);
     $this->redirect(Router::buildLink("installer"), "Succesfully install package");
 }
Ejemplo n.º 20
0
 function actionRemove()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission remove location");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $cids = Request::getVar("cid", 0);
     if (count($cids) > 0) {
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             //check item first
             $item = $this->removeItem($cid);
         }
     }
     YiiMessage::raseSuccess("Successfully remove location(s)");
     $this->redirect(Router::buildLink('locations'));
 }
Ejemplo n.º 21
0
 function removeItem($cids)
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify module");
         return false;
     }
     if (!is_array($cids)) {
         $cids = array($cids);
     }
     foreach ($cids as $cid) {
         $obj_module = YiiModule::getInstance();
         $obj_row = $obj_module->loadItem($cid);
         $obj_row->remove();
         $query = "DELETE FROM " . TBL_MODULE_MENUITEM_REF . " WHERE moduleID = {$obj_row->id} ";
         Yii::app()->db->createCommand($query)->query();
     }
     return true;
 }
Ejemplo n.º 22
0
 function copyitem($cid)
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify menu item");
         return false;
     }
     $obj_item = YiiCategory::getInstance();
     $obj_item = $obj_item->loadItem($cid, "*", false);
     $obj_item->id = 0;
     $obj_item->name = $obj_item->name . " copy";
     $obj_item->alias = $obj_item->alias . "-copy";
     $obj_item->status = 0;
     $obj_item->store();
     return $obj_item->id;
 }
Ejemplo n.º 23
0
 function actionRemove()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission remove category");
         $this->redirect(Router::buildLink("categories"));
     }
     $cids = Request::getVar("cid", 0);
     if (count($cids) > 0) {
         $obj_table = YiiTables::getInstance(TBL_CATEGORIES);
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             $obj_table->remove($cid);
         }
     }
     YiiMessage::raseSuccess("Successfully delete GroupUser(s)");
     $this->redirect(Router::buildLink("categories"));
 }
Ejemplo n.º 24
0
 function changeFeature($cid, $value)
 {
     $obj_table = YiiArticle::getInstance();
     $obj_table = $obj_table->loadItem($cid);
     // check quyen so huu
     global $user;
     if (!($bool = $user->modifyChecking($obj_table->created_by))) {
         $obj_users = YiiUser::getInstance();
         $item_user = $obj_users->getUser($obj_table->created_by);
         YiiMessage::raseNotice("Your account not have permission to modify resource of: {$item_user->username}");
         $this->redirect(Router::buildLink("articles"));
         return false;
     }
     $obj_table->feature = $value;
     $obj_table->store();
 }
Ejemplo n.º 25
0
 function copyitem($cid)
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify menu item");
         return false;
     }
     $obj_menu = YiiMenu::getInstance();
     $tbl_menu = $obj_menu->loadItem($cid);
     $tbl_menu->id = 0;
     $tbl_menu->title = $tbl_menu->title . " copy";
     $tbl_menu->alias = $tbl_menu->alias . "-copy";
     $tbl_menu->status = 0;
     $tbl_menu->_ordering = $tbl_menu->ordering;
     $tbl_menu->_old_parent = $tbl_menu->parentID;
     $tbl_menu->store();
     return array($tbl_menu->menuID, $tbl_menu->id);
 }
Ejemplo n.º 26
0
 function changeStatus($cid, $value)
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify menu");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $obj_menu = YiiMenu::getInstance();
     $obj_tblMenu = $obj_menu->loadMenu($cid, "*", false);
     $obj_tblMenu->status = $value;
     $obj_tblMenu->store();
 }