From: David Mudrak Date: Wed, 23 Dec 2009 16:54:39 +0000 (+0000) Subject: MDL-21178 formslib element modgrade does not use deprecated link_to_popup_window... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0ea95ddcb71d82e6caab7d967f6406c321ff0340;p=moodle.git MDL-21178 formslib element modgrade does not use deprecated link_to_popup_window() for help icon --- diff --git a/lib/form/modgrade.php b/lib/form/modgrade.php index 8fbff35de8..2c6dabb88f 100644 --- a/lib/form/modgrade.php +++ b/lib/form/modgrade.php @@ -62,9 +62,7 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_select{ $grades[$i] = $i; } $this->load($grades); - $linkobject = ''.$strscales.''; - $this->setHelpButton(array('/course/scales.php?id='. $COURSE->id .'&list=true', 'ratingscales', - $linkobject, 400, 500, $strscales, 'none', true), 'link_to_popup_window'); + $this->setHelpButton(array($COURSE->id), 'modgradehelpbutton'); return $result; } return parent::onQuickFormEvent($event, $arg, $caller); diff --git a/lib/weblib.php b/lib/weblib.php index ef46fa17f9..eb0946c365 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2710,6 +2710,27 @@ function editorshortcutshelpbutton() { return ''; } +/** + * Returns html code to be used as help icon of modgrade form element + * + * Is used as a callback in modgrade setHelpButton() + * + * @param int $courseid id of the course the scales should be shown from + * @return string to be echoed + */ +function modgradehelpbutton($courseid){ + global $CFG, $OUTPUT; + + $url = new moodle_url($CFG->wwwroot .'/course/scales.php', array('id' => $courseid, 'list' => true)); + $link = new html_link(); + $link->url = $url; + $link->text = '' . get_string('scales') . ''; + $link->add_action(new popup_action('click', $link->url, 'ratingscales', array('height' => 400, 'width' => 500))); + $link->title = get_string('newwindow'); + + return $OUTPUT->link($link); +} + /** * Print a message and exit. *