$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);
$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);
}
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',
// 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();
$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);
}
}
}
}
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 {