mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
Merge branch 'MDL-75759-master' of https://github.com/junpataleta/moodle
This commit is contained in:
commit
e9596c1fca
14
course/format/classes/external/update_course.php
vendored
14
course/format/classes/external/update_course.php
vendored
@ -72,22 +72,22 @@ class update_course extends external_api {
|
||||
|
||||
/**
|
||||
* This webservice will execute any action from the course editor. The default actions
|
||||
* are located in core_course\stateactions but the format plugin can extend that class
|
||||
* are located in {@see \core_courseformat\stateactions} but the format plugin can extend that class
|
||||
* in format_XXX\course.
|
||||
*
|
||||
* The specific action methods will register in a core_course\stateupdates all the affected
|
||||
* sections, cms and course attribute. This object (in JSON) will be send back to the
|
||||
* The specific action methods will register in a {@see \core_courseformat\stateupdates} all the affected
|
||||
* sections, cms and course attribute. This object (in JSON) will be sent back to the
|
||||
* frontend editor to refresh the updated state elements.
|
||||
*
|
||||
* By default, core_course\stateupdates will register only create, delete and update events
|
||||
* By default, {@see \core_courseformat\stateupdates} will register only create, delete and update events
|
||||
* on cms, sections and the general course data. However, if some plugin needs adhoc messages for
|
||||
* its own mutation module, it extend this class in format_XXX\course.
|
||||
* its own mutation module, extend this class in format_XXX\course.
|
||||
*
|
||||
* @param string $action the action name to execute
|
||||
* @param int $courseid the course id
|
||||
* @param int[] $ids the affected ids (section or cm depending on the action)
|
||||
* @param int $targetsectionid optional target section id (for move action)
|
||||
* @param int $targetcmid optional target cm id (for move action)
|
||||
* @param int|null $targetsectionid optional target section id (for move action)
|
||||
* @param int|null $targetcmid optional target cm id (for move action)
|
||||
* @return string Course state in JSON
|
||||
*/
|
||||
public static function execute(string $action, int $courseid, array $ids = [],
|
||||
|
@ -18,6 +18,7 @@ namespace core_courseformat\output\local\state;
|
||||
|
||||
use core_courseformat\base as course_format;
|
||||
use completion_info;
|
||||
use renderer_base;
|
||||
use section_info;
|
||||
use cm_info;
|
||||
use renderable;
|
||||
@ -70,8 +71,9 @@ class cm implements renderable {
|
||||
* @param renderer_base $output typically, the renderer that's calling this function
|
||||
* @return stdClass data context for a mustache template
|
||||
*/
|
||||
public function export_for_template(\renderer_base $output): stdClass {
|
||||
public function export_for_template(renderer_base $output): stdClass {
|
||||
global $USER, $CFG;
|
||||
require_once($CFG->libdir . '/externallib.php');
|
||||
|
||||
$format = $this->format;
|
||||
$section = $this->section;
|
||||
|
@ -30,8 +30,8 @@ use JsonSerializable;
|
||||
*
|
||||
* Each format plugin could extend this class to provide new updates to the frontend
|
||||
* mutation module.
|
||||
* Extended classes should be locate in "format_XXX\course" namespace and
|
||||
* extends core_course\stateupdates.
|
||||
* Extended classes should be located in "format_XXX\course" namespace and
|
||||
* extends {@see \core_courseformat\stateupdates}.
|
||||
*
|
||||
* @package core_course
|
||||
* @copyright 2021 Ferran Recio <ferran@moodle.com>
|
||||
|
@ -22,11 +22,11 @@ use stdClass;
|
||||
/**
|
||||
* Tests for the stateactions class.
|
||||
*
|
||||
* @package core_course
|
||||
* @package core_courseformat
|
||||
* @category test
|
||||
* @copyright 2021 Sara Arjona (sara@moodle.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_course\stateactions
|
||||
* @coversDefaultClass \core_courseformat\stateactions
|
||||
*/
|
||||
class stateactions_test extends \advanced_testcase {
|
||||
|
||||
|
@ -19,13 +19,13 @@ namespace core_courseformat;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* Tests for the stateactions class.
|
||||
* Tests for the stateupdates class.
|
||||
*
|
||||
* @package core_course
|
||||
* @package core_courseformat
|
||||
* @category test
|
||||
* @copyright 2021 Sara Arjona (sara@moodle.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_course\stateactions
|
||||
* @coversDefaultClass \core_courseformat\stateupdates
|
||||
*/
|
||||
class stateupdates_test extends \advanced_testcase {
|
||||
|
||||
@ -128,9 +128,9 @@ class stateupdates_test extends \advanced_testcase {
|
||||
* Add track about a section state update.
|
||||
*
|
||||
* @dataProvider add_section_provider
|
||||
* @covers ::add_course_put
|
||||
* @covers ::add_course_create
|
||||
* @covers ::add_course_delete
|
||||
* @covers ::add_section_create
|
||||
* @covers ::add_section_remove
|
||||
* @covers ::add_section_put
|
||||
*
|
||||
* @param string $action the action name
|
||||
* @param string $role the user role name
|
||||
@ -242,10 +242,10 @@ class stateupdates_test extends \advanced_testcase {
|
||||
|
||||
|
||||
/**
|
||||
* Add track about a section state update.
|
||||
* Add track about a course module state update.
|
||||
*
|
||||
* @dataProvider add_cm_provider
|
||||
* @covers ::add_cm_update
|
||||
* @covers ::add_cm_put
|
||||
* @covers ::add_cm_create
|
||||
* @covers ::add_cm_remove
|
||||
*
|
||||
@ -339,7 +339,7 @@ class stateupdates_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for test_add_section.
|
||||
* Data provider for test_add_cm.
|
||||
*
|
||||
* @return array testing scenarios
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user