From 54b166924609b3451fa9f706540c9bd70f80350c Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 18 Aug 2009 00:18:19 +0000 Subject: [PATCH] MDL-19799 Upgraded calls to choose_from_menu --- lib/deprecatedlib.php | 2 +- lib/outputcomponents.php | 3 ++- lib/tablelib.php | 5 ++++- lib/weblib.php | 2 +- message/lib.php | 7 +++---- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index a4d4764f5c..780421e328 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -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); diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 95f64dba03..2a9364fceb 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -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; diff --git a/lib/tablelib.php b/lib/tablelib.php index e6c6d27250..68079c1225 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -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 = '
'; $html .= '
'; $html .= ''; - $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 .= '
'; diff --git a/lib/weblib.php b/lib/weblib.php index 6d19a9daae..38c7745468 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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 = ''.$strscales.''; $output .= link_to_popup_window ('/course/scales.php?id='. $courseid .'&list=true', 'ratingscales', diff --git a/message/lib.php b/message/lib.php index d3dee92d01..f401f23fd1 100644 --- a/message/lib.php +++ b/message/lib.php @@ -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'); } -- 2.39.5