Пример #1
0
 public function batch_restore()
 {
     $ids = $this->input->post('ids');
     if (empty($ids) or !is_array($ids)) {
         message('请选择要操作的项目!');
         return;
     }
     $back_url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'admin/question_external/index/trash';
     $success = $fail = 0;
     foreach ($ids as $id) {
         $this->examine_permission($id);
         if (QuestionModel::restore($id) === true) {
             $success++;
         } else {
             $fail++;
         }
     }
     message('批量操作完成,成功还原:' . $success . ' 个,失败:' . $fail . ' 个。', $back_url);
 }
Пример #2
0
 public function batch_restore()
 {
     if (!$this->check_power('question_trash')) {
         return;
     }
     $ids = $this->input->post('ids');
     if (empty($ids) or !is_array($ids)) {
         message('请选择要操作的项目!');
         return;
     }
     $back_url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'admin/question/index/trash';
     $success = $fail = 0;
     foreach ($ids as $id) {
         $has_edit_power = QuestionModel::check_question_power($id, 'w', false);
         if (!$has_edit_power) {
             $fail++;
             continue;
         }
         if (QuestionModel::restore($id) === true) {
             $success++;
         } else {
             $fail++;
         }
     }
     message('批量操作完成,成功还原:' . $success . ' 个,失败:' . $fail . ' 个。', $back_url);
 }