本文整理汇总了PHP中course_enrolment_manager::get_users_for_display方法的典型用法代码示例。如果您正苦于以下问题:PHP course_enrolment_manager::get_users_for_display方法的具体用法?PHP course_enrolment_manager::get_users_for_display怎么用?PHP course_enrolment_manager::get_users_for_display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类course_enrolment_manager
的用法示例。
在下文中一共展示了course_enrolment_manager::get_users_for_display方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$fields = array('userdetails' => $userdetails, 'lastcourseaccess' => get_string('lastcourseaccess'), 'role' => get_string('roles', 'role'), 'group' => get_string('groups', 'group'), 'enrol' => get_string('enrolmentinstances', 'enrol'));
// Remove hidden fields if the user has no access
if (!has_capability('moodle/course:viewhiddenuserfields', $context)) {
$hiddenfields = array_flip(explode(',', $CFG->hiddenuserfields));
if (isset($hiddenfields['lastaccess'])) {
unset($fields['lastcourseaccess']);
}
if (isset($hiddenfields['groups'])) {
unset($fields['group']);
}
}
$filterform = new enrol_users_filter_form('users.php', array('manager' => $manager, 'id' => $id, 'newcourse' => $newcourse), 'get', '', array('id' => 'filterform'));
$filterform->set_data(array('search' => $search, 'ifilter' => $filter, 'role' => $role, 'filtergroup' => $fgroup, 'status' => $status));
$table->set_fields($fields, $renderer);
$canassign = has_capability('moodle/role:assign', $manager->get_context());
$users = $manager->get_users_for_display($manager, $table->sort, $table->sortdirection, $table->page, $table->perpage);
foreach ($users as $userid => &$user) {
$user['picture'] = $OUTPUT->render($user['picture']);
$user['role'] = $renderer->user_roles_and_actions($userid, $user['roles'], $manager->get_assignable_roles(), $canassign, $PAGE->url);
$user['group'] = $renderer->user_groups_and_actions($userid, $user['groups'], $manager->get_all_groups(), has_capability('moodle/course:managegroups', $manager->get_context()), $PAGE->url);
$user['enrol'] = $renderer->user_enrolments_and_actions($user['enrolments']);
}
$table->set_total_users($manager->get_total_users());
$table->set_users($users);
$PAGE->set_title($PAGE->course->fullname . ': ' . get_string('totalenrolledusers', 'enrol', $manager->get_total_users()));
$PAGE->set_heading($PAGE->title);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('enrolledusers', 'enrol'));
echo $renderer->render_course_enrolment_users_table($table, $filterform);
if ($newcourse == 1) {
echo $OUTPUT->single_button(new moodle_url('/course/view.php', array('id' => $id)), get_string('proceedtocourse', 'enrol'), 'GET', array('class' => 'enrol-users-page-action'));
示例2: array
$PAGE->set_heading($pageheading);
echo $OUTPUT->header();
echo $OUTPUT->heading(fullname($user));
if (!is_null($mform)) {
$mform->display();
} else {
echo $pagecontent;
}
echo $OUTPUT->footer();
exit;
}
}
$renderer = $PAGE->get_renderer('core_enrol');
$fields = array('userdetails' => array('picture' => false, 'firstname' => get_string('firstname'), 'lastname' => get_string('lastname'), 'email' => get_string('email')), 'lastseen' => get_string('lastaccess'), 'role' => get_string('roles', 'role'), 'group' => get_string('groups', 'group'), 'enrol' => get_string('enrolmentinstances', 'enrol'));
$table->set_fields($fields, $renderer);
$canassign = has_capability('moodle/role:assign', $manager->get_context());
$users = $manager->get_users_for_display($renderer, $PAGE->url, $table->sort, $table->sortdirection, $table->page, $table->perpage);
foreach ($users as $userid => &$user) {
$user['picture'] = $OUTPUT->render($user['picture']);
$user['role'] = $renderer->user_roles_and_actions($userid, $user['roles'], $manager->get_assignable_roles(), $canassign, $PAGE->url);
$user['group'] = $renderer->user_groups_and_actions($userid, $user['groups'], $manager->get_all_groups(), has_capability('moodle/course:managegroups', $manager->get_context()), $PAGE->url);
$user['enrol'] = $renderer->user_enrolments_and_actions($userid, $user['enrolments'], $PAGE->url);
}
$table->set_total_users($manager->get_total_users());
$table->set_users($users);
$PAGE->set_title($PAGE->course->fullname . ': ' . get_string('totalenrolledusers', 'enrol', $manager->get_total_users()));
$PAGE->set_heading($PAGE->title);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('enrolledusers', 'enrol'));
echo $renderer->render($table);
echo $OUTPUT->footer();