예제 #1
0
파일: Class.php 프로젝트: nbaiwan/yav
 /**
  * 删除档案栏目
  * @param mixed $id 档案栏目编号
  */
 public function actionDelete($id)
 {
     $class = ContentArchivesClass::get_class_by_id($id, false);
     if (empty($class)) {
         $this->redirect[] = array('text' => '', 'href' => $this->forward);
         $this->message('档案栏目不存在或已被删除', self::MSG_ERROR, true);
     }
     if ($class['class_is_system'] == 1) {
         $this->redirect[] = array('text' => '', 'href' => $this->forward);
         $this->message('系统档案栏目不允许删除', self::MSG_ERROR, true);
     }
     $this->db->update('{{content_archives_classes}}', array('class_status' => 0), 'class_id=:class_id', array(':class_id' => $id));
     ContentArchivesClass::update_cache();
     //记录操作日志
     $user = $this->user;
     $message = '{user_name}删除了档案栏目{classes_name}';
     $data = array('user_id' => $user->id, 'user_name' => $user->name, 'classes_name' => $class['class_name'], 'data' => array('class_id' => $id));
     AdminLogs::add($user->id, 'Content/Class', $id, 'Delete', 'success', $message, $data);
     if (!isset($_GET['ajax'])) {
         $this->redirect[] = array('text' => '', 'href' => $this->forward);
         $this->message('档案栏目删除成功', self::MSG_SUCCESS, true);
         //$this->redirect(array('Content/Class/Index'));
     }
 }