mirror of
https://github.com/moodle/moodle.git
synced 2025-03-20 15:40:17 +01:00
Merge branch 'MDL-82157-main' of https://github.com/andrewnicols/moodle
This commit is contained in:
commit
79de3b6ec4
7
.upgradenotes/MDL-82157-2024061105175092.yml
Normal file
7
.upgradenotes/MDL-82157-2024061105175092.yml
Normal file
@ -0,0 +1,7 @@
|
||||
issueNumber: MDL-82157
|
||||
notes:
|
||||
core:
|
||||
- message: >-
|
||||
The following method has been deprecated and should not be used any
|
||||
longer: `print_grade_menu`.
|
||||
type: deprecated
|
@ -3313,3 +3313,51 @@ function search_generate_text_SQL() {
|
||||
function disable_output_buffering(): void {
|
||||
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints a grade menu (as part of an existing form) with help showing all possible numerical grades and scales.
|
||||
*
|
||||
* @todo Finish documenting this function
|
||||
* @todo Deprecate: this is only used in a few contrib modules
|
||||
*
|
||||
* @param int $courseid The course ID
|
||||
* @param string $name
|
||||
* @param string $current
|
||||
* @param boolean $includenograde Include those with no grades
|
||||
* @param boolean $return If set to true returns rather than echo's
|
||||
* @return string|bool|null Depending on value of $return
|
||||
* @deprecated Since Moodle 4.5
|
||||
*/
|
||||
#[\core\attribute\deprecated('This method should not be used', since: '4.5', mdl: 'MDL-82157')]
|
||||
function print_grade_menu($courseid, $name, $current, $includenograde=true, $return=false) {
|
||||
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
|
||||
global $OUTPUT;
|
||||
|
||||
$output = '';
|
||||
$strscale = get_string('scale');
|
||||
$strscales = get_string('scales');
|
||||
|
||||
$scales = get_scales_menu($courseid);
|
||||
foreach ($scales as $i => $scalename) {
|
||||
$grades[-$i] = $strscale .': '. $scalename;
|
||||
}
|
||||
if ($includenograde) {
|
||||
$grades[0] = get_string('nograde');
|
||||
}
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
$output .= html_writer::select($grades, $name, $current, false);
|
||||
|
||||
$linkobject = '<span class="helplink">' . $OUTPUT->pix_icon('help', $strscales) . '</span>';
|
||||
$link = new moodle_url('/course/scales.php', array('id' => $courseid, 'list' => 1));
|
||||
$action = new popup_action('click', $link, 'ratingscales', array('height' => 400, 'width' => 500));
|
||||
$output .= $OUTPUT->action_link($link, $linkobject, $action, array('title' => $strscales));
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
@ -2850,50 +2850,6 @@ function navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $wid
|
||||
return implode("\n", $menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a grade menu (as part of an existing form) with help showing all possible numerical grades and scales.
|
||||
*
|
||||
* @todo Finish documenting this function
|
||||
* @todo Deprecate: this is only used in a few contrib modules
|
||||
*
|
||||
* @param int $courseid The course ID
|
||||
* @param string $name
|
||||
* @param string $current
|
||||
* @param boolean $includenograde Include those with no grades
|
||||
* @param boolean $return If set to true returns rather than echo's
|
||||
* @return string|bool|null Depending on value of $return
|
||||
*/
|
||||
function print_grade_menu($courseid, $name, $current, $includenograde=true, $return=false) {
|
||||
global $OUTPUT;
|
||||
|
||||
$output = '';
|
||||
$strscale = get_string('scale');
|
||||
$strscales = get_string('scales');
|
||||
|
||||
$scales = get_scales_menu($courseid);
|
||||
foreach ($scales as $i => $scalename) {
|
||||
$grades[-$i] = $strscale .': '. $scalename;
|
||||
}
|
||||
if ($includenograde) {
|
||||
$grades[0] = get_string('nograde');
|
||||
}
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
$output .= html_writer::select($grades, $name, $current, false);
|
||||
|
||||
$linkobject = '<span class="helplink">' . $OUTPUT->pix_icon('help', $strscales) . '</span>';
|
||||
$link = new moodle_url('/course/scales.php', array('id' => $courseid, 'list' => 1));
|
||||
$action = new popup_action('click', $link, 'ratingscales', array('height' => 400, 'width' => 500));
|
||||
$output .= $OUTPUT->action_link($link, $linkobject, $action, array('title' => $strscales));
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an error to STDOUT and exit with a non-zero code. For commandline scripts.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user