Merge branch 'MDL-53765-master' of git://github.com/junpataleta/moodle

This commit is contained in:
Dan Poltawski 2016-08-09 13:56:49 +01:00
commit 017230d576
5 changed files with 14 additions and 13 deletions

View File

@ -1114,7 +1114,7 @@ function print_checkbox($name, $value, $checked = true, $label = '', $alt = '',
/**
* Prints the 'update this xxx' button that appears on module pages.
*
* @deprecated since Moodle 2.0
* @deprecated since Moodle 3.2
*
* @param string $cmid the course_module id.
* @param string $ignored not used any more. (Used to be courseid.)
@ -1124,9 +1124,9 @@ function print_checkbox($name, $value, $checked = true, $label = '', $alt = '',
function update_module_button($cmid, $ignored, $string) {
global $CFG, $OUTPUT;
// debugging('update_module_button() has been deprecated. Please change your code to use $OUTPUT->update_module_button().');
//NOTE: DO NOT call new output method because it needs the module name we do not have here!
debugging('update_module_button() has been deprecated and should not be used anymore. Activity modules should not add the ' .
'edit module button, the link is already available in the Administration block. Themes can choose to display the link ' .
'in the buttons row consistently for all module types.', DEBUG_DEVELOPER);
if (has_capability('moodle/course:manageactivities', context_module::instance($cmid))) {
$string = get_string('updatethis', '', $string);

View File

@ -2685,12 +2685,19 @@ EOD;
/**
* Returns HTML to display the 'Update this Modulename' button that appears on module pages.
*
* @deprecated since Moodle 3.2
*
* @param string $cmid the course_module id.
* @param string $modulename the module name, eg. "forum", "quiz" or "workshop"
* @return string the HTML for the button, if this user has permission to edit it, else an empty string.
*/
public function update_module_button($cmid, $modulename) {
global $CFG;
debugging('core_renderer::update_module_button() has been deprecated and should not be used anymore. Activity modules ' .
'should not add the edit module button, the link is already available in the Administration block. Themes can choose ' .
'to display the link in the buttons row consistently for all module types.', DEBUG_DEVELOPER);
if (has_capability('moodle/course:manageactivities', context_module::instance($cmid))) {
$modulename = get_string('modulename', $modulename);
$string = get_string('updatethis', '', $modulename);

View File

@ -253,7 +253,6 @@ function resource_print_header($resource, $cm, $course) {
$PAGE->set_title($course->shortname.': '.$resource->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($resource);
$PAGE->set_button(update_module_button($cm->id, '', get_string('modulename', 'resource')));
echo $OUTPUT->header();
}

View File

@ -4,6 +4,9 @@ information provided here is intended especially for developers.
=== 3.2 ===
* Callback delete_course is deprecated and should be replaced with observer for event \core\event\course_content_deleted
* update_module_button() and core_renderer::update_module_button() have been deprecated and should not be used anymore.
Activity modules should not add the edit module button, the link is already available in the Administration block.
Themes can choose to display the link in the buttons row consistently for all module types.
=== 3.1 ===

View File

@ -978,14 +978,6 @@ class page_wiki_preview extends page_wiki_edit {
private $newcontent;
function __construct($wiki, $subwiki, $cm) {
global $PAGE, $CFG, $OUTPUT;
parent::__construct($wiki, $subwiki, $cm);
$buttons = $OUTPUT->update_module_button($cm->id, 'wiki');
$PAGE->set_button($buttons);
}
function print_header() {
global $PAGE, $CFG;