Пример #1
0
 /**
  * 批量操作
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($this->_gets->getParam('command'));
         $ids = intval($this->_gets->getParam('id'));
     } elseif (XUtils::method() == 'POST') {
         $command = $this->_gets->getPost('command');
         $ids = $this->_gets->getPost('id');
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         throw new CHttpException(404, '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'attachDelete':
             parent::_acl('attach_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除附件,ID:' . $ids));
             //日志
             parent::_delete(new Upload(), $ids, array('attach'), array('file_name'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
Пример #2
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $_POST['id'];
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'delete':
             parent::_acl('user_delete');
             $cityModel = new User();
             $cityModel->deleteAll('id IN(' . $ids . ')');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除会员,ID:' . $ids));
             parent::_delete(new User(), $ids, array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
 public function actionOwnerUpdate()
 {
     try {
         $model = parent::_dataLoad(new StAdmin(), $this->_admini['userId']);
         //首先从session中获取登录是的id号(yii框架自带)
         $data = StAdmin::model()->findByPk($this->_admini['userId']);
         //查询该用户并对该用户的密码进行更新
         if (XUtils::method() == 'POST') {
             $id = $data['id'];
             $name = $data['name'];
             $password = $_POST['password'];
             $count = StAdmin::model()->updateByPk($id, array('name' => $name, 'password' => $password));
             if ($count > 0) {
                 AdminLogger::_create(array('catalog' => 'update', 'intro' => '修改密码:' . CHtml::encode($data['name'])));
                 //日志
                 XUtils::message('success', '修改完成', $this->createUrl('adminLogin/index'));
             } else {
                 XUtils::message('fail', '修改失败', $this->createUrl('adminLogin/ownerUpdate'));
             }
         }
         $this->render('ownerUpdate', array('data' => $data));
     } catch (Exception $e) {
         echo var_dump($e);
     }
 }
Пример #4
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl('sms_update');
     $model = parent::_dataLoad(new Sms(), $id);
     if (isset($_POST['Sms'])) {
         $model->attributes = $_POST['Sms'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '短信验证设置,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Пример #5
0
 public function actionEvaluateHandle()
 {
     if (parent::_ajax_acl('evaluate_update')) {
         $id = Yii::app()->request->getPost('id');
         $evaluate = Evaluate::model()->findByPk($id);
         if (!empty($evaluate)) {
             $evaluate->status = 1;
             if ($evaluate->save()) {
                 AdminLogger::_create(array('catalog' => 'update', 'intro' => '更新评估处理状态,ID:' . $evaluate->id));
                 echo CJSON::encode(array('success' => true, 'msg' => '需求处理成功'));
             } else {
                 echo CJSON::encode(array('success' => false, 'msg' => '操作失败,请联系管理员'));
             }
         } else {
             echo CJSON::encode(array('success' => false, 'msg' => '此评估不存在'));
         }
     } else {
         echo CJSON::encode(array('success' => false, 'msg' => '当前角色组无权限进行此操作,请联系管理员授权'));
     }
 }
Пример #6
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } else {
         if (XUtils::method() == 'POST') {
             $command = trim($_POST['command']);
             $ids = $_POST['id'];
             is_array($ids) && ($ids = implode(',', $ids));
         } else {
             XUtils::message('errorBack', '只支持POST,GET数据');
         }
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'linkDelete':
             parent::_acl('link_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除链接,ID:' . $ids));
             parent::_delete(new Link(), $ids, array('link'), array('attach_file'));
             break;
         case 'adDelete':
             parent::_acl('ad_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除广告,ID:' . $ids));
             parent::_delete(new Ad(), $ids, array('ad'), array('attach_file'));
             break;
         case 'linkVerify':
             parent::_acl('link_verify');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '链接状态变更为显示,ID:' . $ids));
             parent::_verify(new Link(), 'verify', $ids, array('link'));
             break;
         case 'linkUnVerify':
             parent::_acl('link_verify');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '链接状态变更为隐藏,ID:' . $ids));
             parent::_verify(new Link(), 'unVerify', $ids, array('link'));
             break;
         case 'adVerify':
             parent::_acl('ad_verify');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '广告状态变更为显示,ID:' . $ids));
             parent::_verify(new Ad(), 'verify', $ids, array('ad'));
             break;
         case 'adUnVerify':
             parent::_acl('ad_verify');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '广告状态变更为隐藏,ID:' . $ids));
             parent::_verify(new Ad(), 'unVerify', $ids, array('ad'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
Пример #7
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $this->_gets->getPost('id');
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'adminDelete':
             parent::_acl('admin_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除管理员,ID:' . $ids));
             parent::_delete(new Admin(), $ids, array('index'));
             break;
         case 'groupDelete':
             parent::_acl('admin_group_delete');
             parent::_groupPrivate($ids);
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除管理员用户组,ID:' . $ids));
             parent::_delete(new AdminGroup(), $ids, array('group'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
Пример #8
0
 /**
  * 批处理
  */
 public function actionOperate()
 {
     $command = trim($this->_gets->getParam('command'));
     switch ($command) {
         case 'deleteFile':
             parent::_acl('database_delete');
             $filenames = $this->_gets->getParam('sqlfile');
             if ($filenames) {
                 if (is_array($filenames)) {
                     foreach ($filenames as $filename) {
                         if (CFileHelper::getExtension($filename) == 'sql') {
                             @unlink($this->_bakupPath . $filename);
                         }
                     }
                     XUtils::message('success', '删除完成', $this->createUrl('database/import'));
                 } else {
                     if (CFileHelper::getExtension($filenames) == 'sql') {
                         @unlink($this->_bakupPath . $filename);
                         XUtils::message('success', '删除完成', $this->createUrl('database/import'));
                     }
                 }
             } else {
                 XUtils::message('error', '请选择要删除的文件', $this->createUrl('database/import'));
             }
             break;
         case 'downloadFile':
             parent::_acl('database_download');
             $sqlfile = $this->_gets->getParam('sqlfile');
             XHttp::download($this->_bakupPath . $sqlfile, '', '', 3600);
             break;
         default:
             throw new CHttpException(404, '未找到操作');
             break;
     }
 }
Пример #9
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     $command = trim($this->_gets->getParam('command'));
     switch ($command) {
         case 'deleteFile':
             parent::_acl('template_delete');
             $fileName = trim($this->_gets->getParam('fileName'));
             empty($fileName) && XUtils::message('error', '未选择记录');
             $filePath = $this->_themePath . DS . 'views' . DS . XUtils::b64decode($fileName);
             @unlink($filePath);
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除模板:' . XUtils::b64decode($fileName)));
             $this->redirect(array('index'));
             break;
         case 'deleteFolder':
             parent::_acl('template_folder_delete');
             $folderName = trim($this->_gets->getParam('folderName'));
             empty($folderName) && XUtils::message('error', '未选择记录');
             $folderPath = $this->_themePath . DS . 'views' . DS . $folderName;
             if (is_dir($folderPath)) {
                 $fileList = XUtils::getFile($folderPath);
                 foreach ((array) $fileList as $row) {
                     @unlink($folderPath . DS . $row);
                 }
             }
             if (rmdir($folderPath)) {
                 AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除文件夹:' . $folderName));
                 XUtils::message('success', '目录 ' . $folderName . ' 删除完成', $this->createUrl('index'));
             } else {
                 XUtils::message('errorBack', '目录删除失败,请删除此目录下所有文件再删除此目录');
             }
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
Пример #10
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $_POST['id'];
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'delete':
             parent::_acl('post_delete');
             Post2tags::xdelete($ids);
             $commentModel = new PostComment();
             $commentModel->deleteAll('post_id IN(' . $ids . ')');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除内容,ID:' . $ids));
             parent::_delete(new Post(), $ids, array('index'), array('attach_file', 'attach_thumb'));
             break;
         case 'commentDelete':
             parent::_acl('post_comment_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除内容评论,ID:' . $ids));
             parent::_delete(new PostComment(), $ids, array('comment'));
             break;
         case 'commentVerify':
             parent::_acl('post_comment_verify');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '审核评论,ID:' . $ids));
             parent::_verify(new PostComment(), 'verify', $ids, array('comment'));
             break;
         case 'commentUnVerify':
             parent::_acl('post_comment_verify');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '取消评论审核,ID:' . $ids));
             parent::_verify(new PostComment(), 'unVerify', $ids, array('comment'));
             break;
         case 'verify':
             parent::_acl('post_verify');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '批量审核内容,ID:' . $ids));
             parent::_verify(new Post(), 'verify', $ids, array('index'));
             break;
         case 'unVerify':
             parent::_acl('post_verify');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '批量取消内容审核,ID:' . $ids));
             parent::_verify(new Post(), 'unVerify', $ids, array('index'));
             break;
         case 'commend':
             parent::_acl('post_commend');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '批量推荐内容,ID:' . $ids));
             parent::_commend(new Post(), 'commend', $ids, array('index'));
             break;
         case 'unCommend':
             parent::_acl('post_commend');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '批量取消内容推荐,ID:' . $ids));
             parent::_commend(new Post(), 'unCommend', $ids, array('index'));
             break;
         case 'specialDelete':
             parent::_acl('post_special_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除内容,ID:' . $ids));
             parent::_delete(new Special(), $ids, array('special'), array('attach_file', 'attach_thumb'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
 public function actionCourseQuery()
 {
     $model = parent::_dataLoad(new StAdmin(), $this->_admini['userId']);
     $teacherId = $model->id;
     // echo var_dump($model);
     try {
         $sql = "SELECT * FROM st_course,st_teacher WHERE st_teacher.teacherId ='{$teacherId}' AND st_course.teacherId=st_teacher.teacherId";
         if (XUtils::method() == 'POST') {
             // 查询按钮
             if (isset($_POST['subQuery'])) {
                 // 判断条件
                 if ($_POST['ByCourseId'] != "课程编号") {
                     $sql = $sql . " AND st_course.courseId ='" . $_POST['ByCourseId'] . "'";
                 }
                 if ($_POST['ByCourseName'] != "课程名称") {
                     $name = "'%" . $_POST['ByCourseName'] . "%'";
                     $sql = $sql . " AND st_course.courseName LIKE " . $name . "";
                 }
             }
         }
         // echo var_dump($sql);
         //分页获取
         $result = Yii::app()->db->createCommand($sql)->queryAll();
         $count = count($result);
         $pages = new CPagination($count);
         $pages->pageSize = PAGESIZE;
         $pdata = Yii::app()->db->createCommand($sql . " LIMIT :offset,:limit");
         $pdata->bindValue(':offset', $pages->currentPage * $pages->pageSize);
         $pdata->bindValue(':limit', $pages->pageSize);
         $data = $pdata->queryAll();
         $data = json_decode(CJSON::encode($data), TRUE);
         is_array($data) ? null : ($data = array());
         // 防止空数组
         $this->render('courseQuery', array('data' => $data, 'pages' => $pages));
     } catch (Exception $e) {
         echo var_dump($e);
     }
 }
 public function actionApplyQuery()
 {
     $model = parent::_dataLoad(new StAdmin(), $this->_admini['userId']);
     $stuId = $model->id;
     try {
         $sql = "SELECT * FROM st_apply,st_class_time,st_course WHERE st_apply.stuId ='{$stuId}' AND st_course.courseId=st_class_time.courseId AND st_class_time.classTimeId=st_apply.classTimeId";
         if (XUtils::method() == 'POST') {
             // 查询按钮
             if (isset($_POST['subQuery'])) {
                 // 判断条件
                 if ($_POST['ByState'] != "3") {
                     $sql = $sql . " AND st_apply.state ='" . $_POST['ByState'] . "'";
                 }
                 if ($_POST['ByCourseName'] != "课程名称") {
                     $sql = $sql . " AND st_course.courseName = '" . $_POST['ByCourseName'] . "'";
                 }
                 if ($_POST['ByCourseId'] != "课程编号") {
                     $sql = $sql . " AND st_course.courseId = '" . $_POST['ByCourseId'] . "'";
                 }
             }
         }
         // echo var_dump($sql);
         $data = Yii::app()->db->createCommand($sql)->queryAll();
         $data = json_decode(CJSON::encode($data), TRUE);
         is_array($data) ? null : ($data = array());
         // 防止空数组
         // echo var_dump($data);
         $this->render('applyQuery', array('data' => $data));
     } catch (Exception $e) {
         echo var_dump($e);
     }
 }
Пример #13
0
 /**
  * 附件设置
  */
 public function actionUpload()
 {
     parent::_acl();
     self::_updateData($_POST['Config'], 'base');
     $this->render('upload', array('config' => self::loadData()));
 }
Пример #14
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $_POST['id'];
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'delete':
             parent::_acl('house_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除房源,ID:' . $ids));
             parent::_delete(new House(), $ids, array('index'));
             break;
         case 'commend':
             parent::_acl('house_recommend');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '批量推荐房源,ID:' . $ids));
             parent::_recommend(new House(), 'recommend', $ids, array('index'));
             break;
         case 'unCommend':
             parent::_acl('house_recommend');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '批量取消房源推荐,ID:' . $ids));
             parent::_recommend(new House(), 'unRecommend', $ids, array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
Пример #15
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } else {
         if (XUtils::method() == 'POST') {
             $command = trim($_POST['command']);
             $ids = $_POST['id'];
             is_array($ids) && ($ids = implode(',', $ids));
         } else {
             XUtils::message('errorBack', '只支持POST,GET数据');
         }
     }
     switch ($command) {
         case 'delete':
             parent::_acl('catalog_delete');
             empty($ids) && XUtils::message('error', '未选择记录');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '删除全局分类,ID:' . $ids));
             parent::_delete(new Catalog(), $ids, array('index'));
             break;
         case 'sortOrder':
             parent::_acl('catalog_sort_order');
             $sortOrder = $this->_gets->getParam('sortOrder');
             foreach ((array) $sortOrder as $id => $val) {
                 $catalogModel = Catalog::model()->findByPk($id);
                 if ($catalogModel) {
                     $catalogModel->sort_order = $val;
                     $catalogModel->save();
                 }
             }
             $this->redirect(array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }
 public function actionAccess($applyId)
 {
     $model = parent::_dataLoad(new StAdmin(), $this->_admini['userId']);
     $teacherId = $model->id;
     // echo var_dump($model);
     try {
         $sql = "SELECT * FROM st_course,st_class_time,st_apply WHERE st_class_time.classTimeId = st_apply.classTimeId AND st_course.courseId=st_class_time.courseId AND st_apply.applyId='{$applyId}'";
         if (XUtils::method() == 'POST') {
             if ($_POST['approve'] == "同意") {
                 $state = 1;
             }
             if ($_POST['approve'] == "不同意") {
                 $state = 2;
             }
             $count = StApply::model()->updateByPk($applyId, array('state' => $state));
             if ($count > 0) {
                 XUtils::message('success', '审批成功', $this->createUrl('exeTeacherLogin/applyQuery'));
             } else {
                 XUtils::message('fail', '修改失败', $this->createUrl('exeTeacherLogin/access'));
             }
         }
         $data = Yii::app()->db->createCommand($sql)->queryAll();
         $data = json_decode(CJSON::encode($data), TRUE);
         is_array($data) ? null : ($data = array());
         // 防止空数组
         // echo var_dump($data);
         $this->render('access', array('data' => $data));
     } catch (Exception $e) {
         echo var_dump($e);
     }
 }
Пример #17
0
 /**
  * 缓存管理
  */
 public function actionCache()
 {
     parent::_acl();
     $this->render('cache', $data);
 }
Пример #18
0
 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if (XUtils::method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } elseif (XUtils::method() == 'POST') {
         $command = trim($_POST['command']);
         $ids = $_POST['id'];
         is_array($ids) && ($ids = implode(',', $ids));
     } else {
         XUtils::message('errorBack', '只支持POST,GET数据');
     }
     empty($ids) && XUtils::message('error', '未选择记录');
     switch ($command) {
         case 'delete':
             parent::_acl('attr_delete');
             AdminLogger::_create(array('catalog' => 'delete', 'intro' => '属性删除,ID:' . $ids));
             $attrModel = Attr::model()->findByPk($ids);
             Attr::clear(array('attrId' => $attrModel->id, 'attrName' => $attrModel->attr_name_alias, 'oldScope' => 'all'));
             parent::_delete(new Attr(), $ids, array('index'));
             break;
         default:
             throw new CHttpException(404, '错误的操作类型:' . $command);
             break;
     }
 }