MDL-55163 mod_assign: Fix mod_assign_copy_previous_attempts
- Not exposed via WS - Have a bug when calling the api function
This commit is contained in:
@@ -25,6 +25,15 @@
|
||||
|
||||
$functions = array(
|
||||
|
||||
'mod_assign_copy_previous_attempt' => array(
|
||||
'classname' => 'mod_assign_external',
|
||||
'methodname' => 'copy_previous_attempt',
|
||||
'classpath' => 'mod/assign/externallib.php',
|
||||
'description' => 'Copy a students previous attempt to a new attempt.',
|
||||
'type' => 'write',
|
||||
'capabilities' => 'mod/assign:view, mod/assign:submit'
|
||||
),
|
||||
|
||||
'mod_assign_get_grades' => array(
|
||||
'classname' => 'mod_assign_external',
|
||||
'methodname' => 'get_grades',
|
||||
|
||||
@@ -2160,7 +2160,7 @@ class mod_assign_external extends external_api {
|
||||
|
||||
/**
|
||||
* Describes the parameters for copy_previous_attempt
|
||||
* @return external_external_function_parameters
|
||||
* @return external_function_parameters
|
||||
* @since Moodle 2.6
|
||||
*/
|
||||
public static function copy_previous_attempt_parameters() {
|
||||
@@ -2179,12 +2179,11 @@ class mod_assign_external extends external_api {
|
||||
* @since Moodle 2.6
|
||||
*/
|
||||
public static function copy_previous_attempt($assignmentid) {
|
||||
global $CFG, $USER;
|
||||
|
||||
$params = self::validate_parameters(self::copy_previous_attempt_parameters(),
|
||||
array('assignmentid' => $assignmentid));
|
||||
|
||||
$cm = get_coursemodule_from_instance('assign', $assignmentid, 0, false, MUST_EXIST);
|
||||
$cm = get_coursemodule_from_instance('assign', $params['assignmentid'], 0, false, MUST_EXIST);
|
||||
$context = context_module::instance($cm->id);
|
||||
self::validate_context($context);
|
||||
|
||||
@@ -2192,7 +2191,7 @@ class mod_assign_external extends external_api {
|
||||
|
||||
$notices = array();
|
||||
|
||||
$assignment->copy_previous_attempt($submissiondata, $notices);
|
||||
$assignment->copy_previous_attempt($notices);
|
||||
|
||||
$warnings = array();
|
||||
foreach ($notices as $notice) {
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->version = 2016070400; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2016070401; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->cron = 60;
|
||||
|
||||
Reference in New Issue
Block a user