mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +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',
|
||||
|
|
|
@ -132,9 +132,9 @@ class mod_workshop_mod_form extends moodleform_mod {
|
|||
// Assessment settings --------------------------------------------------------
|
||||
$mform->addElement('header', 'assessmentsettings', get_string('assessmentsettings', 'workshop'));
|
||||
|
||||
// $label = get_string('instructreviewers', 'workshop');
|
||||
// $mform->addElement('editor', 'instructreviewerseditor', $label, null,
|
||||
// workshop::instruction_editors_options($this->context));
|
||||
$label = get_string('instructreviewers', 'workshop');
|
||||
$mform->addElement('editor', 'instructreviewerseditor', $label, null,
|
||||
workshop::instruction_editors_options($this->context));
|
||||
|
||||
$label = get_string('nexassessments', 'workshop');
|
||||
$options = workshop_get_numbers_of_assessments();
|
||||
|
@ -229,11 +229,23 @@ class mod_workshop_mod_form extends moodleform_mod {
|
|||
$data['instructauthors']);
|
||||
$data['instructauthorseditor']['format'] = $data['instructauthorsformat'];
|
||||
$data['instructauthorseditor']['itemid'] = $draftitemid;
|
||||
|
||||
$draftitemid = file_get_submitted_draft_itemid('instructreviewers');
|
||||
$data['instructreviewerseditor']['text'] = file_prepare_draft_area($draftitemid, $this->context->id,
|
||||
'workshop_instructreviewers', false,
|
||||
workshop::instruction_editors_options($this->context),
|
||||
$data['instructreviewers']);
|
||||
$data['instructreviewerseditor']['format'] = $data['instructreviewersformat'];
|
||||
$data['instructreviewerseditor']['itemid'] = $draftitemid;
|
||||
} else {
|
||||
// adding a new workshop instance
|
||||
$draftitemid = file_get_submitted_draft_itemid('instructauthors');
|
||||
file_prepare_draft_area($draftitemid, null, null, null); // no context, no filearea yet
|
||||
$data['instructauthorseditor'] = array('text' => '', 'format' => FORMAT_HTML, 'itemid' => $draftitemid);
|
||||
|
||||
$draftitemid = file_get_submitted_draft_itemid('instructreviewers');
|
||||
file_prepare_draft_area($draftitemid, null, null, null); // no context, no filearea yet
|
||||
$data['instructreviewerseditor'] = array('text' => '', 'format' => FORMAT_HTML, 'itemid' => $draftitemid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,11 @@ case workshop::PHASE_SUBMISSION:
|
|||
}
|
||||
break;
|
||||
case workshop::PHASE_ASSESSMENT:
|
||||
if (trim(strip_tags($workshop->instructreviewers))) {
|
||||
$instructions = file_rewrite_pluginfile_urls($workshop->instructreviewers, 'pluginfile.php', $PAGE->context->id,
|
||||
'workshop_instructreviewers', 0, workshop::instruction_editors_options($PAGE->context));
|
||||
echo $OUTPUT->box(format_text($instructions, $workshop->instructreviewersformat), array('generalbox', 'instructions'));
|
||||
}
|
||||
if (! $assessments = $workshop->get_assessments_by_reviewer($USER->id)) {
|
||||
echo $OUTPUT->heading(get_string('assignedassessmentsnone', 'workshop'), 3);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue