$rolenames = array();
$avoidroles = array();
+ $rolenamesurl = new moodle_url("$CFG->wwwroot/user/index.php?contextid=$context->id&sifirst=&silast=");
+
if ($roles = get_roles_used_in_context($context, true)) {
// We should ONLY allow roles with moodle/course:view because otherwise we get little niggly issues
// like MDL-8093
}
// Should use this variable so that we don't break stuff every time a variable is added or changed.
- $baseurl = $CFG->wwwroot.'/user/index.php?contextid='.$context->id.'&roleid='.$roleid.'&id='.$course->id.'&perpage='.$perpage.'&accesssince='.$accesssince.'&search='.s($search);
+ $baseurl = new moodle_url($CFG->wwwroot.'/user/index.php', array(
+ 'contextid' => $context->id,
+ 'roleid' => $roleid,
+ 'id' => $course->id,
+ 'perpage' => $perpage,
+ 'accesssince' => $accesssince,
+ 'search' => s($search)));
/// Print headers
if ($mycourses = get_my_courses($USER->id)) {
echo '<td class="left">';
$courselist = array();
+ $popupurl = new moodle_url($CFG->wwwroot.'/user/index.php?roleid='.$roleid.'&sifirst=&silast=');
foreach ($mycourses as $mycourse) {
$courselist[$mycourse->id] = format_string($mycourse->shortname);
}
unset($courselist[SITEID]);
$courselist = array(SITEID => format_string($SITE->shortname)) + $courselist;
}
- popup_form($CFG->wwwroot.'/user/index.php?roleid='.$roleid.'&sifirst=&silast=&id=',
- $courselist, 'courseform', $course->id, '', '', '', false, 'self', get_string('mycourses'));
+ $select = moodle_select::make_popup_form($popupurl, 'id', $courselist, 'courseform', $course->id);
+ $select->set_label(get_string('mycourses'));
+ echo $OUTPUT->select($select);
echo '</td>';
}
echo '<td class="left">';
- groups_print_course_menu($course, $baseurl);
+ groups_print_course_menu($course, $baseurl->out());
echo '</td>';
if (!isset($hiddenfields['lastaccess'])) {
$now = usergetmidnight(time());
$timeaccess = array();
+ $baseurl->remove_params('accesssince');
// makes sense for this to go first.
$timeoptions[0] = get_string('selectperiod');
if (count($timeoptions) > 1) {
echo '<td class="left">';
- $baseurl = preg_replace('/&accesssince='.$accesssince.'/','',$baseurl);
- popup_form($baseurl.'&accesssince=',$timeoptions,'timeoptions',$accesssince, '', '', '', false, 'self', get_string('usersnoaccesssince'));
+ $select = moodle_select::make_popup_form($baseurl, 'accesssince', $timeoptions, 'timeoptions', $accesssince);
+ $select->set_label(get_string('usersnoaccesssince'));
+ echo $OUTPUT->select($select);
echo '</td>';
}
}
if ($allowenroldetails) {
$formatmenu['2']= get_string('enroldetails');
}
- popup_form($baseurl.'&mode=', $formatmenu, 'formatmenu', $mode, '', '', '', false, 'self', get_string('userlist'));
+ $select = moodle_select::make_popup_form($baseurl, 'mode', $formatmenu, 'formatmenu', $mode);
+ $select->nothinglabel = false;
+ $select->set_label(get_string('userlist'));
+ echo $OUTPUT->select($select);
echo '</td></tr></table>';
if ($currentgroup and (!$isseparategroups or has_capability('moodle/site:accessallgroups', $context))) { /// Display info about the group
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
- $table->define_baseurl($baseurl);
+ $table->define_baseurl($baseurl->out());
if (!isset($hiddenfields['lastaccess'])) {
$table->sortable(true, 'lastaccess', SORT_DESC);
echo '<div class="rolesform">';
echo '<label for="rolesform_jump">'.get_string('currentrole', 'role').' </label>';
if ($context->id != $frontpagectx->id) {
- $rolenames = array(0 => get_string('all')) + $rolenames;
+ $rolenames = array('0' => get_string('all')) + $rolenames;
} else {
if (!$CFG->defaultfrontpageroleid) {
// we do not want "All users with role" - we already have all users in defualt frontpage role option
- $rolenames = array(0 => get_string('userswithrole', 'role')) + $rolenames;
+ $rolenames = array('0' => get_string('userswithrole', 'role')) + $rolenames;
}
}
- popup_form("$CFG->wwwroot/user/index.php?contextid=$context->id&sifirst=&silast=&roleid=", $rolenames,
- 'rolesform', $roleid, '');
+ $select = moodle_select::make_popup_form($rolenamesurl, 'roleid', $rolenames, 'rolesform', $roleid);
+ $select->nothinglabel = false;
+ echo $OUTPUT->select($select);
echo '</div>';
} else if (count($rolenames) == 1) {
echo '<div class="initialbar firstinitial">'.get_string('firstname').' : ';
if(!empty($firstinitial)) {
- echo '<a href="'.$baseurl.'&sifirst=">'.$strall.'</a>';
+ echo '<a href="'.$baseurl->out().'&sifirst=">'.$strall.'</a>';
} else {
echo '<strong>'.$strall.'</strong>';
}
if ($letter == $firstinitial) {
echo ' <strong>'.$letter.'</strong>';
} else {
- echo ' <a href="'.$baseurl.'&sifirst='.$letter.'">'.$letter.'</a>';
+ echo ' <a href="'.$baseurl->out().'&sifirst='.$letter.'">'.$letter.'</a>';
}
}
echo '</div>';
echo '<div class="initialbar lastinitial">'.get_string('lastname').' : ';
if(!empty($lastinitial)) {
- echo '<a href="'.$baseurl.'&silast=">'.$strall.'</a>';
+ echo '<a href="'.$baseurl->out().'&silast=">'.$strall.'</a>';
} else {
echo '<strong>'.$strall.'</strong>';
}
if ($letter == $lastinitial) {
echo ' <strong>'.$letter.'</strong>';
} else {
- echo ' <a href="'.$baseurl.'&silast='.$letter.'">'.$letter.'</a>';
+ echo ' <a href="'.$baseurl->out().'&silast='.$letter.'">'.$letter.'</a>';
}
}
echo '</div>';
$row->cells[2]->text .= '<br /><input type="checkbox" name="user'.$user->id.'" /> ';
}
$table->data = array($row);
- echo $OUTPUT->print_table($table);
+ echo $OUTPUT->table($table);
}
} else {
echo '<input type="text" name="search" value="'.s($search).'" /> <input type="submit" value="'.get_string('search').'" /></div></form>'."\n";
}
- $perpageurl = preg_replace('/&perpage=\d*/','', $baseurl);
+ $perpageurl = clone($baseurl);
+ $perpageurl->remove_params('perpage');
if ($perpage == SHOW_ALL_PAGE_SIZE) {
- echo '<div id="showall"><a href="'.$perpageurl.'&perpage='.DEFAULT_PAGE_SIZE.'">'.get_string('showperpage', '', DEFAULT_PAGE_SIZE).'</a></div>';
+ $perpageurl->param('perpage', DEFAULT_PAGE_SIZE);
+ echo '<div id="showall"><a href="'.$perpageurl->out().'">'.get_string('showperpage', '', DEFAULT_PAGE_SIZE).'</a></div>';
} else if ($matchcount > 0 && $perpage < $matchcount) {
- echo '<div id="showall"><a href="'.$perpageurl.'&perpage='.SHOW_ALL_PAGE_SIZE.'">'.get_string('showall', '', $matchcount).'</a></div>';
+ $perpageurl->param('perpage', SHOW_ALL_PAGE_SIZE);
+ echo '<div id="showall"><a href="'.$perpageurl.'">'.get_string('showall', '', $matchcount).'</a></div>';
}
echo $OUTPUT->footer();