Ejemplo n.º 1
0
 public function multiple_action()
 {
     $ids = $this->input->post('ids');
     $action = $this->input->post('action');
     $id_page = $this->input->post('id_page');
     $returned_ids = array();
     if (!empty($ids)) {
         switch ($action) {
             case 'delete':
                 foreach ($ids as $id_article) {
                     $nb = $this->article_model->delete($id_article);
                     if ($nb > 0) {
                         $returned_ids[] = $id_article;
                     }
                 }
                 break;
             case 'unlink':
                 foreach ($ids as $id_article) {
                     $nb = $this->article_model->unlink($id_article, $id_page);
                     if ($nb > 0) {
                         $returned_ids[] = $id_article;
                     }
                 }
                 break;
             case 'offline':
                 foreach ($ids as $id_article) {
                     $this->article_model->switch_online($id_page, $id_article, 0);
                 }
                 $returned_ids = $ids;
                 break;
             case 'online':
                 foreach ($ids as $id_article) {
                     $this->article_model->switch_online($id_page, $id_article, 1);
                 }
                 $returned_ids = $ids;
                 break;
         }
         $this->url_model->clean_table();
         $this->xhr_output(array('action' => $action, 'id_page' => $id_page, 'ids' => $returned_ids));
     } else {
         $this->error(lang('ionize_message_operation_nok'));
     }
 }