From: nicolasconnault Date: Mon, 17 Aug 2009 15:15:20 +0000 (+0000) Subject: MDL-19787 Upgraded calls to choose_from_menu X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b324b47e364523b841ba277c214ee2ed7412f1bd;p=moodle.git MDL-19787 Upgraded calls to choose_from_menu --- diff --git a/admin/auth_config.php b/admin/auth_config.php index 57cad02b93..4b1d9dea57 100644 --- a/admin/auth_config.php +++ b/admin/auth_config.php @@ -86,7 +86,7 @@ exit; // other options // Note: lockconfig_ fields have special handling. function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) { - + global $OUTPUT; echo ''; if ($retrieveopts) { echo $OUTPUT->heading(get_string('auth_data_mapping', 'auth')); @@ -147,23 +147,23 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, echo "$varname}\" />"; echo '
'; echo ' '; - choose_from_menu($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, ""); + echo $OUTPUT->select(html_select::make($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, false)); echo '
'; if ($updateopts) { echo ' '; - choose_from_menu($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, ""); + echo $OUTPUT->select(html_select::make($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, false)); echo '
'; } echo ' '; - choose_from_menu($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, ""); + echo $OUTPUT->select(html_select::make($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false)); echo '
'; } else { echo ''; echo ''; echo ''; - choose_from_menu($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, ""); + echo $OUTPUT->select(html_select::make($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false)); } echo ''; if (!empty($helptext)) { diff --git a/admin/enrol.php b/admin/enrol.php index ee8b9e5aac..3c20d6c361 100644 --- a/admin/enrol.php +++ b/admin/enrol.php @@ -125,7 +125,7 @@ echo 'sendcoursewelcomemessage'; echo ''; echo '
'; - choose_from_menu($yesnooptions, 'sendcoursewelcomemessage', $CFG->sendcoursewelcomemessage, ''); + echo $OUTPUT->select(html_select::make($yesnooptions, 'sendcoursewelcomemessage', $CFG->sendcoursewelcomemessage, false)); echo '
'.get_string('defaultsettinginfo', 'admin', get_string('yes')).'
'; echo '
' . get_string('configsendcoursewelcomemessage', 'admin') . '
'; echo ''; diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php index 34799f2b93..242e0a79a0 100644 --- a/admin/mnet/access_control.php +++ b/admin/mnet/access_control.php @@ -213,7 +213,7 @@ echo " " . get_string('remotehost', 'mnet') . ":\n"; if (!empty($formerror['mnet_host_id'])) { echo ' * '; } -choose_from_menu($mnethosts, 'mnet_host_id'); +echo $OUTPUT->select(html_select::make($mnethosts, 'mnet_host_id')); // choose an access level echo " " . get_string('accesslevel', 'mnet') . ":\n"; @@ -222,7 +222,7 @@ if (!empty($formerror['accessctrl'])) { } $accessmenu['allow'] = get_string('allow', 'mnet'); $accessmenu['deny'] = get_string('deny', 'mnet'); -choose_from_menu($accessmenu, 'accessctrl'); +echo $OUTPUT->select(html_select::make($accessmenu, 'accessctrl')); // submit button echo ''; diff --git a/admin/register.php b/admin/register.php index ba93a2f7ab..a712d37552 100644 --- a/admin/register.php +++ b/admin/register.php @@ -78,7 +78,9 @@ echo '
'; echo '
'; echo '
'; - choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", ""); + $select = html_select::make(get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."..."); + $select->nothingvalue = ''; + echo $OUTPUT->select($select); echo '
'; echo '
'; @@ -88,7 +90,9 @@ $options[0] = get_string("publicdirectory0"); $options[1] = get_string("publicdirectory1"); $options[2] = get_string("publicdirectory2"); - choose_from_menu ($options, "public", "2", "", "", ""); + $select = html_select::make($options, "public", "2", false); + $select->nothingvalue = ''; + echo $OUTPUT->select($select); unset($options); echo ''; echo ''; @@ -98,7 +102,9 @@ echo '
'; $options[0] = get_string("registrationcontactno"); $options[1] = get_string("registrationcontactyes"); - choose_from_menu ($options, "contact", "1", "", "", ""); + $select = html_select::make($options, "contact", "1", false); + $select->nothingvalue = ''; + echo $OUTPUT->select($select); unset($options); echo '
'; echo ''; @@ -173,7 +179,9 @@ echo '
'; $options[0] = get_string("registrationno"); $options[1] = get_string("registrationyes"); - choose_from_menu ($options, "mailme", "1", "", "", ""); + $select = html_select::make($options, "mailme", "1", false); + $select->nothingvalue = ''; + echo $OUTPUT->select($select); unset($options); echo '
'; echo ''; diff --git a/admin/report/capability/index.php b/admin/report/capability/index.php index 0c2f33ca61..a4cc958a13 100644 --- a/admin/report/capability/index.php +++ b/admin/report/capability/index.php @@ -74,9 +74,18 @@ echo '
'; echo $OUTPUT->heading(get_string('reportsettings', 'report_capability')); echo '

', get_string('intro', 'report_capability') , '

'; echo '

'; -choose_from_menu($capabilitychoices, 'capability', $capability, 'choose', '', '', false, false, 0, '', true); +$select = html_select::make($capabilitychoices, 'capability', $capability); +$select->nothingvalue = ''; +$select->listbox = true; +$select->tabindex = 0; +echo $OUTPUT->select($select); echo '

'; -choose_from_menu($rolechoices, 'roles[]', $selectedroleids, '', '', '', false, false, 0, '', true, true); +$select = html_select::make($rolechoices, 'roles[]', $selectedroleids, false); +$select->nothingvalue = ''; +$select->listbox = true; +$select->multiple = true; +$select->tabindex = 0; +echo $OUTPUT->select($select); echo '

'; echo '
'; echo $OUTPUT->box_end(); diff --git a/admin/report/courseoverview/index.php b/admin/report/courseoverview/index.php index 1d54fba7b5..3c95477c57 100644 --- a/admin/report/courseoverview/index.php +++ b/admin/report/courseoverview/index.php @@ -50,8 +50,17 @@ $table->width = '*'; $table->align = array('left','left','left','left','left','left'); - $table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true), - get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true), + + $select = html_select::make($reportoptions,'report',$report, false); + $select->nothingvalue = ''; + $reporttypemenu = $OUTPUT->select($select); + + $select = html_select::make($timeoptions,'time',$time, false); + $select->nothingvalue = ''; + $timeoptionsmenu = $OUTPUT->select($select); + + $table->data[] = array(get_string('statsreporttype'),$reporttypemenu, + get_string('statstimeperiod'),$timeoptionsmenu, '', '') ; diff --git a/admin/report/questioninstances/index.php b/admin/report/questioninstances/index.php index 32ac9997b7..d097cbabc6 100644 --- a/admin/report/questioninstances/index.php +++ b/admin/report/questioninstances/index.php @@ -33,7 +33,9 @@ echo '
'; echo $OUTPUT->heading(get_string('reportsettings', 'report_questioninstances')); echo '

', get_string('intro', 'report_questioninstances') , '

'; echo '

'; -choose_from_menu($qtypechoices, 'qtype', $requestedqtype, get_string('all'), '', '_all_'); +$select = html_select::make($qtypechoices, 'qtype', $requestedqtype, get_string('all')); +$select->nothingvalue = '_all_'; +echo $OUTPUT->select($select); echo '

'; echo '

'; diff --git a/admin/roles/assign.php b/admin/roles/assign.php index c22c8f176b..e449c95a68 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -338,10 +338,10 @@


-

+ select(html_select::make($periodmenu, 'extendperiod', $defaultperiod, $unlimitedperiod)); ?>


