本文整理汇总了PHP中course_enrolment_manager::get_other_users_for_display方法的典型用法代码示例。如果您正苦于以下问题:PHP course_enrolment_manager::get_other_users_for_display方法的具体用法?PHP course_enrolment_manager::get_other_users_for_display怎么用?PHP course_enrolment_manager::get_other_users_for_display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类course_enrolment_manager
的用法示例。
在下文中一共展示了course_enrolment_manager::get_other_users_for_display方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$PAGE->set_url('/enrol/otherusers.php', $manager->get_url_params() + $table->get_url_params());
$userdetails = array('picture' => false, 'firstname' => get_string('firstname'), 'lastname' => get_string('lastname'));
$extrafields = get_extra_user_fields($context);
foreach ($extrafields as $field) {
$userdetails[$field] = get_user_field_name($field);
}
$fields = array('userdetails' => $userdetails, 'lastseen' => get_string('lastaccess'), 'role' => get_string('roles', 'role'));
// 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['lastseen']);
}
}
$table->set_fields($fields, $OUTPUT);
//$users = $manager->get_other_users($table->sort, $table->sortdirection, $table->page, $table->perpage);
$renderer = $PAGE->get_renderer('core_enrol');
$canassign = has_capability('moodle/role:assign', $manager->get_context());
$users = $manager->get_other_users_for_display($renderer, $PAGE->url, $table->sort, $table->sortdirection, $table->page, $table->perpage);
$assignableroles = $manager->get_assignable_roles(true);
foreach ($users as $userid => &$user) {
$user['picture'] = $OUTPUT->render($user['picture']);
$user['role'] = $renderer->user_roles_and_actions($userid, $user['roles'], $assignableroles, $canassign, $PAGE->url);
}
$table->set_total_users($manager->get_total_other_users());
$table->set_users($users);
$PAGE->set_title($course->fullname . ': ' . get_string('totalotherusers', 'enrol', $manager->get_total_other_users()));
$PAGE->set_heading($PAGE->title);
echo $OUTPUT->header();
echo $renderer->render($table);
echo $OUTPUT->footer();