From: Petr Skoda Date: Sun, 3 Jan 2010 21:10:49 +0000 (+0000) Subject: MDL-21231 fixed recent regression, thanks penny for the report X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5acf9cd3abc65d2e247ec8ee26b608e8bb1e0d90;p=moodle.git MDL-21231 fixed recent regression, thanks penny for the report --- diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 2099790fc4..6c94462de0 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -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);