From 82fcab32c1cff2c392bfbf70019449ccb5e75ffe Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Mon, 10 Aug 2009 03:35:14 +0000 Subject: [PATCH] MDL-19794 Converted calls to popup_form() --- course/category.php | 8 ++------ course/format/topics/format.php | 7 +++---- course/format/weeks/format.php | 7 +++---- course/index.php | 10 ++++------ course/lib.php | 16 ++++++++-------- course/report/stats/lib.php | 12 +++++++----- 6 files changed, 27 insertions(+), 33 deletions(-) diff --git a/course/category.php b/course/category.php index bced679cd7..1fabef65a4 100644 --- a/course/category.php +++ b/course/category.php @@ -171,13 +171,9 @@ make_categories_list($displaylist, $notused); echo '
'; - $popupurl = 'category.php?id='; - foreach ($displaylist as $key => $val) { - $displaylist[$popupurl.$key] = $val; - unset($displaylist[$key]); - } - $select = moodle_select::make_popup_form($displaylist, 'switchcategory', $popupurl.$category->id); + $select = moodle_select::make_popup_form('category.php', 'id', $displaylist, 'switchcategory', $category->id); $select->set_label($strcategories.':'); + $select->nothinglabel = false; echo $OUTPUT->select($select); echo '
'; diff --git a/course/format/topics/format.php b/course/format/topics/format.php index 54b93f25f3..496fde2e03 100644 --- a/course/format/topics/format.php +++ b/course/format/topics/format.php @@ -130,8 +130,6 @@ $timenow = time(); $section = 1; $sectionmenu = array(); - - $popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id.'&topic='; while ($section <= $course->numsections) { @@ -157,7 +155,7 @@ } else { $strsummary = ' - '.substr($strsummary, 0, 60).'...'; } - $sectionmenu[$popupurl.$section] = s($section.$strsummary); + $sectionmenu[$section] = s($section.$strsummary); } $section++; continue; @@ -254,7 +252,8 @@ if (!empty($sectionmenu)) { echo '
'; - $select = moodle_select::make_popup_form($sectionmenu, 'sectionmenu'); + $popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id; + $select = moodle_select::make_popup_form($popupurl, 'topic', $sectionmenu, 'sectionmenu'); $select->set_label(get_string('jumpto')); echo $OUTPUT->select($select); echo '
'; diff --git a/course/format/weeks/format.php b/course/format/weeks/format.php index cdecf5d39d..23b5a1893f 100644 --- a/course/format/weeks/format.php +++ b/course/format/weeks/format.php @@ -126,8 +126,6 @@ $weekofseconds = 604800; $course->enddate = $course->startdate + ($weekofseconds * $course->numsections); - $popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id.'&week='; - $strftimedateshort = ' '.get_string('strftimedateshort'); while ($weekdate < $course->enddate) { @@ -152,7 +150,7 @@ if (!empty($displaysection) and $displaysection != $section) { // Check this week is visible if ($showsection) { - $sectionmenu[$popupurl.$section] = s("$strweek $section | $weekday - $endweekday"); + $sectionmenu[$section] = s("$strweek $section | $weekday - $endweekday"); } $section++; $weekdate = $nextweekdate; @@ -246,7 +244,8 @@ if (!empty($sectionmenu)) { echo '
'; - $select = moodle_select::make_popup_form($sectionmenu, 'sectionmenu'); + $popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id; + $select = moodle_select::make_popup_form($popupurl, 'week', $sectionmenu, 'sectionmenu'); $select->set_label(get_string('jumpto')); echo $OUTPUT->select($select); echo '
'; diff --git a/course/index.php b/course/index.php index b064d30aca..cb2c0ffde4 100644 --- a/course/index.php +++ b/course/index.php @@ -330,18 +330,16 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $ echo ''; if (has_capability('moodle/category:manage', $category->context)) { $tempdisplaylist = $displaylist; - $popupurl = "index.php?move=$category->id&sesskey=".sesskey()."&moveto="; unset($tempdisplaylist[$category->id]); foreach ($parentslist as $key => $parents) { if (in_array($category->id, $parents)) { unset($tempdisplaylist[$key]); } } - foreach ($tempdisplaylist as $key => $val) { - $tempdisplaylist[$popupurl.$key] = $val; - unset($tempdisplaylist[$key]); - } - echo $OUTPUT->select(moodle_select::make_popup_form($tempdisplaylist, "moveform$category->id", $popupurl.$category->parent)); + $popupurl = "index.php?move=$category->id&sesskey=".sesskey(); + $select = moodle_select::make_popup_form($popupurl, 'moveto', $tempdisplaylist, "moveform$category->id", $category->parent); + $select->nothinglabel = false; + echo $OUTPUT->select($select); } echo ''; echo ''; diff --git a/course/lib.php b/course/lib.php index c9326bbf50..40280a4bb8 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1556,8 +1556,6 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false, static $resources = false; static $activities = false; - $popupurl = "$CFG->wwwroot/course/mod.php?id=$course->id§ion=$section&sesskey=".sesskey()."&add="; - if ($resources === false) { $resources = array(); $activities = array(); @@ -1583,14 +1581,14 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false, continue; } if ($type->modclass == MOD_CLASS_RESOURCE) { - $resources[$popupurl.$type->type] = $type->typestr; + $resources[$type->type] = $type->typestr; } else { - $activities[$popupurl.$type->type] = $type->typestr; + $activities[$type->type] = $type->typestr; } } } else { // all mods without type are considered activity - $activities[$popupurl.$modname] = $modnamestr; + $activities[$modname] = $modnamestr; } } } @@ -1603,16 +1601,18 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false, if (!$vertical) { $output .= '
'; } - + + $popupurl = "$CFG->wwwroot/course/mod.php?id=$course->id§ion=$section&sesskey=".sesskey(); + if (!empty($resources)) { - $select = moodle_select::make_popup_form($resources, "ressection$section", null); + $select = moodle_select::make_popup_form($popupurl, 'add', $resources, "ressection$section", null); $select->nothinglabel = $straddresource; $select->set_help_icon('resource/types', $straddresource); $output .= $OUTPUT->select($select); } if (!empty($activities)) { - $select = moodle_select::make_popup_form($activities, "section$section", null); + $select = moodle_select::make_popup_form($popupurl, 'add', $activities, "section$section", null); $select->nothinglabel = $straddactivity; $select->set_help_icon('mods', $straddactivity); $output .= $OUTPUT->select($select); diff --git a/course/report/stats/lib.php b/course/report/stats/lib.php index a3c38f164f..28fc7b53be 100644 --- a/course/report/stats/lib.php +++ b/course/report/stats/lib.php @@ -18,13 +18,15 @@ */ $options = array(); - $popupurl = $url."?course=$course->id&time=$time&mode="; - $options[$popupurl.STATS_MODE_GENERAL] = get_string('statsmodegeneral'); - $options[$popupurl.STATS_MODE_DETAILED] = get_string('statsmodedetailed'); + $options[STATS_MODE_GENERAL] = get_string('statsmodegeneral'); + $options[STATS_MODE_DETAILED] = get_string('statsmodedetailed'); if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) { - $options[$popupurl.STATS_MODE_RANKED] = get_string('reports'); + $options[STATS_MODE_RANKED] = get_string('reports'); } - return $OUTPUT->select(moodle_select::make_popup_form($options, 'switchmode', $popupurl.$mode)); + $popupurl = $url."?course=$course->id&time=$time"; + $select = moodle_select::make_popup_form($popupurl, 'mode', $options, 'switchmode', $mode); + $select->nothinglabel = false; + return $OUTPUT->select($select); } -- 2.39.5