function delete($topic_id, $category_id) { $this->authenticate(); if (!is_valid_category($category_id)) { show_error('Invalid category'); exit; } if (!is_valid_topic($topic_id)) { show_error('Invalid Topic'); exit; } $response = $this->Topic_model->delete_topics($topic_id); if ($response["rc"]) { $this->session->set_flashdata("success_msg", $response["msg"]); redirect("admin/topic/listing_by_category_id/" . $category_id); } else { $this->session->set_flashdata("error_msg", $response["msg"]); redirect("admin/topic/listing_by_category_id/" . $category_id); } }
function post_belongs_to_topic() { $category_id = 0; $topic_id = 0; if ($this->input->get("category_id")) { $category_id = $this->input->get("category_id"); } if ($this->input->get("topic_id")) { $topic_id = $this->input->get("topic_id"); } if ($category_id != 0 && $topic_id == 0 || $category_id != 0 && !is_valid_category($category_id) || $topic_id != 0 && !is_valid_topic($topic_id)) { $this->session->set_flashdata("error", "Invalid parameters"); redirect("categories"); exit; } $data["category_id"] = $category_id; $data["topic_id"] = $topic_id; $data["posts"] = $this->Post_model->get_all_posts($topic_id); $data["header"] = true; $data["_view"] = "post/post_by_topic"; $data["footer"] = true; $this->load->view("layout/baseTemplate", $data); }