mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
Instructions for reviewers work
This commit is contained in:
parent
7ab6f2603a
commit
15d12b54f0
3 changed files with 53 additions and 3 deletions
|
@ -103,6 +103,12 @@ function workshop_add_instance($data) {
|
|||
$data->instructauthorsformat = $data->instructauthorseditor['format'];
|
||||
}
|
||||
|
||||
if ($draftitemid = $data->instructreviewerseditor['itemid']) {
|
||||
$data->instructreviewers = file_save_draft_area_files($draftitemid, $context->id, 'workshop_instructreviewers',
|
||||
0, workshop::instruction_editors_options($context), $data->instructreviewerseditor['text']);
|
||||
$data->instructreviewersformat = $data->instructreviewerseditor['format'];
|
||||
}
|
||||
|
||||
// re-save the record with the replaced URLs in editor fields
|
||||
$DB->update_record('workshop', $data);
|
||||
|
||||
|
@ -137,6 +143,12 @@ function workshop_update_instance($data) {
|
|||
$data->instructauthorsformat = $data->instructauthorseditor['format'];
|
||||
}
|
||||
|
||||
if ($draftitemid = $data->instructreviewerseditor['itemid']) {
|
||||
$data->instructreviewers = file_save_draft_area_files($draftitemid, $context->id, 'workshop_instructreviewers',
|
||||
0, workshop::instruction_editors_options($context), $data->instructreviewerseditor['text']);
|
||||
$data->instructreviewersformat = $data->instructreviewerseditor['format'];
|
||||
}
|
||||
|
||||
// re-save the record with the replaced URLs in editor fields
|
||||
return $DB->update_record('workshop', $data);
|
||||
}
|
||||
|
@ -365,6 +377,27 @@ function workshop_pluginfile($course, $cminfo, $context, $filearea, array $args,
|
|||
send_stored_file($file, $lifetime, 0);
|
||||
}
|
||||
|
||||
if ($filearea === 'workshop_instructreviewers') {
|
||||
// submission instructions may contain sensitive data
|
||||
if (!has_any_capability(array('moodle/course:manageactivities', 'mod/workshop:peerassess'), $context)) {
|
||||
send_file_not_found();
|
||||
}
|
||||
|
||||
array_shift($args); // we do not use itemids here
|
||||
$relativepath = '/' . implode('/', $args);
|
||||
$fullpath = $context->id . $filearea . '0' . $relativepath; // beware, slashes are not used here!
|
||||
|
||||
$fs = get_file_storage();
|
||||
if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) {
|
||||
send_file_not_found();
|
||||
}
|
||||
|
||||
$lifetime = isset($CFG->filelifetime) ? $CFG->filelifetime : 86400;
|
||||
|
||||
// finally send the file
|
||||
send_stored_file($file, $lifetime, 0);
|
||||
}
|
||||
|
||||
// the following file areas are for the files embedded into the assessment forms
|
||||
if (in_array($filearea, array(
|
||||
'workshopform_comments_description',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue