MDL-21231 fixed recent regression, thanks penny for the report

This commit is contained in:
Petr Skoda
2010-01-03 21:10:49 +00:00
parent 8a13809318
commit 5acf9cd3ab
+7 -2
View File
@@ -585,6 +585,11 @@ class html_select extends labelled_html_component {
* @return void
*/
public function override_option_values($options) {
// TODO: this is ugly hack because components shoudl never touch global $PAGE with the exception in prepare(),
// in any case this methods needs to be revisited because it does not make much sense to use the same $menu in
// html_select::make_popup_form() and then again in this method!
global $PAGE; //TODO: remove
$originalcount = count($options);
$this->initialise_options();
$newcount = count($this->options);
@@ -600,7 +605,7 @@ class html_select extends labelled_html_component {
$optionurl = new moodle_url(key($options));
if ($optionurl->compare($page->url, URL_MATCH_PARAMS)) {
if ($optionurl->compare($PAGE->url, URL_MATCH_PARAMS)) {
$this->options[$optkey]->options[$key]->selected = 'selected';
}
}
@@ -609,7 +614,7 @@ class html_select extends labelled_html_component {
$this->options[$optkey]->value = key($options);
$optionurl = new moodle_url(key($options));
if ($optionurl->compare($page->url, URL_MATCH_PARAMS)) {
if ($optionurl->compare($PAGE->url, URL_MATCH_PARAMS)) {
$this->options[$optkey]->selected = 'selected';
}
next($options);