MDL-20204 some more steps away from html_select
authorPetr Skoda <skodak@moodle.org>
Tue, 9 Feb 2010 19:50:11 +0000 (19:50 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 9 Feb 2010 19:50:11 +0000 (19:50 +0000)
admin/environment.php
admin/lang.php
calendar/set.php
calendar/view.php
course/format/topics/format.php
course/format/weeks/format.php

index 6e0873f..4c7222b 100644 (file)
     }
 
 /// Print form and popup menu
-    echo '<div style="text-align:center">'.$strmoodleversion.' ';
-    $select = html_select::make_popup_form("$CFG->wwwroot/$CFG->admin/environment.php", 'version', $versions, 'selectversion', $version);
-    $select->nothinglabel = false;
-    echo $OUTPUT->select($select);
+    echo '<div style="text-align:center"> ';
+    $select = new single_select(new moodle_url('/admin/environment.php'), 'version', $versions, $version, null);
+    $select->label = $strmoodleversion;
+    echo $OUTPUT->render($select);
     echo '</div>';
 
 /// End of main box
index f1d0468..8094586 100644 (file)
         echo $OUTPUT->box_start();
         $currlang = current_language();
         $langs = get_list_of_languages(false, true);
-        $select = html_select::make_popup_form("$CFG->wwwroot/$CFG->admin/lang.php", 'lang', $langs, "chooselang", $currlang);
-        $select->nothinglabel = false;
-        $select->set_label($strcurrentlanguage.':');
-        echo $OUTPUT->select($select);
+        $select = new single_select(new moodle_url('/admin/lang.php'), 'lang', $langs, $currlang, null);
+        $select->label = $strcurrentlanguage.':';
+        $select->formid = 'chooselang';
+        echo $OUTPUT->render($select);
         echo $OUTPUT->box_end();
         echo $OUTPUT->footer();
         exit;
         //$selectionlabel .= $strfilestoredin;
         $selectionlabel .= $uselocal ? "{$currentlang}_local" : $currentlang;
         $selectionlabel .= '/</code>';
-        $select = html_select::make_popup_form("$CFG->wwwroot/$CFG->admin/lang.php?mode=compare", 'currentfile', $menufiles, "choosefile", $currentfile);
-        $select->nothinglabel = $strchoosefiletoedit;
-        $select->set_label($selectionlabel);
-        echo $OUTPUT->select($select);
+        $select = new single_select(new moodle_url('/admin/lang.php?mode=compare'), 'currentfile', $menufiles, $currentfile, array(''=>$strchoosefiletoedit));
+        $select->label = $selectionlabel;
+        $select->formid = 'choosefile';
+        echo $OUTPUT->render($select);
         echo $OUTPUT->help_icon('langswitchstorage', $strfilestoredinhelp);
         echo $OUTPUT->box_end();
 
         //$selectionlabel .= $strfilestoredin;
         $selectionlabel .= $uselocal ? "{$currentlang}_local" : $currentlang;
         $selectionlabel .= '/help/</code>';
-        $select = html_select::make_popup_form("$CFG->wwwroot/$CFG->admin/lang.php?mode=helpfiles", 'currentfile', $menufiles, "choosefile", $currentfile);
-        $select->nothinglabel = $strchoosefiletoedit;
-        $select->set_label($selectionlabel);
-        echo $OUTPUT->select($select);
+        $select = new single_select(new moodle_url('/admin/lang.php?mode=helpfiles'), 'currentfile', $menufiles, $currentfile, array(''=>$strchoosefiletoedit));
+        $select->label = $selectionlabel;
+        $select->formid = 'choosefile';
+        echo $OUTPUT->render($select);
         echo $OUTPUT->help_icon('langswitchstorage', $strfilestoredinhelp);
         echo $OUTPUT->box_end();
 
index b0342bc..3a46d57 100644 (file)
@@ -78,7 +78,7 @@ calendar_session_vars();
 // Required due to changes in view/lib.php mainly (calendar_session_vars())
 $courseid = '';
 if (!empty($id)) {
-    $courseid = '&amp;course='.$id;
+    $courseid = '&course='.$id;
 }
 
 switch($var) {
index 6361a0b..76d2b6f 100644 (file)
@@ -642,6 +642,7 @@ function calendar_course_filter_selector($getvars = '') {
 
     unset($courses[SITEID]);
 
+    $courseoptions = array();
     $courseoptions[SITEID] = get_string('fulllistofcourses');
     foreach ($courses as $course) {
         $courseoptions[$course->id] = format_string($course->shortname);
@@ -652,7 +653,7 @@ function calendar_course_filter_selector($getvars = '') {
     } else {
         $selected = '';
     }
-    $select = html_select::make_popup_form(CALENDAR_URL.'set.php?var=setcourse&'.$getvars, 'id', $courseoptions, 'cal_courses_flt', $selected);
-    $select->nothinglabel = false;
-    return $OUTPUT->select($select);
+    $select = new single_select(new moodle_url(CALENDAR_URL.'set.php?var=setcourse&'.$getvars), 'id', $courseoptions, $selected, null);
+    $select->class = 'cal_courses_flt';
+    echo $OUTPUT->render($select);
 }
index d3eb1ab..28de119 100644 (file)
@@ -254,10 +254,9 @@ while ($section <= $course->numsections) {
 echo "</ul>\n";
 
 if (!empty($sectionmenu)) {
-    echo '<div class="jumpmenu">';
-    $popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id;
-    $select = html_select::make_popup_form($popupurl, 'topic', $sectionmenu, 'sectionmenu');
-    $select->set_label(get_string('jumpto'));
-    echo $OUTPUT->select($select);
-    echo '</div>';
+    $select = new single_select(new moodle_url('/course/view.php', array('id'=>$course->id)), 'topic', $sectionmenu);
+    $select->label = get_string('jumpto');
+    $select->class = 'jumpmenu';
+    $select->formid = 'sectionmenu';
+    echo $OUTPUT->render($select);
 }
index 55f387b..1e863d4 100644 (file)
     echo "</ul>\n";
 
     if (!empty($sectionmenu)) {
-        echo '<div class="jumpmenu">';
-        $popupurl = $CFG->wwwroot.'/course/view.php?id='.$course->id;
-        $select = html_select::make_popup_form($popupurl, 'week', $sectionmenu, 'sectionmenu');
-        $select->set_label(get_string('jumpto'));
-        echo $OUTPUT->select($select);
-        echo '</div>';
+        $select = new single_select(new moodle_url('/course/view.php', array('id'=>$course->id)), 'week', $sectionmenu);
+        $select->label = get_string('jumpto');
+        $select->class = 'jumpmenu';
+        $select->formid = 'sectionmenu';
+        echo $OUTPUT->render($select);
     }