]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19794 Converting calls to popup_form()
authornicolasconnault <nicolasconnault>
Sat, 8 Aug 2009 09:31:01 +0000 (09:31 +0000)
committernicolasconnault <nicolasconnault>
Sat, 8 Aug 2009 09:31:01 +0000 (09:31 +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 7f1f1ad8d828c18bb33b7b1ca90e79b413cfdd17..bced679cd7b4520faafbf94ab410403329f1b521 100644 (file)
     make_categories_list($displaylist, $notused);
 
     echo '<div class="categorypicker">';
-    popup_form('category.php?id=', $displaylist, 'switchcategory', $category->id, '', '', '', false, 'self', $strcategories.':');
+    $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->set_label($strcategories.':');
+    echo $OUTPUT->select($select);
     echo '</div>';
 
 /// Print current category description
index 36efe2551e114c0af9df6dd06bfa04b6f85e440e..54b93f25f382abe2168bed69c2bd3c218ff44199 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[$section] = s($section.$strsummary);
+                $sectionmenu[$popupurl.$section] = s($section.$strsummary);
             }
             $section++;
             continue;
 
     if (!empty($sectionmenu)) {
         echo '<div class="jumpmenu">';
-        echo popup_form($CFG->wwwroot.'/course/view.php?id='.$course->id.'&amp;topic=', $sectionmenu,
-                   'sectionmenu', '', get_string('jumpto'), '', '', true);
+        $select = moodle_select::make_popup_form($sectionmenu, 'sectionmenu');
+        $select->set_label(get_string('jumpto'));
+        echo $OUTPUT->select($select);
         echo '</div>';
     }
index d75ef476af0122d95a50e19934a9fc986c586edc..cdecf5d39d1ea0e06d66b1d3aa72b206a2eecabb 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[$section] = s("$strweek $section |     $weekday - $endweekday");
+                $sectionmenu[$popupurl.$section] = s("$strweek $section |     $weekday - $endweekday");
             }
             $section++;
             $weekdate = $nextweekdate;
 
     if (!empty($sectionmenu)) {
         echo '<div class="jumpmenu">';
-        echo popup_form($CFG->wwwroot.'/course/view.php?id='.$course->id.'&amp;week=', $sectionmenu,
-                   'sectionmenu', '', get_string('jumpto'), '', '', true);
+        $select = moodle_select::make_popup_form($sectionmenu, 'sectionmenu');
+        $select->set_label(get_string('jumpto'));
+        echo $OUTPUT->select($select);
         echo '</div>';
     }
index 9c6ca4695a6625abd02dcf3292044f77aa5c01b9..b064d30acada522f94863a2dc3f00e164c2a8eff 100644 (file)
@@ -330,13 +330,18 @@ 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]);
                 }
             }
-            popup_form ("index.php?move=$category->id&amp;sesskey=".sesskey()."&amp;moveto=", $tempdisplaylist, "moveform$category->id", $category->parent, '', '', '', false);
+            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));
         }
         echo '</td>';
         echo '</tr>';
index e388f61fc4e3be3fb47ea3720bcac074dccd8319..c9326bbf504dd8433b07cc7b1da57d15b4bf490e 100644 (file)
@@ -1546,7 +1546,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
  * Prints the menus to add activities and resources.
  */
 function print_section_add_menus($course, $section, $modnames, $vertical=false, $return=false) {
-    global $CFG;
+    global $CFG, $OUTPUT;
 
     // check to see if user can add menus
     if (!has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))) {
@@ -1556,6 +1556,8 @@ 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();
@@ -1573,20 +1575,22 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
             $gettypesfunc =  $modname.'_get_types';
             if (function_exists($gettypesfunc)) {
                 $types = $gettypesfunc();
+
                 foreach($types as $type) {
+                    $type->type = str_replace('&amp;', '&', $type->type);
                     if (!isset($type->modclass) or !isset($type->typestr)) {
                         debugging('Incorrect activity type in '.$modname);
                         continue;
                     }
                     if ($type->modclass == MOD_CLASS_RESOURCE) {
-                        $resources[$type->type] = $type->typestr;
+                        $resources[$popupurl.$type->type] = $type->typestr;
                     } else {
-                        $activities[$type->type] = $type->typestr;
+                        $activities[$popupurl.$type->type] = $type->typestr;
                     }
                 }
             } else {
                 // all mods without type are considered activity
-                $activities[$modname] = $modnamestr;
+                $activities[$popupurl.$modname] = $modnamestr;
             }
         }
     }
@@ -1599,16 +1603,19 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
     if (!$vertical) {
         $output .= '<div class="horizontal">';
     }
-
+    
     if (!empty($resources)) {
-        $output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&sesskey=".sesskey()."&add=",
-                              $resources, "ressection$section", "", $straddresource, 'resource/types', $straddresource, true);
+        $select = moodle_select::make_popup_form($resources, "ressection$section", null);
+        $select->nothinglabel = $straddresource;
+        $select->set_help_icon('resource/types', $straddresource); 
+        $output .= $OUTPUT->select($select);
     }
 
     if (!empty($activities)) {
-        $output .= ' ';
-        $output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&sesskey=".sesskey()."&add=",
-                    $activities, "section$section", "", $straddactivity, 'mods', $straddactivity, true);
+        $select = moodle_select::make_popup_form($activities, "section$section", null);
+        $select->nothinglabel = $straddactivity;
+        $select->set_help_icon('mods', $straddactivity); 
+        $output .= $OUTPUT->select($select);
     }
 
     if (!$vertical) {
index 237ea02bc2c5f94e6cc57799d2f38ccbb6936180..a3c38f164f7bcba852f6f68bca39d70096ee1aac 100644 (file)
@@ -8,7 +8,7 @@
 
 
     function report_stats_mode_menu($course, $mode, $time, $url) {
-        global $CFG;
+        global $CFG, $OUTPUT;
         /*        
         $reportoptions = stats_get_report_options($course->id, $mode);
         $timeoptions = report_stats_timeoptions($mode);
         */
 
         $options = array();
-        $options[STATS_MODE_GENERAL] = get_string('statsmodegeneral');
-        $options[STATS_MODE_DETAILED] = get_string('statsmodedetailed');
+        $popupurl = $url."?course=$course->id&time=$time&mode=";
+        $options[$popupurl.STATS_MODE_GENERAL] = get_string('statsmodegeneral');
+        $options[$popupurl.STATS_MODE_DETAILED] = get_string('statsmodedetailed');
         if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) {
-            $options[STATS_MODE_RANKED] = get_string('reports');
+            $options[$popupurl.STATS_MODE_RANKED] = get_string('reports');
         }
-        
-        return popup_form($url."?course=$course->id&amp;time=$time&amp;mode=", $options, 'switchmode', $mode, '', '', '', true);
+        return $OUTPUT->select(moodle_select::make_popup_form($options, 'switchmode', $popupurl.$mode));
     }