mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-81397 courseformat: define section editing capabilities.
This ensures consistency for current page instance, when rendering content in response to fragment AJAX requests.
This commit is contained in:
parent
1291869f90
commit
89fae608a6
@ -26,6 +26,7 @@ use coding_exception;
|
||||
use core_course_renderer;
|
||||
use core_courseformat\base as course_format;
|
||||
use html_writer;
|
||||
use moodle_page;
|
||||
use renderable;
|
||||
use section_info;
|
||||
use stdClass;
|
||||
@ -39,6 +40,23 @@ use stdClass;
|
||||
*/
|
||||
abstract class section_renderer extends core_course_renderer {
|
||||
|
||||
/**
|
||||
* Constructor method, calls the parent constructor.
|
||||
*
|
||||
* @param moodle_page $page
|
||||
* @param string $target one of rendering target constants
|
||||
*/
|
||||
public function __construct(moodle_page $page, $target) {
|
||||
parent::__construct($page, $target);
|
||||
|
||||
// Ensure capabilities for section editing controls match those defined in course/view.php to ensure that they work
|
||||
// when called via an AJAX request.
|
||||
if (course_get_format($page->course)->uses_sections()) {
|
||||
$page->set_other_editing_capability('moodle/course:sectionvisibility');
|
||||
$page->set_other_editing_capability('moodle/course:movesections');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the provided widget and returns the HTML to display it.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user