本文整理汇总了PHP中student::count_records方法的典型用法代码示例。如果您正苦于以下问题:PHP student::count_records方法的具体用法?PHP student::count_records怎么用?PHP student::count_records使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类student
的用法示例。
在下文中一共展示了student::count_records方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_default
/**
*
* @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>";
}