]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19799 Upgraded calls to choose_from_menu
authornicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 00:18:19 +0000 (00:18 +0000)
committernicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 00:18:19 +0000 (00:18 +0000)
lib/deprecatedlib.php
lib/outputcomponents.php
lib/tablelib.php
lib/weblib.php
message/lib.php

index a4d4764f5ced0fdc313435c7d0619c4f480ecfba..780421e3284cd6e37528c9ceb331b8f257cf0df7 100644 (file)
@@ -3027,7 +3027,7 @@ function choose_from_menu ($options, $name, $selected='', $nothing='choose', $sc
                            $id='', $listbox=false, $multiple=false, $class='') {
 
     global $OUTPUT;
-    // debugging('choose_from_menu() has been deprecated. Please change your code to use $OUTPUT->select($select).');
+    debugging('choose_from_menu() has been deprecated. Please change your code to use $OUTPUT->select($select).');
 
     if ($script) {
         debugging('The $script parameter has been deprecated. You must use component_actions instead', DEBUG_DEVELOPER);
index 95f64dba03daf1f90ae76d837f12dd05402d56d5..2a9364fceb7ac6b27462451f1d12f8398f2ff68b 100644 (file)
@@ -414,9 +414,10 @@ class html_select extends labelled_html_component {
      * @param array $options used to initialise {@link $options}.
      * @param string $name used to initialise {@link $name}.
      * @param string $selected  used to initialise {@link $selected}.
+     * @param string $nothinglabel The label for the 'nothing is selected' option. Defaults to "Choose..."
      * @return html_select A html_select object with the three common fields initialised.
      */
-    public static function make($options, $name, $selected = '') {
+    public static function make($options, $name, $selected = '', $nothinglabel='choosedots') {
         $menu = new html_select();
         $menu->options = $options;
         $menu->name = $name;
index e6c6d27250cd8fb5750e83624d414b1a8a505699..68079c1225b3221ed78dbe449db089713c8abbd1 100644 (file)
@@ -911,12 +911,15 @@ class flexible_table {
      * This function is not part of the public api.
      */
     function download_buttons(){
+        global $OUTPUT;
         if ($this->is_downloadable() && !$this->is_downloading()){
             $downloadoptions = $this->get_download_menu();
             $html = '<form action="'. $this->baseurl .'" method="post">';
             $html .= '<div class="mdl-align">';
             $html .= '<input type="submit" value="'.get_string('downloadas', 'table').'"/>';
-            $html .= choose_from_menu ($downloadoptions, 'download', $this->defaultdownloadformat, '', '', '', true);
+            $select = html_select::make($downloadoptions, 'download', $this->defaultdownloadformat, false);
+            $select->nothingvalue = '';
+            $html .= $OUTPUT->select($select);
             $html .= helpbutton('tableexportformats', get_string('tableexportformats', 'table'), 'moodle', true, false, '', true);
             $html .= '</div></form>';
 
index 6d19a9daaed3597fe6dc31e52b3047589e3bf79c..38c774546877b6ebc93658eb9c77e16ed49abd0d 100644 (file)
@@ -2969,7 +2969,7 @@ function print_grade_menu($courseid, $name, $current, $includenograde=true, $ret
     for ($i=100; $i>=1; $i--) {
         $grades[$i] = $i;
     }
-    $output .= choose_from_menu($grades, $name, $current, '', '', 0, true);
+    $output .= $OUTPUT->select(html_select::make($grades, $name, $current, false));
 
     $linkobject = '<span class="helplink"><img class="iconhelp" alt="'.$strscales.'" src="'.$OUTPUT->old_icon_url('help') . '" /></span>';
     $output .= link_to_popup_window ('/course/scales.php?id='. $courseid .'&amp;list=true', 'ratingscales',
index d3dee92d0104de624a88a32e2686f86f2d4b9b84..f401f23fd19f4cbb38440f5038592fed348e8d3e 100644 (file)
@@ -204,7 +204,7 @@ function message_print_search() {
 }
 
 function message_print_settings() {
-    global $USER;
+    global $USER, $OUTPUT;
 
     if ($frm = data_submitted() and confirm_sesskey()) {
 
@@ -232,11 +232,10 @@ function message_print_settings() {
     $cbemailmessages = (get_user_preferences('message_emailmessages', 1) == '1') ? 'checked="checked"' : '';
     $txemailaddress = get_user_preferences('message_emailaddress', $USER->email);
     $txemailtimenosee = get_user_preferences('message_emailtimenosee', 10);
-    $format_select = choose_from_menu( array(FORMAT_PLAIN => get_string('formatplain'),
+    $format_select = $OUTPUT->select(html_select::make( array(FORMAT_PLAIN => get_string('formatplain'),
                                              FORMAT_HTML  => get_string('formathtml')),
                                        'emailformat',
-                                       get_user_preferences('message_emailformat', FORMAT_PLAIN),
-                                       false, '', '0', true );
+                                       get_user_preferences('message_emailformat', FORMAT_PLAIN)));
 
     include('settings.html');
 }