mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
Merge branch 'MDL-55129-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
e43bab742d
@ -677,4 +677,15 @@ abstract class assign_plugin {
|
||||
public function is_configurable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions,
|
||||
* in some cases the configs will need formatting or be returned only if the current user has some capabilities enabled.
|
||||
*
|
||||
* @return array the list of settings
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
@ -401,19 +401,27 @@ class mod_assign_external extends external_api {
|
||||
);
|
||||
continue;
|
||||
}
|
||||
$configrecords = $DB->get_recordset('assign_plugin_config', array('assignment' => $module->assignmentid));
|
||||
|
||||
$assign = new assign($context, null, null);
|
||||
|
||||
// Get configurations for only enabled plugins.
|
||||
$plugins = $assign->get_submission_plugins();
|
||||
$plugins = array_merge($plugins, $assign->get_feedback_plugins());
|
||||
|
||||
$configarray = array();
|
||||
foreach ($configrecords as $configrecord) {
|
||||
$configarray[] = array(
|
||||
'id' => $configrecord->id,
|
||||
'assignment' => $configrecord->assignment,
|
||||
'plugin' => $configrecord->plugin,
|
||||
'subtype' => $configrecord->subtype,
|
||||
'name' => $configrecord->name,
|
||||
'value' => $configrecord->value
|
||||
);
|
||||
foreach ($plugins as $plugin) {
|
||||
if ($plugin->is_enabled() && $plugin->is_visible()) {
|
||||
$configrecords = $plugin->get_config_for_external();
|
||||
foreach ($configrecords as $name => $value) {
|
||||
$configarray[] = array(
|
||||
'plugin' => $plugin->get_type(),
|
||||
'subtype' => $plugin->get_subtype(),
|
||||
'name' => $name,
|
||||
'value' => $value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$configrecords->close();
|
||||
|
||||
$assignment = array(
|
||||
'id' => $module->assignmentid,
|
||||
@ -446,8 +454,6 @@ class mod_assign_external extends external_api {
|
||||
);
|
||||
|
||||
// Return or not intro and file attachments depending on the plugin settings.
|
||||
$assign = new assign($context, null, null);
|
||||
|
||||
if ($assign->show_intro()) {
|
||||
|
||||
list($assignment['intro'], $assignment['introformat']) = external_format_text($module->intro,
|
||||
@ -540,8 +546,8 @@ class mod_assign_external extends external_api {
|
||||
private static function get_assignments_config_structure() {
|
||||
return new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'assign_plugin_config id'),
|
||||
'assignment' => new external_value(PARAM_INT, 'assignment id'),
|
||||
'id' => new external_value(PARAM_INT, 'assign_plugin_config id', VALUE_OPTIONAL),
|
||||
'assignment' => new external_value(PARAM_INT, 'assignment id', VALUE_OPTIONAL),
|
||||
'plugin' => new external_value(PARAM_TEXT, 'plugin'),
|
||||
'subtype' => new external_value(PARAM_TEXT, 'subtype'),
|
||||
'name' => new external_value(PARAM_TEXT, 'name'),
|
||||
|
@ -517,4 +517,13 @@ class assign_feedback_comments extends assign_feedback_plugin {
|
||||
return array('assignfeedbackcomments_editor' => $editorstructure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of settings
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
return (array) $this->get_config();
|
||||
}
|
||||
}
|
||||
|
@ -375,4 +375,14 @@ class assign_feedback_editpdf extends assign_feedback_plugin {
|
||||
public function supports_review_panel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of settings
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
return (array) $this->get_config();
|
||||
}
|
||||
}
|
||||
|
@ -688,4 +688,13 @@ class assign_feedback_file extends assign_feedback_plugin {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of settings
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
return (array) $this->get_config();
|
||||
}
|
||||
}
|
||||
|
@ -406,4 +406,13 @@ class assign_feedback_offline extends assign_feedback_plugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of settings
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
return (array) $this->get_config();
|
||||
}
|
||||
}
|
||||
|
@ -188,4 +188,14 @@ class assign_submission_comments extends assign_submission_plugin {
|
||||
public function is_configurable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of settings
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
return (array) $this->get_config();
|
||||
}
|
||||
}
|
||||
|
@ -547,4 +547,23 @@ class assign_submission_file extends assign_submission_plugin {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of settings
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
global $CFG;
|
||||
|
||||
$configs = $this->get_config();
|
||||
|
||||
// Get a size in bytes.
|
||||
if ($configs->maxsubmissionsizebytes == 0) {
|
||||
$configs->maxsubmissionsizebytes = get_max_upload_file_size($CFG->maxbytes, $this->assignment->get_course()->maxbytes,
|
||||
get_config('assignsubmission_file', 'maxbytes'));
|
||||
}
|
||||
return (array) $configs;
|
||||
}
|
||||
}
|
||||
|
@ -665,6 +665,15 @@ class assign_submission_onlinetext extends assign_submission_plugin {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of settings
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
return (array) $this->get_config();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -229,6 +229,7 @@ class mod_assign_external_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals($course1->id, $assignment['course']);
|
||||
$this->assertEquals('lightwork assignment', $assignment['name']);
|
||||
$this->assertContains('the assignment intro text here', $assignment['intro']);
|
||||
$this->assertNotEmpty($assignment['configs']);
|
||||
// Check the url of the file attatched.
|
||||
$this->assertRegExp('@"' . $CFG->wwwroot . '/webservice/pluginfile.php/\d+/mod_assign/intro/intro\.txt"@', $assignment['intro']);
|
||||
$this->assertEquals(1, $assignment['markingworkflow']);
|
||||
|
@ -13,6 +13,8 @@ This files describes API changes in the assign code.
|
||||
Please, note that previously the filename was part of the filepath field, now they are separated.
|
||||
* Submission and feedback plugins can now specify file areas related to their configuration data,
|
||||
which will then be included in backup and restore; see assign_plugin::get_config_file_areas().
|
||||
* Submission and feedback plugins must now return the specific list of configs available for external functions,
|
||||
this can be done implementing the new assign plugin method get_config_for_external()
|
||||
|
||||
=== 3.1 ===
|
||||
* The feedback plugins now need to implement the is_feedback_modified() method. The default is to return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user