public function indexAction() { $page = $this->request->getParam("p"); $project_id = $this->request->getParam("pid"); $per_page = 5; $init = $page * $per_page; $items = list_issue("num desc", $init . "," . $per_page, "project_id = " . $project_id); $total_results = count_issue("project_id = " . $project_id); $total_pages = ceil($total_results / $per_page); $this->render(array("issues" => $items, "pid" => $project_id, "pagination" => array("total_pages" => $total_pages, "total_results" => $total_results, "current_page" => $page))); }
public function showAction() { $id = mysql_real_escape_string($this->request->getParam("id")); $project = load_project($id); $new_faq = new Faq(); $new_faq->project_id = $id; $faqs = $project->getQuestions(); if ($project && !$project->published) { $this->flash->setError("This project has not been published yet!"); $this->redirect_to(project_list_path()); } else { if (!$project) { $this->flash->setError("Project not found!"); $this->redirect_to(project_list_path()); } else { //$issue = random_issue($id); $issues = list_issue("num desc", 5, "project_id = " . $id); $this->render(array("faqs_list" => $faqs, "faq" => $new_faq, "issues" => $issues, "project" => $project)); } } }