Permalink
Browse files

MDL-37602 Include the overall feedback in the workshop backup and res…

…tore
  • Loading branch information...
1 parent 77d746a commit e36942b7160dad6d082c0073b85fbac009394947 @mudrd8mz mudrd8mz committed Mar 26, 2013
@@ -56,7 +56,8 @@ protected function define_structure() {
'strategy', 'evaluation', 'gradedecimals', 'nattachments',
'latesubmissions', 'maxbytes', 'examplesmode', 'submissionstart',
'submissionend', 'assessmentstart', 'assessmentend',
- 'conclusion', 'conclusionformat'));
+ 'conclusion', 'conclusionformat', 'overallfeedbackmode',
+ 'overallfeedbackfiles', 'overallfeedbackmaxbytes'));
// assessment forms definition
$this->add_subplugin_structure('workshopform', $workshop, true);
@@ -72,7 +73,8 @@ protected function define_structure() {
// reference assessment of the example submission
$referenceassessment = new backup_nested_element('referenceassessment', array('id'), array(
- 'timecreated', 'timemodified', 'grade'));
+ 'timecreated', 'timemodified', 'grade', 'feedbackauthor', 'feedbackauthorformat',
+ 'feedbackauthorattachment'));
// dimension grades for the reference assessment (that is how the form is filled)
$this->add_subplugin_structure('workshopform', $referenceassessment, true);
@@ -86,8 +88,8 @@ protected function define_structure() {
$exampleassessment = new backup_nested_element('exampleassessment', array('id'), array(
'reviewerid', 'weight', 'timecreated', 'timemodified', 'grade',
'gradinggrade', 'gradinggradeover', 'gradinggradeoverby',
- 'feedbackauthor', 'feedbackauthorformat', 'feedbackreviewer',
- 'feedbackreviewerformat'));
+ 'feedbackauthor', 'feedbackauthorformat', 'feedbackauthorattachment',
+ 'feedbackreviewer', 'feedbackreviewerformat'));
// dimension grades for the assessment of example submission (that is assessment forms are filled)
$this->add_subplugin_structure('workshopform', $exampleassessment, true);
@@ -105,8 +107,8 @@ protected function define_structure() {
$assessment = new backup_nested_element('assessment', array('id'), array(
'reviewerid', 'weight', 'timecreated', 'timemodified', 'grade',
'gradinggrade', 'gradinggradeover', 'gradinggradeoverby',
- 'feedbackauthor', 'feedbackauthorformat', 'feedbackreviewer',
- 'feedbackreviewerformat'));
+ 'feedbackauthor', 'feedbackauthorformat', 'feedbackauthorattachment',
+ 'feedbackreviewer', 'feedbackreviewerformat'));
// dimension grades for the assessment (that is assessment forms are filled)
$this->add_subplugin_structure('workshopform', $assessment, true);
@@ -200,9 +202,18 @@ protected function define_structure() {
$examplesubmission->annotate_files('mod_workshop', 'submission_content', 'id');
$examplesubmission->annotate_files('mod_workshop', 'submission_attachment', 'id');
+ $referenceassessment->annotate_files('mod_workshop', 'overallfeedback_content', 'id');
+ $referenceassessment->annotate_files('mod_workshop', 'overallfeedback_attachment', 'id');
+
+ $exampleassessment->annotate_files('mod_workshop', 'overallfeedback_content', 'id');
+ $exampleassessment->annotate_files('mod_workshop', 'overallfeedback_attachment', 'id');
+
$submission->annotate_files('mod_workshop', 'submission_content', 'id');
$submission->annotate_files('mod_workshop', 'submission_attachment', 'id');
+ $assessment->annotate_files('mod_workshop', 'overallfeedback_content', 'id');
+ $assessment->annotate_files('mod_workshop', 'overallfeedback_attachment', 'id');
+
// return the root element (workshop), wrapped into standard activity structure
return $this->prepare_activity_structure($workshop);
}
@@ -145,7 +145,7 @@ protected function process_workshop_referenceassessment($data) {
$data->timemodified = $this->apply_date_offset($data->timemodified);
$newitemid = $DB->insert_record('workshop_assessments', $data);
- $this->set_mapping('workshop_referenceassessment', $oldid, $newitemid);
+ $this->set_mapping('workshop_referenceassessment', $oldid, $newitemid, true); // Mapping with files
}
protected function process_workshop_exampleassessment($data) {
@@ -160,7 +160,7 @@ protected function process_workshop_exampleassessment($data) {
$data->timemodified = $this->apply_date_offset($data->timemodified);
$newitemid = $DB->insert_record('workshop_assessments', $data);
- $this->set_mapping('workshop_exampleassessment', $oldid, $newitemid);
+ $this->set_mapping('workshop_exampleassessment', $oldid, $newitemid, true); // Mapping with files
}
protected function process_workshop_submission($data) {
@@ -191,7 +191,7 @@ protected function process_workshop_assessment($data) {
$data->timemodified = $this->apply_date_offset($data->timemodified);
$newitemid = $DB->insert_record('workshop_assessments', $data);
- $this->set_mapping('workshop_assessment', $oldid, $newitemid);
+ $this->set_mapping('workshop_assessment', $oldid, $newitemid, true); // Mapping with files
}
protected function process_workshop_aggregation($data) {
@@ -218,8 +218,20 @@ protected function after_execute() {
$this->add_related_files('mod_workshop', 'submission_content', 'workshop_examplesubmission');
$this->add_related_files('mod_workshop', 'submission_attachment', 'workshop_examplesubmission');
+ // Add reference assessment related files, matching by 'workshop_referenceassessment' itemname
+ $this->add_related_files('mod_workshop', 'overallfeedback_content', 'workshop_referenceassessment');
+ $this->add_related_files('mod_workshop', 'overallfeedback_attachment', 'workshop_referenceassessment');
+
+ // Add example assessment related files, matching by 'workshop_exampleassessment' itemname
+ $this->add_related_files('mod_workshop', 'overallfeedback_content', 'workshop_exampleassessment');
+ $this->add_related_files('mod_workshop', 'overallfeedback_attachment', 'workshop_exampleassessment');
+
// Add submission related files, matching by 'workshop_submission' itemname
$this->add_related_files('mod_workshop', 'submission_content', 'workshop_submission');
$this->add_related_files('mod_workshop', 'submission_attachment', 'workshop_submission');
+
+ // Add assessment related files, matching by 'workshop_assessment' itemname
+ $this->add_related_files('mod_workshop', 'overallfeedback_content', 'workshop_assessment');
+ $this->add_related_files('mod_workshop', 'overallfeedback_attachment', 'workshop_assessment');
}
}

0 comments on commit e36942b

Please sign in to comment.