/** * * @global <type> $CFG */ function action_default() { global $CFG; $clsid = $this->required_param('id', PARAM_INT); $sort = $this->optional_param('sort', 'name', PARAM_ALPHANUM); $dir = $this->optional_param('dir', 'ASC', PARAM_ALPHA); $page = $this->optional_param('page', 0, PARAM_INT); $perpage = $this->optional_param('perpage', 30, PARAM_INT); // how many per page $namesearch = trim($this->optional_param('search', '', PARAM_TEXT)); $alpha = $this->optional_param('alpha', '', PARAM_ALPHA); $cls = new cmclass($clsid); $columns = array('idnumber' => get_string('student_idnumber', 'block_curr_admin'), 'name' => get_string('student_name_1', 'block_curr_admin'), 'enrolmenttime' => get_string('enrolment_time', 'block_curr_admin'), 'completetime' => get_string('completion_time', 'block_curr_admin'), 'completestatusid' => get_string('student_status', 'block_curr_admin'), 'grade' => get_string('student_grade', 'block_curr_admin'), 'credits' => get_string('student_credits', 'block_curr_admin'), 'locked' => get_string('student_locked', 'block_curr_admin'), 'buttons' => ''); $stus = student::get_listing($clsid, $sort, $dir, $page * $perpage, $perpage, $namesearch, $alpha); $numstus = student::count_records($clsid, $namesearch, $alpha); $this->print_num_items($clsid, $cls->maxstudents); $this->print_alpha(); $this->print_search(); $this->print_list_view($stus, $columns, array(), 'users'); // TBD: students ? print_paging_bar($numstus, $page, $perpage, "index.php?s=stu&section=curr&id={$clsid}&sort={$sort}&" . "dir={$dir}&perpage={$perpage}&alpha={$alpha}&namesearch=" . urlencode(stripslashes($namesearch)) . "&"); echo "<form>"; // TODO: pass in query parameters if ($this->can_do('bulkedit')) { echo "<input type=\"button\" onclick=\"document.location='index.php?s=stu&section=curr&" . "action=bulkedit&id={$clsid}&sort={$sort}&dir={$dir}&perpage={$perpage}&alpha={$alpha}&search=" . urlencode(stripslashes($namesearch)) . "';\" value=\"Bulk Edit\" />"; } if ($this->can_do('add')) { echo "<input type=\"button\" onclick=\"document.location='index.php?s=stu&section=curr&" . "action=add&id={$clsid}';\" value=\"" . get_string('enrolstudents', 'block_curr_admin') . "\" />"; } echo "</form>"; }