]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19794 Converted calls to popup_form()
authornicolasconnault <nicolasconnault>
Mon, 10 Aug 2009 03:35:14 +0000 (03:35 +0000)
committernicolasconnault <nicolasconnault>
Mon, 10 Aug 2009 03:35:14 +0000 (03:35 +0000)
course/category.php
course/format/topics/format.php
course/format/weeks/format.php
course/index.php
course/lib.php
course/report/stats/lib.php

index bced679cd7b4520faafbf94ab410403329f1b521..1fabef65a4735d21d73c36dcb997caddc5a11cfd 100644 (file)
     make_categories_list($displaylist, $notused);
 
     echo '<div class="categorypicker">';
-    $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 '</div>';
 
index 54b93f25f382abe2168bed69c2bd3c218ff44199..496fde2e03de9526fa76e02042baa2715d0818ee 100644 (file)
     $timenow = time();
     $section = 1;
     $sectionmenu = array();
-    
-    $popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id.'&topic=';
 
     while ($section <= $course->numsections) {
 
                } else {
                    $strsummary = ' - '.substr($strsummary, 0, 60).'...';
                }
-                $sectionmenu[$popupurl.$section] = s($section.$strsummary);
+                $sectionmenu[$section] = s($section.$strsummary);
             }
             $section++;
             continue;
 
     if (!empty($sectionmenu)) {
         echo '<div class="jumpmenu">';
-        $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 '</div>';
index cdecf5d39d1ea0e06d66b1d3aa72b206a2eecabb..23b5a1893f53b8100b154c3f7c3ec32081ce6127 100644 (file)
     $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) {
 
         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;
 
     if (!empty($sectionmenu)) {
         echo '<div class="jumpmenu">';
-        $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 '</div>';
index b064d30acada522f94863a2dc3f00e164c2a8eff..cb2c0ffde4631ddd7ac5d6521fc3960e4deb4ff2 100644 (file)
@@ -330,18 +330,16 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
         echo '<td align="left">';
         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 '</td>';
         echo '</tr>';
index c9326bbf504dd8433b07cc7b1da57d15b4bf490e..40280a4bb8110418ba97c24bb75929e47e2c561a 100644 (file)
@@ -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&section=$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 .= '<div class="horizontal">';
     }
-    
+
+    $popupurl = "$CFG->wwwroot/course/mod.php?id=$course->id&section=$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);
index a3c38f164f7bcba852f6f68bca39d70096ee1aac..28fc7b53be47ee147c84f45f489dca242a9c722a 100644 (file)
         */
 
         $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);
     }