Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
e43bab74
Commit
e43bab74
authored
Oct 05, 2016
by
Dan Poltawski
Browse files
Merge branch 'MDL-55129-master' of
git://github.com/jleyva/moodle
parents
77371e2d
30cdddb0
Changes
11
Hide whitespace changes
Inline
Side-by-side
mod/assign/assignmentplugin.php
View file @
e43bab74
...
...
@@ -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
();
}
}
mod/assign/externallib.php
View file @
e43bab74
...
...
@@ -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'
),
...
...
mod/assign/feedback/comments/locallib.php
View file @
e43bab74
...
...
@@ -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
();
}
}
mod/assign/feedback/editpdf/locallib.php
View file @
e43bab74
...
...
@@ -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
();
}
}
mod/assign/feedback/file/locallib.php
View file @
e43bab74
...
...
@@ -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
();
}
}
mod/assign/feedback/offline/locallib.php
View file @
e43bab74
...
...
@@ -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
();
}
}
mod/assign/submission/comments/locallib.php
View file @
e43bab74
...
...
@@ -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
();
}
}
mod/assign/submission/file/locallib.php
View file @
e43bab74
...
...
@@ -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
;
}
}
mod/assign/submission/onlinetext/locallib.php
View file @
e43bab74
...
...
@@ -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
();
}
}
mod/assign/tests/externallib_test.php
View file @
e43bab74
...
...
@@ -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'
]);
...
...
mod/assign/upgrade.txt
View file @
e43bab74
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment