Skip to content

Commit

Permalink
MDL-21178 formslib element modgrade does not use deprecated link_to_p…
Browse files Browse the repository at this point in the history
…opup_window() for help icon
  • Loading branch information
mudrd8mz committed Dec 23, 2009
1 parent e0738f5 commit 0ea95dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/form/modgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ function onQuickFormEvent($event, $arg, &$caller)
$grades[$i] = $i;
}
$this->load($grades);
$linkobject = '<span class="helplink"><img height="17" width="17" alt="'.$strscales.'" src="'.$OUTPUT->pix_url('help') . '" /></span>';
$this->setHelpButton(array('/course/scales.php?id='. $COURSE->id .'&amp;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);
Expand Down
21 changes: 21 additions & 0 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<span class="helplink"><img alt="' . get_string('scales') . '" class="iconhelp" src="' . $OUTPUT->pix_url('help') . '" /></span>';
$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.
*
Expand Down

0 comments on commit 0ea95dd

Please sign in to comment.