Skip to content
Snippets Groups Projects
Commit 3ab9c483 authored by Astor Bizard's avatar Astor Bizard :dog2:
Browse files

Added execution files and corrected files to info webservice for teachers

parent 7a766e56
No related branches found
No related tags found
No related merge requests found
......@@ -68,12 +68,22 @@ class mod_vpl_webservice extends external_api {
'example' => ( int ) $instance->example,
'restrictededitor' => ( int ) $instance->restrictededitor,
'maxfiles' => ( int ) $instance->maxfiles,
'reqfiles' => array ()
'reqfiles' => array (),
'execfiles' => array (),
'corrfiles' => array ()
);
$files = mod_vpl_edit::get_requested_files( $vpl );
// Adapt array[name]=content to format array[]=array(name,data).
$files = mod_vpl_edit::files2object( $files );
$ret ['reqfiles'] = $files;
$hasteacherrights = $vpl->has_capability( VPL_MANAGE_CAPABILITY );
if ($hasteacherrights) {
$execfiles = $vpl->get_fgm('execution')->getAllFiles();
$ret ['execfiles'] = mod_vpl_edit::files2object( $execfiles );
$correctedfiles = $vpl->get_fgm('corrected')->getAllFiles();
$ret ['corrfiles'] = mod_vpl_edit::files2object( $correctedfiles );
}
return $ret;
}
public static function info_returns() {
......@@ -89,6 +99,14 @@ class mod_vpl_webservice extends external_api {
'reqfiles' => new external_multiple_structure( new external_single_structure( array (
'name' => new external_value( PARAM_TEXT, 'File name' ),
'data' => new external_value( PARAM_RAW, 'File content' )
) ) ),
'execfiles' => new external_multiple_structure( new external_single_structure( array (
'name' => new external_value( PARAM_TEXT, 'File name' ),
'data' => new external_value( PARAM_RAW, 'File content' )
) ) ),
'corrfiles' => new external_multiple_structure( new external_single_structure( array (
'name' => new external_value( PARAM_TEXT, 'File name' ),
'data' => new external_value( PARAM_RAW, 'File content' )
) ) )
) );
}
......@@ -128,8 +146,8 @@ class mod_vpl_webservice extends external_api {
}
public static function save_corrected_files_returns() {
return null;
}
}
public static function save_execution_files_parameters() {
return new external_function_parameters( array (
'id' => new external_value( PARAM_INT, 'Activity id (course_module)', VALUE_REQUIRED ),
......@@ -171,7 +189,7 @@ class mod_vpl_webservice extends external_api {
}
mod_vpl_edit::save_teacher_files( $vpl, $USER->id, $files, $type );
}
/*
* save function. save/submit the students files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment