Esempio n. 1
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Place(), $id);
     if (isset($_POST['Place'])) {
         $model->attributes = $_POST['Place'];
         $file = XUpload::upload($_FILES['attach']);
         $adr = XUpload::upload($_FILES['pic_adr']);
         if (is_array($file)) {
             $model->pic = $file['pathname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if (is_array($adr)) {
             $model->pic_adr = $adr['pathname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if ($model->validate() && $model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑内容,ID:' . $id));
             $this->redirect(array('index'));
         }
     }
     $this->render('place_update', array('model' => $model));
 }
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Lesson(), $id);
     if (isset($_POST['Lesson'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Lesson'];
         $model->teacher_id = 23;
         $model->check_status = 1;
         $model->actual_students = 0;
         $model->arrivals = 0;
         if ($model->validate()) {
             $file = XUpload::upload($_FILES['attach']);
             if (is_array($file)) {
                 $model->pic = $file['pathname'];
                 @unlink($_POST['oAttach']);
                 @unlink($_POST['oThumb']);
             }
             if ($model->save()) {
                 AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑内容,ID:' . $id));
                 $this->redirect(array('index'));
             }
         }
     }
     $this->render('lesson_update', array('model' => $model));
 }
 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);
     }
 }
Esempio n. 4
0
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Teacher(), $id);
     if (isset($_POST['Teacher'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Teacher'];
         $file = XUpload::upload($_FILES['attach']);
         $degree = XUpload::upload($_FILES['degree']);
         if (is_array($file)) {
             $model->pic = $file['pathname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if (is_array($degree)) {
             $model->degree = $degree['pathname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if ($model->validate()) {
             if ($model->save()) {
                 AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑内容,ID:' . $id));
                 $this->redirect(array('index'));
             }
         }
     }
     $this->render('teacher_update', array('model' => $model));
 }
Esempio n. 5
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $time = 1;
     $model = parent::_dataLoad(new Lesson(), $id);
     if (isset($_POST['Lesson'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Lesson'];
         $model->check_status = $_POST['Lesson']['check_status'];
         $starttime = $model->start_date_time;
         $endtime = $model->end_date_time;
         if ($starttime >= $endtime) {
             $time = 0;
         }
         $file = XUpload::upload($_FILES['attach']);
         if (is_array($file)) {
             $model->pic = $file['pathname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         //echo CActiveForm::validate($model);exit;
         if ($model->validate() && $model->save() && ($time = 1)) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑内容,ID:' . $id));
             $this->redirect(array('index'));
         }
     }
     $this->render('lesson_update', array('model' => $model));
 }
Esempio n. 6
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Place(), $id);
     $imageList = $this->_gets->getParam('imageList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     if (isset($_POST['Place'])) {
         $model->attributes = $_POST['Place'];
         $model->pic_other = $imageListSerialize['dataSerialize'];
         $data = $_POST['Place'];
         $model->rank = $data['rank'];
         $file = XUpload::upload($_FILES['attach']);
         $adr = XUpload::upload($_FILES['pic_adr']);
         if (is_array($file)) {
             $model->pic = $file['pathname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if (is_array($adr)) {
             $model->pic_adr = $adr['pathname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if ($model->validate() && $model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑内容,ID:' . $id));
             $this->redirect(array('index'));
         }
     }
     if ($imageList) {
         $imageList = $imageListSerialize['data'];
     }
     $this->render('place_update', array('model' => $model));
 }
Esempio n. 7
0
 /**
  * 更新留言
  *
  */
 public function actionUpdate($id)
 {
     parent::_acl('question_update');
     $model = parent::_dataLoad(new Question(), $id);
     if (isset($_POST['Question'])) {
         $model->attributes = $_POST['Question'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '编辑留言,ID:' . $id));
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Esempio n. 8
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl('propertyType_update');
     $model = parent::_dataLoad(new PropertyType(), $id);
     if (isset($_POST['PropertyType'])) {
         $model->attributes = $_POST['PropertyType'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入物业类型,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Esempio n. 9
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Host(), $id);
     if (isset($_POST['Host'])) {
         $acl = $this->_gets->getPost('acl');
         $model->attributes = $_POST['Host'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑内容,ID:' . $id));
             $this->redirect(array('index'));
         }
     }
     $this->render('host_update', array('model' => $model));
 }
Esempio n. 10
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Service(), $id);
     if (isset($_POST['Service'])) {
         $model->attributes = $_POST['Service'];
         $file = XUpload::upload($_FILES['image']);
         if (is_array($file)) {
             $model->image = $file['pathname'];
             @unlink($_POST['oAttach']);
         }
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '修改海外服务,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Esempio n. 11
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl('layout_update');
     $original = Yii::app()->request->getQuery('original');
     $model = parent::_dataLoad(new Layout(), $id);
     if (isset($_POST['Layout'])) {
         $model->attributes = $_POST['Layout'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑房屋布局,ID:' . $id));
             if (!empty($original)) {
                 $this->redirect($original);
             } else {
                 $this->redirect(array('index'));
             }
         }
     }
     $urlReferrer = Yii::app()->request->urlReferrer;
     $this->render('update', array('model' => $model, 'original' => $original));
 }
Esempio n. 12
0
 /**
  * 编辑属性
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Attr(), $id);
     if (isset($_POST['Attr'])) {
         $oldScope = $model->scope;
         $model->attributes = $_POST['Attr'];
         if ($oldScope == 'post' && $model->scope == 'config') {
             Attr::clear(array('attrId' => $model->id, 'oldScope' => $oldScope));
         } elseif ($oldScope == 'config' && $model->scope == 'post') {
             Attr::clear(array('attrId' => $model->id, 'oldScope' => $oldScope, 'attrName' => $model->attr_name_alias));
         }
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑属性,ID:' . $id));
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Esempio n. 13
0
 /**
  * 推荐
  */
 public function actionRecommend()
 {
     if (parent::_ajax_acl('file_update')) {
         $id = Yii::app()->request->getPost('id');
         $model = parent::_dataLoad(new File(), $id);
         if ($model->recommend == 0) {
             $model->recommend = 1;
         } else {
             $model->recommend = 0;
         }
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '更新文件推荐状态,ID:' . $id));
             echo CJSON::encode(array('status' => 'success'));
         } else {
             echo CJSON::encode(array('status' => 'failed'));
         }
     } else {
         echo CJSON::encode(array('status' => 'forbid'));
     }
 }
Esempio n. 14
0
 public function actionDisplay()
 {
     if (parent::_ajax_acl('banner_update')) {
         $id = Yii::app()->request->getPost('id');
         $model = parent::_dataLoad(new Banner(), $id);
         if ($model->status == 0) {
             $model->status = 1;
         } else {
             $model->status = 0;
         }
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '更新首页Banner状态,ID:' . $id));
             echo CJSON::encode(array('status' => 'success'));
         } else {
             echo CJSON::encode(array('status' => 'failed'));
         }
     } else {
         echo CJSON::encode(array('status' => 'forbid'));
     }
 }
Esempio n. 15
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Family(), $id);
     $imageList = $this->_gets->getParam('imageList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     if (isset($_POST['Family'])) {
         $model->attributes = $_POST['Family'];
         $model->pic_other = $imageListSerialize['dataSerialize'];
         if ($model->validate() && $model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑内容,ID:' . $id));
             $this->redirect(array('index'));
         }
     }
     if ($imageList) {
         $imageList = $imageListSerialize['data'];
     } elseif ($model->pic_other) {
         $imageList = unserialize($model->pic_other);
     }
     $this->render('family_update', array('model' => $model, 'imageList' => $imageList));
 }
Esempio n. 16
0
 /**
  * 单页更新
  *
  * @param $id        	
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Page(), $id);
     if (isset($_POST['Page'])) {
         $model->attributes = $_POST['Page'];
         $file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(200, 180)));
         if (is_array($file)) {
             $model->attach_file = $file['pathname'];
             $model->attach_thumb = $file['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if ($model->save()) {
             XXcache::refresh('_link');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑单页,ID:' . $id));
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Esempio n. 17
0
 /**
  * 编辑
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl('catalog_update');
     $model = new Catalog();
     $parentId = intval($_POST['Catalog']['parent_id']);
     $model = parent::_dataLoad(new Catalog(), $id);
     if (isset($_POST['Catalog'])) {
         self::parentTrue($id, $parentId);
         $model->attributes = $_POST['Catalog'];
         $file = XUpload::upload($_FILES['attach']);
         if (is_array($file)) {
             $model->image = $file['pathname'];
             @unlink($_POST['oAttach']);
         }
         if ($model->save()) {
             XXcache::refresh('_catalog');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑类别,ID:' . $id . ',名称:' . $model->catalog_name));
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Esempio n. 18
0
 /**
  * 更新
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl('post_update');
     $original = Yii::app()->request->getQuery('original');
     $model = parent::_dataLoad(new Post(), $id);
     if (isset($_POST['Post'])) {
         $model->attributes = $_POST['Post'];
         $file = XUpload::upload($_FILES['attach']);
         if (is_array($file)) {
             $model->image = $file['pathname'];
             @unlink($_POST['oAttach']);
         }
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑内容,ID:' . $id));
             if (!empty($original)) {
                 $this->redirect($original);
             } else {
                 $this->redirect(array('index'));
             }
         }
     }
     $this->render('update', array('model' => $model, 'original' => $original));
 }
 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);
     }
 }
Esempio n. 20
0
 public function actionHomePlay()
 {
     if (parent::_ajax_acl('video_update')) {
         $id = Yii::app()->request->getPost('id');
         $model = parent::_dataLoad(new Video(), $id);
         if ($model->home == 0) {
             $index_video = Video::model()->findAll('home=:home', array(':home' => 1));
             if (!empty($index_video)) {
                 foreach ($index_video as $obj) {
                     $obj->home = 0;
                     $obj->save();
                 }
             }
             $model->home = 1;
         } else {
             $model->home = 0;
         }
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '更新视频状态,ID:' . $id));
             echo CJSON::encode(array('status' => 'success'));
         } else {
             echo CJSON::encode(array('status' => 'failed'));
         }
     } else {
         echo CJSON::encode(array('status' => 'forbid'));
     }
 }
 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);
     }
 }
 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);
     }
 }
Esempio n. 23
0
 /**
  * 专题更新
  *
  * @param $id
  */
 public function actionSpecialUpdate($id)
 {
     parent::_acl('post_special_update');
     $model = parent::_dataLoad(new Special(), $id);
     if (isset($_POST['Special'])) {
         $model->attributes = $_POST['Special'];
         $file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(500, 400)));
         if (is_array($file)) {
             $model->attach_file = $file['pathname'];
             $model->attach_thumb = $file['paththumbname'];
             @unlink($_POST['oAttach']);
             @unlink($_POST['oThumb']);
         }
         if ($model->save()) {
             self::_adminiLogger(array('catalog' => 'update', 'intro' => '专题更新,ID:' . $model->id));
             $this->redirect(array('special'));
         }
     }
     $this->render('special_update', array('model' => $model));
 }
