Exemplo n.º 1
0
 /**
  * index页面操作筛选
  */
 public function indexHandle()
 {
     $PostsLogic = new PostsLogic();
     if (I('post.keyword') != '') {
         $this->redirect('Admin/Posts/' . I('post.post_type', 'single'), array('keyword' => I('post.keyword')));
     }
     if (I('post.delAll') == 1) {
         $post_ids = I('post.posts');
         is_string($post_ids) == true ? $num = 0 : ($num = count($post_ids));
         $res_info = '';
         foreach ($post_ids as $post_id) {
             $res = $PostsLogic->preDel($post_id);
             if ($res == false) {
                 $res_info = $res_info . ' 文章ID:' . $post_id . '删除到回收站失败';
             }
         }
         $this->success($num . '篇文章批量删除到回收站成功' . $res_info);
     }
     if (I('post.emptyAll') == 1) {
         $post_ids = I('post.posts');
         is_string($post_ids) == true ? $num = 0 : ($num = count($post_ids));
         $res_info = '';
         foreach ($post_ids as $post_id) {
             $res = $PostsLogic->del($post_id);
             if ($res == false) {
                 $res_info = $res_info . ' 文章ID:' . $post_id . '批量彻底删除失败';
             }
         }
         $this->success($num . '篇文章批量彻底删除成功' . $res_info);
     }
     if (I('post.verifyAll') == 1) {
         $post_ids = I('post.posts');
         is_string($post_ids) == true ? $num = 0 : ($num = count($post_ids));
         $res_info = '';
         foreach ($post_ids as $post_id) {
             $res = $PostsLogic->verify($post_id);
             if ($res == false) {
                 $res_info = $res_info . '文章ID:' . $post_id . '移至待审核列表失败';
             }
         }
         $this->success($num . '篇文章批量移至待审核列表' . $res_info);
     }
     if (I('post.restoreAll') == 1) {
         $post_ids = I('post.posts');
         is_string($post_ids) == true ? $num = 0 : ($num = count($post_ids));
         $res_info = '';
         foreach ($post_ids as $post_id) {
             $res = $PostsLogic->restore($post_id);
             if ($res == false) {
                 $res_info = $res_info . '文章ID:' . $post_id . '移至所有文章列表失败';
             }
         }
         $this->success($num . '篇文章批量移至所有文章列表' . $res_info);
     }
     if (I('post.postAdd') == 1) {
         $this->redirect('Admin/Posts/add');
     }
 }