-

+ select(html_select::make($basemenu, 'extendbase', $extendbase, false)); ?>

diff --git a/admin/roles/lib.php b/admin/roles/lib.php index 792be3633e..19740f25aa 100644 --- a/admin/roles/lib.php +++ b/admin/roles/lib.php @@ -630,12 +630,13 @@ class define_role_table_advanced extends capability_table_with_risks { } protected function get_legacy_type_field($id) { + global $OUTPUT; $options = array(); $options[''] = get_string('none'); foreach($this->legacyroles as $type => $cap) { $options[$type] = get_string('legacy:'.$type, 'role'); } - return choose_from_menu($options, 'legacytype', $this->role->legacytype, '', '', 0, true); + return $OUTPUT->select(html_select::make($options, 'legacytype', $this->role->legacytype, false)); } protected function get_assignable_levels_control() { @@ -1496,4 +1497,4 @@ function roles_get_potential_user_selector($context, $name, $options) { return $potentialuserselector; } -?> \ No newline at end of file +?> diff --git a/admin/timezone.php b/admin/timezone.php index 5b04706da2..57f68a2e72 100644 --- a/admin/timezone.php +++ b/admin/timezone.php @@ -39,7 +39,9 @@ echo '
'; echo "$strusers ($strall): "; - choose_from_menu ($timezones, "zone", $current, get_string("serverlocaltime"), "", "99"); + $select = html_select::make($timezones, "zone", $current, get_string("serverlocaltime")); + $select->nothingvalue ="99"; + echo $OUTPUT->select($select); echo ""; echo ''; echo "
"; diff --git a/admin/xmldb/actions/edit_field/edit_field.class.php b/admin/xmldb/actions/edit_field/edit_field.class.php index 24791b0d86..1711946239 100644 --- a/admin/xmldb/actions/edit_field/edit_field.class.php +++ b/admin/xmldb/actions/edit_field/edit_field.class.php @@ -62,7 +62,7 @@ class edit_field extends XMLDBAction { $this->does_generate = ACTION_GENERATE_HTML; /// These are always here - global $CFG, $XMLDB; + global $CFG, $XMLDB, $OUTPUT; /// Do the job, setting result as needed /// Get the dir containing the file @@ -143,8 +143,10 @@ class edit_field extends XMLDBAction { if ($field->getType() != XMLDB_TYPE_DATETIME) { unset ($typeoptions[XMLDB_TYPE_DATETIME]); } + $select = html_select::make($typeoptions, 'type', $field->getType(), false); + $select->nothingvalue = ''; $o.= ' '; - $o.= ' ' . choose_from_menu($typeoptions, 'type', $field->getType(), '', '', '', true) . ''; + $o.= ' ' . $OUTPUT->select($select) . ''; /// xmldb_field Length $o.= ' '; $o.= ' '; @@ -153,16 +155,22 @@ class edit_field extends XMLDBAction { $o.= ' '; /// xmldb_field Unsigned $unsignedoptions = array (0 => 'signed', 1 => 'unsigned'); + $select = html_select::make($unsignedoptions, 'unsigned', $field->getUnsigned(), false); + $select->nothingvalue = ''; $o.= ' '; - $o.= ' ' . choose_from_menu($unsignedoptions, 'unsigned', $field->getUnsigned(), '', '', '', true) . ''; + $o.= ' ' . $OUTPUT->select($select) . ''; /// xmldb_field NotNull $notnulloptions = array (0 => 'null', 'not null'); + $select = html_select::make($notnulloptions, 'notnull', $field->getNotNull(), false); + $select->nothingvalue = ''; $o.= ' '; - $o.= ' ' . choose_from_menu($notnulloptions, 'notnull', $field->getNotNull(), '', '', '', true) . ''; + $o.= ' ' . $OUTPUT->select($select) . ''; /// xmldb_field Sequence + $select = html_select::make($sequenceoptions, 'sequence', $field->getSequence(), false); + $select->nothingvalue = ''; $sequenceoptions = array (0 => $this->str['no'], 1 => 'auto-numbered'); $o.= ' '; - $o.= ' ' . choose_from_menu($sequenceoptions, 'sequence', $field->getSequence(), '', '', '', true) . ''; + $o.= ' ' . $OUTPUT->select($select) . ''; /// xmldb_field Default $o.= ' '; $o.= ' '; diff --git a/admin/xmldb/actions/edit_index/edit_index.class.php b/admin/xmldb/actions/edit_index/edit_index.class.php index 999765db5a..01f0d17a35 100644 --- a/admin/xmldb/actions/edit_index/edit_index.class.php +++ b/admin/xmldb/actions/edit_index/edit_index.class.php @@ -61,7 +61,7 @@ class edit_index extends XMLDBAction { $this->does_generate = ACTION_GENERATE_HTML; /// These are always here - global $CFG, $XMLDB; + global $CFG, $XMLDB, $OUTPUT; /// Do the job, setting result as needed /// Get the dir containing the file @@ -119,7 +119,9 @@ class edit_index extends XMLDBAction { $typeoptions = array (0 => 'not unique', 1 => 'unique'); $o.= ' '; - $o.= ' ' . choose_from_menu($typeoptions, 'unique', $index->getUnique(), '', '', '', true) . ''; + $select = html_select::make($typeoptions, 'unique', $index->getUnique(), false); + $select->nothingvalue = ''; + $o.= ' ' . $OUTPUT->select($select) . ''; /// xmldb_index Fields $o.= ' '; $o.= ' '; diff --git a/admin/xmldb/actions/edit_key/edit_key.class.php b/admin/xmldb/actions/edit_key/edit_key.class.php index c87ddaeb45..2e60c755f0 100644 --- a/admin/xmldb/actions/edit_key/edit_key.class.php +++ b/admin/xmldb/actions/edit_key/edit_key.class.php @@ -61,7 +61,7 @@ class edit_key extends XMLDBAction { $this->does_generate = ACTION_GENERATE_HTML; /// These are always here - global $CFG, $XMLDB; + global $CFG, $XMLDB, $OUTPUT; /// Do the job, setting result as needed /// Get the dir containing the file @@ -124,8 +124,11 @@ class edit_key extends XMLDBAction { /// if ($key->getType() != XMLDB_KEY_FOREIGN_UNIQUE) { /// unset ($typeoptions[XMLDB_KEY_FOREIGN_UNIQUE); /// } + $select = html_select::make($typeoptions, 'type', $key->getType(), false); + $select->nothingvalue = ''; + $o.= ' '; - $o.= ' ' . choose_from_menu($typeoptions, 'type', $key->getType(), '', '', '', true) . ''; + $o.= ' ' . $OUTPUT->select($select) . ''; /// xmldb_key Fields $o.= ' '; $o.= ' '; diff --git a/admin/xmldb/actions/new_statement/new_statement.class.php b/admin/xmldb/actions/new_statement/new_statement.class.php index 982d55e0a9..2cf683859c 100644 --- a/admin/xmldb/actions/new_statement/new_statement.class.php +++ b/admin/xmldb/actions/new_statement/new_statement.class.php @@ -60,7 +60,7 @@ class new_statement extends XMLDBAction { $this->does_generate = ACTION_GENERATE_HTML; /// These are always here - global $CFG, $XMLDB, $DB; + global $CFG, $XMLDB, $DB, $OUTPUT; /// Do the job, setting result as needed /// Get the dir containing the file @@ -103,7 +103,7 @@ class new_statement extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; - $o.= ' '; + $o.= ' '; $o.= ' '; $o.= ' '; $o.= '
' . choose_from_menu($typeoptions, 'type', '', 'choose', '', 0, true) . '' .choose_from_menu($selecttables, 'table', '', 'choose', '', 0, true) . '
' . $OUTPUT->select(html_select::make($typeoptions, 'type')) . '' .$OUTPUT->select(html_select::make($selecttables, 'table')) . '
[' . $this->str['back'] . ']
'; diff --git a/admin/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php b/admin/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php index ca25a8b3ee..79a69b0b94 100644 --- a/admin/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php +++ b/admin/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php @@ -60,7 +60,7 @@ class new_table_from_mysql extends XMLDBAction { $this->does_generate = ACTION_GENERATE_HTML; /// These are always here - global $CFG, $XMLDB, $DB; + global $CFG, $XMLDB, $DB, $OUTPUT; /// Do the job, setting result as needed /// Get the dir containing the file @@ -111,7 +111,7 @@ class new_table_from_mysql extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; - $o.= ' '; + $o.= ' '; $o.= ' '; $o.= ' '; $o.= '
' . choose_from_menu($selecttables, 'table', '', 'choose', '', 0, true) . '' .choose_from_menu($aftertables, 'after', '', 'choose', '', 0, true) . '
' . $OUTPUT->select(html_select::make($selecttables, 'table')) . '' .$OUTPUT->select(html_select::make($aftertables, 'after')) . '
[' . $this->str['back'] . ']
'; diff --git a/admin/xmldb/actions/view_structure_php/view_structure_php.class.php b/admin/xmldb/actions/view_structure_php/view_structure_php.class.php index e04e9ab64e..5f4c5b0af2 100644 --- a/admin/xmldb/actions/view_structure_php/view_structure_php.class.php +++ b/admin/xmldb/actions/view_structure_php/view_structure_php.class.php @@ -62,7 +62,7 @@ class view_structure_php extends XMLDBAction { $this->does_generate = ACTION_GENERATE_HTML; /// These are always here - global $CFG, $XMLDB; + global $CFG, $XMLDB, $OUTPUT; /// Do the job, setting result as needed /// Get the dir containing the file @@ -115,7 +115,7 @@ class view_structure_php extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; - $o.= ' '; + $o.= ' '; $o.= ' '; $o.= '
' . choose_from_menu($popcommands, 'command', $commandparam, '', '', 0, true) . ' ' .choose_from_menu($poptables, 'table', $tableparam, '', '', 0, true) . '
' . $OUTPUT->select(html_select::make($popcommands, 'command', $commandparam, false)) . ' ' .$OUTPUT->select(html_select::make($poptables, 'table', $tableparam, false)) . '
'; $o.= ''; diff --git a/admin/xmldb/actions/view_table_php/view_table_php.class.php b/admin/xmldb/actions/view_table_php/view_table_php.class.php index e519228805..b11a7c284d 100644 --- a/admin/xmldb/actions/view_table_php/view_table_php.class.php +++ b/admin/xmldb/actions/view_table_php/view_table_php.class.php @@ -68,7 +68,7 @@ class view_table_php extends XMLDBAction { $this->does_generate = ACTION_GENERATE_HTML; /// These are always here - global $CFG, $XMLDB; + global $CFG, $XMLDB, $OUTPUT; /// Do the job, setting result as needed /// Get the dir containing the file @@ -166,7 +166,7 @@ class view_table_php extends XMLDBAction { $o.= ' '; $o.= ' '; $o.= ' '; - $o.= ' '; + $o.= ' '; $o.= ' '; $o.= '
' . choose_from_menu($popcommands, 'command', $commandparam, '', '', 0, true) . ' ' .choose_from_menu($popfields, 'fieldkeyindex', $origfieldkeyindexparam, '', '', 0, true) . '
' . $OUTPUT->select(html_select::make($popcommands, 'command', $commandparam, false)) . ' ' .$OUTPUT->select(html_select::make($popfields, 'fieldkeyindex', $origfieldkeyindexparam, false)) . '
'; $o.= '';