Esempio n. 24
0
 /**
  * 更新广告
  */
 public function actionAdUpdate($id)
 {
     parent::_acl('ad_update');
     $model = parent::_dataLoad(new Ad(), $id);
     if (isset($_POST['Ad'])) {
         $file = XUpload::upload($_FILES['attach']);
         if (is_array($file)) {
             $model->attach_file = $file['pathname'];
             @unlink($_POST['oAttach']);
         }
         $model->attributes = $_POST['Ad'];
         $model->expired_time = intval(strtotime($model->expired_time));
         $model->start_time = intval(strtotime($model->start_time));
         if ($model->save()) {
             XXcache::refresh('_ad');
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '编辑广告,ID:' . $id));
             $this->redirect(array('ad'));
         }
     }
     $model->expired_time = date('Y-m-d', $model->expired_time);
     $model->start_time = date('Y-m-d', $model->start_time);
     $this->render('ad_update', array('model' => $model));
 }
Esempio n. 25
0
 /**
  * 修改密码
  */
 public function actionOwnerUpdate()
 {
     $model = parent::_dataLoad(new Admin(), $this->_admini['userId']);
     if (isset($_POST['Admin'])) {
         $password = $_POST['Admin']['password'];
         if (empty($password)) {
             $_POST['Admin']['password'] = $model->password;
         } else {
             $_POST['Admin']['password'] = md5($password);
         }
         $model->attributes = $_POST['Admin'];
         $model->password = empty($password) ? $model->password : md5($password);
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'update', 'intro' => '修改密码:' . CHtml::encode($model->username)));
             //日志
             XUtils::message('success', '修改完成', $this->createUrl('default/home'));
         }
     }
     $this->render('owner_update', array('model' => $model));
 }