/** * Rebuilds the pages URLs * */ public function rebuild_urls() { $this->url_model->clean_table(); $nb = $this->page_model->rebuild_urls(); $this->url_model->delete_empty_urls(); $result = array('title' => lang('ionize_title_rebuild_pages_urls'), 'status' => 'success', 'message' => lang('ionize_message_check_ok')); $this->xhr_output($result); }
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')); } }
/** * Deletes one page * @note For the moment, this method doesn't delete the linked articles, which will stay in database as phantom * @param int $id_page * */ public function delete($id_page) { $affected_rows = $this->page_model->delete($id_page); // Delete was successful if ($affected_rows > 0) { // Clean URL table $this->url_model->clean_table(); // Clear the cache Cache()->clear_cache(); // Remove deleted article from DOM $this->callback[] = array('fn' => 'ION.deleteDomElements', 'args' => array('.page' . $id_page)); // If the current edited article is deleted if ($this->input->post('redirect')) { $this->callback[] = array('fn' => 'ION.updateElement', 'args' => array('element' => 'mainPanel', 'url' => 'dashboard')); } $this->success(lang('ionize_message_operation_ok')); } else { $this->error(lang('ionize_message_operation_nok')); } }