From: nicolasconnault Date: Mon, 10 Aug 2009 03:40:04 +0000 (+0000) Subject: MDL-19825 Converted calls to popup_form() X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d72703114207b414172112af7272549d53c748fb;p=moodle.git MDL-19825 Converted calls to popup_form() --- diff --git a/user/index.php b/user/index.php index 6af59f3220..6bed589d32 100644 --- a/user/index.php +++ b/user/index.php @@ -61,6 +61,8 @@ $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 @@ -160,7 +162,13 @@ } // 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 @@ -207,6 +215,7 @@ if ($mycourses = get_my_courses($USER->id)) { echo ''; $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); } @@ -214,13 +223,14 @@ 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 ''; } echo ''; - groups_print_course_menu($course, $baseurl); + groups_print_course_menu($course, $baseurl->out()); echo ''; if (!isset($hiddenfields['lastaccess'])) { @@ -241,6 +251,7 @@ $now = usergetmidnight(time()); $timeaccess = array(); + $baseurl->remove_params('accesssince'); // makes sense for this to go first. $timeoptions[0] = get_string('selectperiod'); @@ -274,8 +285,9 @@ if (count($timeoptions) > 1) { echo ''; - $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 ''; } } @@ -303,7 +315,10 @@ 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 ''; if ($currentgroup and (!$isseparategroups or has_capability('moodle/site:accessallgroups', $context))) { /// Display info about the group @@ -369,7 +384,7 @@ $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); @@ -567,15 +582,16 @@ echo '
'; echo ''; 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 '
'; } else if (count($rolenames) == 1) { @@ -663,7 +679,7 @@ echo '
'.get_string('firstname').' : '; if(!empty($firstinitial)) { - echo ''.$strall.''; + echo ''.$strall.''; } else { echo ''.$strall.''; } @@ -671,7 +687,7 @@ if ($letter == $firstinitial) { echo ' '.$letter.''; } else { - echo ' '.$letter.''; + echo ' '.$letter.''; } } echo '
'; @@ -680,7 +696,7 @@ echo '
'.get_string('lastname').' : '; if(!empty($lastinitial)) { - echo ''.$strall.''; + echo ''.$strall.''; } else { echo ''.$strall.''; } @@ -688,7 +704,7 @@ if ($letter == $lastinitial) { echo ' '.$letter.''; } else { - echo ' '.$letter.''; + echo ' '.$letter.''; } } echo '
'; @@ -808,7 +824,7 @@ $row->cells[2]->text .= '
'; } $table->data = array($row); - echo $OUTPUT->print_table($table); + echo $OUTPUT->table($table); } } else { @@ -975,12 +991,15 @@ echo ' '."\n"; } - $perpageurl = preg_replace('/&perpage=\d*/','', $baseurl); + $perpageurl = clone($baseurl); + $perpageurl->remove_params('perpage'); if ($perpage == SHOW_ALL_PAGE_SIZE) { - echo '
'.get_string('showperpage', '', DEFAULT_PAGE_SIZE).'
'; + $perpageurl->param('perpage', DEFAULT_PAGE_SIZE); + echo '
'.get_string('showperpage', '', DEFAULT_PAGE_SIZE).'
'; } else if ($matchcount > 0 && $perpage < $matchcount) { - echo '
'.get_string('showall', '', $matchcount).'
'; + $perpageurl->param('perpage', SHOW_ALL_PAGE_SIZE); + echo '
'.get_string('showall', '', $matchcount).'
'; } echo $OUTPUT->footer(); diff --git a/user/profile/index.php b/user/profile/index.php index b27670db62..2eb6283243 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -139,7 +139,8 @@ echo '
'; /// Create a new field link $options = profile_list_datatypes(); -popup_form($CFG->wwwroot.'/user/profile/index.php?id=0&action=editfield&datatype=', $options, 'newfieldform','','choose','','',false,'self',$strcreatefield); +$popupurl = $CFG->wwwroot.'/user/profile/index.php?id=0&action=editfield'; +echo $OUTPUT->select(moodle_select::make_popup_form($popupurl, 'datatype', $options, 'newfieldform', $strcreatefield)); /// Create a new category link $options = array('action'=>'editcategory');