function get_records($filter) { $sort = $this->optional_param('sort', 'timecreated'); $dir = $this->optional_param('dir', 'ASC'); $page = $this->optional_param('page', 0); $perpage = $this->optional_param('perpage', 30); // how many per page $id = $this->required_param('id', PARAM_INT); $items = waitlist::get_students($id, $sort, $dir, $page, $perpage, $filter['namesearch'], $filter['alpha']); $numitems = waitlist::count_records($id, $filter['namesearch'], $filter['alpha']); return array($items, $numitems); }
function get_records($filter) { $sort = $this->optional_param('sort', 'timecreated', PARAM_CLEAN); $dir = $this->optional_param('dir', 'ASC', PARAM_CLEAN); $page = $this->optional_param('page', 0, PARAM_INT); $perpage = $this->optional_param('perpage', 30, PARAM_INT); // how many per page $id = $this->required_param('id', PARAM_INT); if ($sort == 'name') { $sort = 'lastname'; } $items = waitlist::get_students($id, $sort, $dir, $page * $perpage, $perpage, $filter['namesearch'], $filter['alpha']); $numitems = waitlist::count_records($id, $filter['namesearch'], $filter['alpha']); //error_log("waitlistpage::get_records(): count(items) = ". count($items). ", numitems = {$numitems}"); return array($items, $numitems); }