mirror of
https://github.com/moodle/moodle.git
synced 2025-04-12 20:12:15 +02:00
Merge branch 'MDL-74565' of https://github.com/paulholden/moodle
This commit is contained in:
commit
5b6d6ffc36
@ -81,29 +81,18 @@ if (!isset($USER->grade_last_report)) {
|
||||
}
|
||||
$USER->grade_last_report[$course->id] = 'grader';
|
||||
|
||||
// Build editing on/off buttons
|
||||
// Build editing on/off buttons.
|
||||
$buttons = '';
|
||||
if (has_capability('moodle/grade:edit', $context)) {
|
||||
|
||||
if (($edit != - 1) and $PAGE->user_allowed_editing()) {
|
||||
$PAGE->set_other_editing_capability('moodle/grade:edit');
|
||||
if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) {
|
||||
if ($edit != - 1) {
|
||||
$USER->editing = $edit;
|
||||
}
|
||||
|
||||
// page params for the turn editting on
|
||||
// Page params for the turn editing on button.
|
||||
$options = $gpr->get_options();
|
||||
$options['sesskey'] = sesskey();
|
||||
|
||||
if (isset($USER->editing) && $USER->editing) {
|
||||
$options['edit'] = 0;
|
||||
$string = get_string('turneditingoff');
|
||||
} else {
|
||||
$options['edit'] = 1;
|
||||
$string = get_string('turneditingon');
|
||||
}
|
||||
|
||||
if (!$PAGE->theme->haseditswitch) {
|
||||
$buttons = new single_button(new moodle_url('index.php', $options), $string, 'get');
|
||||
}
|
||||
$buttons = $OUTPUT->edit_button(new moodle_url($PAGE->url, $options), 'get');
|
||||
}
|
||||
|
||||
$gradeserror = array();
|
||||
|
@ -2819,9 +2819,10 @@ EOD;
|
||||
* Returns HTML to display a "Turn editing on/off" button in a form.
|
||||
*
|
||||
* @param moodle_url $url The URL + params to send through when clicking the button
|
||||
* @param string $method
|
||||
* @return string HTML the button
|
||||
*/
|
||||
public function edit_button(moodle_url $url) {
|
||||
public function edit_button(moodle_url $url, string $method = 'post') {
|
||||
|
||||
if ($this->page->theme->haseditswitch == true) {
|
||||
return;
|
||||
@ -2835,7 +2836,7 @@ EOD;
|
||||
$editstring = get_string('turneditingon');
|
||||
}
|
||||
|
||||
return $this->single_button($url, $editstring);
|
||||
return $this->single_button($url, $editstring, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,6 +13,7 @@ information provided here is intended especially for developers.
|
||||
- Breaking: 3rd party log readers implementing interface sql_reader will need to implement get_events_select_exists()
|
||||
* Added $strictness parameter to persistent `get_record` method, optionally allowing caller to ensure record exists
|
||||
* New DML driver method `$DB->sql_cast_to_char` for casting given field/expression to char
|
||||
* The core renderer `edit_button` method now accepts an optional `$method` argument (get/post) for the button
|
||||
* For plugins that override secondary navigation, the namespace for the custom secondary navigation class has
|
||||
changed. It was (for example) mod_mymodule\local\views\secondary but is now
|
||||
mod_mymodule\navigation\views\secondary. The old location will continue to work, but is deprecated.
|
||||
|
@ -31,7 +31,14 @@ defined('MOODLE_INTERNAL') || die;
|
||||
*/
|
||||
class core_renderer extends \core_renderer {
|
||||
|
||||
public function edit_button(moodle_url $url) {
|
||||
/**
|
||||
* Returns HTML to display a "Turn editing on/off" button in a form.
|
||||
*
|
||||
* @param moodle_url $url The URL + params to send through when clicking the button
|
||||
* @param string $method
|
||||
* @return string HTML the button
|
||||
*/
|
||||
public function edit_button(moodle_url $url, string $method = 'post') {
|
||||
if ($this->page->theme->haseditswitch) {
|
||||
return;
|
||||
}
|
||||
@ -43,7 +50,7 @@ class core_renderer extends \core_renderer {
|
||||
$url->param('edit', 'on');
|
||||
$editstring = get_string('turneditingon');
|
||||
}
|
||||
$button = new \single_button($url, $editstring, 'post', ['class' => 'btn btn-primary']);
|
||||
$button = new \single_button($url, $editstring, $method, ['class' => 'btn btn-primary']);
|
||||
return $this->render_single_button($button);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user