public function action_index() { $msg = $this->request->param('msg'); if ($this->request->param('sort')) { $sort = $this->request->param('sort'); } else { $sort = 'room_name'; } if ($this->request->param('order')) { $order = $this->request->param('order'); } else { $order = 'DESC'; } $filters = array('filter_room_name' => $this->request->param('filter_room_name'), 'filter_number' => $this->request->param('filter_number'), 'filter_location' => $this->request->param('filter_location')); $total = Model_Room::rooms_total($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $rooms = Model_Room::rooms($filters); $sorting = new Sort(array('Name' => 'room_name', 'Number' => 'room_number', 'Location' => 'name', 'Action' => '')); $url = 'room/index'; if ($this->request->param('filter_room_name')) { $url .= '/filter_room_name/' . $this->request->param('filter_room_name'); $filter = $this->request->param('filter_room_name'); $filter_select = 'filter_room_name'; } if ($this->request->param('filter_number')) { $url .= '/filter_number/' . $this->request->param('filter_number'); $filter = $this->request->param('filter_number'); $filter_select = 'filter_number'; } if ($this->request->param('filter_location')) { $url .= '/filter_location/' . $this->request->param('filter_location'); $filter = $this->request->param('filter_location'); $filter_select = 'filter_location'; } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); $links = array('add_room' => Html::anchor('/room/add/', 'Create a Room', array('class' => 'createButton l')), 'locations' => Html::anchor('/location', 'Locations', array('class' => 'pageAction l')), 'delete' => URL::site('/room/delete/')); $table = array('heading' => $heading, 'data' => $rooms); // Render the pagination links $pagination = $pagination->render(); $filter_room_name = $this->request->param('filter_room_name'); $filter_url = URL::site('room/index'); $view = View::factory('room/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('msg', $msg); Breadcrumbs::add(array('System', Url::site('system'))); Breadcrumbs::add(array('Room', Url::site('room'))); $this->content = $view; }
public function action_index() { $sort = $this->request->param('sort', 'name'); $order = $this->request->param('order', 'ASC'); Session::instance()->delete('course_id'); $criteria = array('user' => Acl::instance()->relevant_user(), 'filters' => array('name' => $this->request->param('filter_name'), 'access_code' => $this->request->param('filter_access_code'), 'start_date' => $this->request->param('filter_start_date'), 'end_date' => $this->request->param('filter_end_date'))); $total = Model_Course::courses_total($criteria); $pagination = Pagination::factory(array('total_items' => $total, 'items_per_page' => 5)); $criteria = array_merge($criteria, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $courses = Model_Course::courses($criteria); $sorting = new Sort(array('Course' => 'name', 'Access Code' => 'access_code', 'Start Date' => 'start_date', 'End Date' => 'end_date', 'Actions' => '')); $url = 'course/index'; if ($this->request->param('filter_name')) { $url .= '/filter_name/' . $this->request->param('filter_name'); $filter = $this->request->param('filter_name'); $filter_select = 'filter_name'; } if ($this->request->param('filter_access_code')) { $url .= '/filter_access_code/' . $this->request->param('filter_access_code'); $filter = $this->request->param('filter_access_code'); $filter_select = 'filter_access_code'; } if ($this->request->param('filter_start_date')) { $url .= '/filter_start_date/' . $this->request->param('filter_start_date'); $filter = $this->request->param('filter_start_date'); $filter_select = 'filter_start_date'; } if ($this->request->param('filter_end_date')) { $url .= '/filter_end_date/' . $this->request->param('filter_end_date'); $filter = $this->request->param('filter_end_date'); $filter_select = 'filter_end_date'; } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); // Render the pagination links $pagination = $pagination->render(); $links = array('add' => Html::anchor('/course/add/', 'Create a course', array('class' => 'createButton l')), 'delete' => URL::site('/course/delete/'), 'join' => Html::anchor('/course/join/', 'Join Course', array('class' => 'pageAction c'))); $table = array('heading' => $heading, 'data' => $courses); $filter_name = $this->request->param('filter_name'); $filter_access_code = $this->request->param('filter_access_code'); $filter_start_date = $this->request->param('filter_start_date'); $filter_end_date = $this->request->param('filter_end_date'); $filter_url = URL::site('course/index'); $success = Session::instance()->get('success'); Session::instance()->delete('success'); $view = View::factory('course/list')->bind('table', $table)->bind('count', $total)->bind('links', $links)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('success', $success); Breadcrumbs::add(array('Courses', Url::site('course'))); $this->content = $view; }
public function action_index() { $msg = $this->request->param('msg'); if ($this->request->param('sort')) { $sort = $this->request->param('sort'); } else { $sort = 'name'; } if ($this->request->param('order')) { $order = $this->request->param('order'); } else { $order = 'DESC'; } $location = ORM::factory('location'); if ($this->request->param('filter_name')) { $location->where('locations.name', 'LIKE', '%' . $this->request->param('filter_name') . '%'); } $count = $location->count_all(); $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $location->select(array('count("rooms.location_id")', 'room_count'))->join('rooms', 'left')->on('locations.id', '=', 'rooms.location_id'); if ($this->request->param('filter_name')) { $location->where('locations.name', 'LIKE', '%' . $this->request->param('filter_name') . '%'); } $location->group_by('locations.id')->order_by($sort, $order)->limit($pagination->items_per_page)->offset($pagination->offset); $locations = $location->find_all(); $sorting = new Sort(array('Location' => 'name', 'Map' => '', 'No of Rooms' => 'room_count', 'Actions' => '')); $url = 'location/index'; if ($this->request->param('filter_name')) { $url .= '/filter_name/' . $this->request->param('filter_name'); $filter = $this->request->param('filter_name'); $filter_select = 'filter_name'; } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); $links = array('add_location' => Html::anchor('/location/add/', 'Create a location', array('class' => 'createButton l')), 'rooms' => Html::anchor('/room', 'Rooms', array('class' => 'pageAction l')), 'delete' => URL::site('/location/delete/')); $table = array('heading' => $heading, 'data' => $locations); // Render the pagination links $pagination = $pagination->render(); $filter_name = $this->request->param('filter_name'); $filter_url = URL::site('location/index'); $view = View::factory('location/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('msg', $msg); Breadcrumbs::add(array('System', Url::site('system'))); Breadcrumbs::add(array('Location', Url::site('location'))); $this->content = $view; }
public function action_index() { $msg = $this->request->param('msg'); if ($this->request->param('sort')) { $sort = $this->request->param('sort'); } else { $sort = 'name'; } if ($this->request->param('order')) { $order = $this->request->param('order'); } else { $order = 'DESC'; } $examgroup = ORM::factory('examgroup'); if ($this->request->param('filter_name')) { $examgroup->where('name', 'LIKE', '%' . $this->request->param('filter_name') . '%'); } $count = $examgroup->count_all(); $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $examgroup->select('name'); if ($this->request->param('filter_name')) { $examgroup->where('name', 'LIKE', '%' . $this->request->param('filter_name') . '%'); } $examgroup->group_by('id')->order_by($sort, $order)->limit($pagination->items_per_page)->offset($pagination->offset); $examgroups = $examgroup->find_all(); $sorting = new Sort(array('Name' => 'name', 'Action' => '')); $url = 'examgroup/index'; if ($this->request->param('filter_name')) { $url .= '/filter_name/' . $this->request->param('filter_name'); } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); $links = array('add_examgroup' => Html::anchor('/examgroup/add/', 'Create a Grading Period', array('class' => 'createButton l')), 'delete' => URL::site('/examgroup/delete/')); $table = array('heading' => $heading, 'data' => $examgroups); // Render the pagination links $pagination = $pagination->render(); $filter_name = $this->request->param('filter_name'); $filter_url = URL::site('examgroup/index'); $success = Session::instance()->get('success'); Session::instance()->delete('success'); $view = View::factory('examgroup/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('pagination', $pagination)->bind('filter_name', $filter_name)->bind('filter_url', $filter_url)->bind('msg', $msg)->bind('success', $success); Breadcrumbs::add(array('Exams', Url::site('exam'))); Breadcrumbs::add(array('Grading Period', Url::site('examgroup'))); $this->content = $view; }
public function action_index() { if ($this->request->param('sort')) { $sort = $this->request->param('sort'); } else { $sort = 'name'; } if ($this->request->param('order')) { $order = $this->request->param('order'); } else { $order = 'DESC'; } $batch = ORM::factory('batch'); if ($this->request->param('filter_name')) { $batch->where('batches.name', 'LIKE', '%' . $this->request->param('filter_name') . '%'); } $count = $batch->count_all(); $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $batch->select(array('COUNT("batches_users.user_id")', 'users'))->join('batches_users', 'left')->on('batches_users.batch_id', '=', 'batches.id'); if ($this->request->param('filter_name')) { $batch->where('batches.name', 'LIKE', '%' . $this->request->param('filter_name') . '%'); } $batch->group_by('batches.id')->order_by($sort, $order)->limit($pagination->items_per_page)->offset($pagination->offset); $batches = $batch->find_all(); $sorting = new Sort(array('Batch' => 'name', 'No. of Students' => 'users', 'Actions' => '')); $url = 'batch/index'; $filter = array('text' => '', 'select' => ''); if ($this->request->param('filter_name')) { $url .= '/filter_name/' . $this->request->param('filter_name'); $filter = array('text' => $this->request->param('filter_name'), 'select' => 'filter_name'); } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); $links = array('add_batch' => Html::anchor('/batch/add/', 'Create a batch', array('class' => 'createButton l')), 'delete' => URL::site('/batch/delete/')); $table = array('heading' => $heading, 'data' => $batches); // Render the pagination links $pagination = $pagination->render(); $filter['url'] = URL::site('batch/index'); $view = View::factory('batch/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('pagination', $pagination)->bind('filter', $filter)->bind('success', $success); $success = Session::instance()->get('success'); Session::instance()->delete('success'); Breadcrumbs::add(array('Batches', Url::site('batch'))); $this->content = $view; }
public function test_render() { $sorting = new Sort(array('Column1' => '')); $sorting->set_order('ASC'); //testing with checkbox column true $html = '<tr><th><input type="checkbox" onclick="$(\'.selected\').attr(\'checked\', this.checked);"/></th><th>Column1</th></tr>'; $this->assertEquals($html, $sorting->render()); //testing with checkbox column false $sorting->set_check_box_column(FALSE); $html = '<tr><th>Column1</th></tr>'; $this->assertEquals($html, $sorting->render()); //testing with attributes $sorting = new Sort(array('Column1' => array('sort' => '', 'attributes' => array('width' => 150)))); $sorting->set_order('ASC'); //testing with checkbox column true $html = '<tr><th><input type="checkbox" onclick="$(\'.selected\').attr(\'checked\', this.checked);"/></th><th width="150">Column1</th></tr>'; $this->assertEquals($html, $sorting->render()); }
public function action_index() { $sort = $this->request->param('sort', 'title'); $order = $this->request->param('order', 'ASC'); //Session::instance()->delete('course_id'); $criteria = array('filters' => array('title' => $this->request->param('filter_title'), 'description' => $this->request->param('filter_description'))); $total = Model_Link::link_total($criteria); $pagination = Pagination::factory(array('total_items' => $total, 'items_per_page' => 5)); $criteria = array_merge($criteria, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $links = Model_Link::links($criteria); $sorting = new Sort(array('Title' => 'title', 'Description' => 'description', 'No Of Questions' => '', 'Actions' => '')); $url = 'link/index'; if ($this->request->param('filter_title')) { $url .= '/filter_title/' . $this->request->param('filter_title'); $filter = $this->request->param('filter_title'); $filter_select = 'filter_title'; } if ($this->request->param('filter_description')) { $url .= '/filter_description/' . $this->request->param('filter_description'); $filter = $this->request->param('filter_description'); $filter_select = 'filter_description'; } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); // Render the pagination links $pagination = $pagination->render(); $links_old = array('delete' => URL::site('/link/delete/'), 'edit' => URL::site('/link/edit/')); $table = array('data' => $links); $filter_title = $this->request->param('filter_title'); $filter_description = $this->request->param('filter_description'); $filter_url = URL::site('link/index'); $success = Session::instance()->get('success'); Session::instance()->delete('success'); $view = View::factory('link/list')->bind('table', $table)->bind('count', $total)->bind('links_old', $links_old)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('success', $success); $this->content = $view; }
public function action_index() { if ($this->request->param('sort')) { $sort = $this->request->param('sort'); } else { $sort = 'id'; } if ($this->request->param('order')) { $order = $this->request->param('order'); } else { $order = 'DESC'; } if ($this->request->param('filter_batch')) { $filters = array('filter_batch' => $this->request->param('filter_batch')); $total = Model_User::users_total_batch($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $users = Model_User::users_batch($filters); } else { if ($this->request->param('filter_course')) { $filters = array('filter_course' => $this->request->param('filter_course')); $total = Model_User::users_total_course($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $users = Model_User::users_course($filters); } else { if ($this->request->param('filter_role')) { $filters = array('filter_role' => $this->request->param('filter_role')); $total = Model_User::users_total_role($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $users = Model_User::users_role($filters); } else { $filters = array('filter_id' => $this->request->param('filter_id'), 'filter_name' => $this->request->param('filter_name'), 'filter_approved' => $this->request->param('filter_approved')); $total = Model_User::users_total($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 50)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $users = Model_User::users($filters); } } } $sorting = new Sort(array('Roll No' => 'id', 'Name' => array('sort' => 'firstname', 'attributes' => array('width' => 330)), 'Batch' => array('sort' => '', 'attributes' => array('width' => 140)), 'Courses' => array('sort' => '', 'attributes' => array('width' => 140)), 'Approved' => array('sort' => 'status', 'attributes' => array('width' => 140)), 'Actions' => '')); $url = 'user/index'; if ($this->request->param('filter_name')) { $url .= '/filter_name/' . $this->request->param('filter_name'); $filter = $this->request->param('filter_name'); $filter_select = 'filter_name'; } if ($this->request->param('filter_id')) { $url .= '/filter_id/' . $this->request->param('filter_id'); $filter = $this->request->param('filter_id'); $filter_select = 'filter_id'; } if ($this->request->param('filter_batch')) { $url .= '/filter_batch/' . $this->request->param('filter_batch'); $filter = $this->request->param('filter_batch'); $filter_select = 'filter_batch'; } if ($this->request->param('filter_course')) { $url .= '/filter_course/' . $this->request->param('filter_course'); $filter = $this->request->param('filter_course'); $filter_select = 'filter_course'; } if ($this->request->param('filter_approved')) { $url .= '/filter_approved/' . $this->request->param('filter_approved'); $filter = $this->request->param('filter_approved'); $filter_select = 'filter_approved'; } if ($this->request->param('filter_role')) { $url .= '/filter_role/' . $this->request->param('filter_role'); $filter = $this->request->param('filter_role'); $filter_select = 'filter_role'; } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); $pagination = $pagination->render(); $links = array('add' => Html::anchor('/user/add/', 'Create a user', array('class' => 'createButton l')), 'uploadcsv' => Html::anchor('/user/uploadcsv/', 'Upload CSV', array('class' => 'pageAction l')), 'roles' => Html::anchor('/role/', 'Manage Roles', array('class' => 'pageAction 1')), 'delete' => URL::site('/user/delete/')); $table['heading'] = $heading; $table['data'] = $users; $filter_url = URL::site('user/index'); $cacheimage = CacheImage::instance(); $success = Session::instance()->get('success'); Session::instance()->delete('success'); $view = View::factory('user/list')->bind('table', $table)->bind('users', $users)->bind('count', $count)->bind('links', $links)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('cacheimage', $cacheimage)->bind('success', $success); Breadcrumbs::add(array('User', Url::site('user'))); $this->content = $view; }
private function get_list() { if ($this->request->param('sort')) { $sort = $this->request->param('sort'); } else { $sort = 'name'; } if ($this->request->param('order')) { $order = $this->request->param('order'); } else { $order = 'DESC'; } if ($this->request->param('filter_grading_period')) { $filters = array('filter_grading_period' => $this->request->param('filter_grading_period')); $total = Model_Exam::exams_total_grading_period($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $exams = Model_Exam::exams_grading_period($filters); } else { if ($this->request->param('filter_date')) { $sdate = strtotime($this->request->param('filter_date')); $edate = $sdate + 86400; $filters = array('sdate' => $sdate, 'edate' => $edate); $total = Model_Exam::exams_total_date($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $exams = Model_Exam::exams_date($filters); } else { if ($this->request->param('filter_course')) { $filters = array('filter_course' => $this->request->param('filter_course')); $total = Model_Exam::exams_total_course($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $exams = Model_Exam::exams_course($filters); } else { $filters = array('filter_name' => $this->request->param('filter_name'), 'filter_passing_marks' => $this->request->param('filter_passing_marks'), 'filter_total_marks' => $this->request->param('filter_total_marks'), 'filter_reminder' => $this->request->param('filter_reminder')); $total = Model_Exam::exams_total($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $exams = Model_Exam::exams($filters); } } } $sorting = new Sort(array('Name' => 'name', 'Grading Period' => '', 'Date / Time' => 'events.eventstart', 'Course' => '', 'Total Marks' => 'total_marks', 'Passing Marks' => 'passing_marks', 'Reminder' => 'reminder', 'Action' => '')); $url = 'exam/index'; if ($this->request->param('filter_name')) { $url .= '/filter_name/' . $this->request->param('filter_name'); $filter = $this->request->param('filter_name'); $filter_select = 'filter_name'; } if ($this->request->param('filter_passing_marks')) { $url .= '/filter_passing_marks/' . $this->request->param('filter_passing_marks'); $filter = $this->request->param('filter_passing_marks'); $filter_select = 'filter_passing_marks'; } if ($this->request->param('filter_total_marks')) { $url .= '/filter_total_marks/' . $this->request->param('filter_total_marks'); $filter = $this->request->param('filter_total_marks'); $filter_select = 'filter_total_marks'; } if ($this->request->param('filter_grading_period')) { $url .= '/filter_grading_period/' . $this->request->param('filter_grading_period'); $filter = $this->request->param('filter_grading_period'); $filter_select = 'filter_grading_period'; } if ($this->request->param('filter_date')) { $url .= '/filter_date/' . $this->request->param('filter_date'); $filter = $this->request->param('filter_date'); $filter_select = 'filter_date'; } if ($this->request->param('filter_course')) { $url .= '/filter_course/' . $this->request->param('filter_course'); $filter = $this->request->param('filter_course'); $filter_select = 'filter_course'; } if ($this->request->param('filter_reminder')) { $url .= '/filter_reminder/' . $this->request->param('filter_reminder'); $filter = $this->request->param('filter_reminder'); $filter_select = 'filter_reminder'; } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); $table = array('heading' => $heading, 'data' => $exams); // Render the pagination links $pagination = $pagination->render(); $links = array('add' => Html::anchor('/exam/add/', 'Create an Exam', array('class' => 'createButton l')), 'delete' => URL::site('/exam/delete/'), 'examgroup' => Html::anchor('examgroup', 'Grading Period', array('class' => 'l pageAction')), 'examresult' => Html::anchor('examresult/upload', 'Manage Results', array('class' => '1 pageAction'))); $filter_name = $this->request->param('filter_name'); $filter_passing_marks = $this->request->param('filter_passing_marks'); $filter_total_marks = $this->request->param('filter_total_marks'); $filter_url = URL::site('exam/index'); $success = Session::instance()->get('success'); Session::instance()->delete('success'); $view = View::factory('exam/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('success', $success)->bind('pagination', $pagination); Breadcrumbs::add(array('Exams', Url::site('exam'))); $this->content = $view; }
public function action_index() { if ($this->request->param('sort')) { $sort = $this->request->param('sort'); } else { $sort = 'name'; } if ($this->request->param('order')) { $order = $this->request->param('order'); } else { $order = 'DESC'; } if ($this->request->param('filter_when')) { $sdate = strtotime($this->request->param('filter_when')); $edate = $sdate + 86400; $filters = array('sdate' => $sdate, 'edate' => $edate); $total = Model_Lecture::lectures_total_when($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $lectures = Model_Lecture::lectures_when($filters); } else { $filters = array('filter_name' => $this->request->param('filter_name'), 'filter_course' => $this->request->param('filter_course'), 'filter_lecturer' => $this->request->param('filter_lecturer')); $total = Model_Lecture::lectures_total($filters); $count = $total; $pagination = Pagination::factory(array('total_items' => $count, 'items_per_page' => 5)); $filters = array_merge($filters, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $lectures = Model_Lecture::lectures($filters); } $sorting = new Sort(array('Lecture' => 'name', 'Course' => 'courses.name', 'Lecturer' => 'firstname', 'When' => '', 'Action' => '')); $url = 'lecture/index'; if ($this->request->param('filter_name')) { $url .= '/filter_name/' . $this->request->param('filter_name'); $filter = $this->request->param('filter_name'); $filter_select = 'filter_name'; } if ($this->request->param('filter_course')) { $url .= '/filter_course/' . $this->request->param('filter_course'); $filter = $this->request->param('filter_course'); $filter_select = 'filter_course'; } if ($this->request->param('filter_lecturer')) { $url .= '/filter_lecturer/' . $this->request->param('filter_lecturer'); $filter = $this->request->param('filter_lecturer'); $filter_select = 'filter_lecturer'; } if ($this->request->param('filter_when')) { $url .= '/filter_when/' . $this->request->param('filter_when'); $filter = $this->request->param('filter_when'); $filter_select = 'filter_when'; } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); $table = array('heading' => $heading, 'data' => $lectures); // Render the pagination links $pagination = $pagination->render(); $links = array('add' => Html::anchor('/lecture/add/', 'Create a Lecture', array('class' => 'createButton l')), 'delete' => URL::site('/lecture/delete/')); $filter_url = URL::site('lecture/index'); $view = View::factory('lecture/list')->bind('links', $links)->bind('table', $table)->bind('count', $count)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('pagination', $pagination); Breadcrumbs::add(array('Lectures', Url::site('lecture'))); $this->content = $view; }