MDL-23479 backup - now restoring workshop logs, thanks David for support!
[moodle.git] / mod / workshop / backup / moodle2 / restore_workshop_activity_task.class.php
index d88beb3..1f942f7 100644 (file)
@@ -77,4 +77,72 @@ class restore_workshop_activity_task extends restore_activity_task {
         return $rules;
 
     }
+
+    /**
+     * Define the restore log rules that will be applied
+     * by the {@link restore_logs_processor} when restoring
+     * workshop logs. It must return one array
+     * of {@link restore_log_rule} objects
+     */
+    static public function define_restore_log_rules() {
+        $rules = array();
+
+        $rules[] = new restore_log_rule('workshop', 'add', 'view.php?id={course_module}', '{workshop}');
+        $rules[] = new restore_log_rule('workshop', 'update', 'view.php?id={course_module}', '{workshop}');
+        $rules[] = new restore_log_rule('workshop', 'view', 'view.php?id={course_module}', '{workshop}');
+
+        $rules[] = new restore_log_rule('workshop', 'add assessment',
+                       'assessment.php?asid={workshop_assessment}', '{workshop_submission}');
+        $rules[] = new restore_log_rule('workshop', 'update assessment',
+                       'assessment.php?asid={workshop_assessment}', '{workshop_submission}');
+
+        $rules[] = new restore_log_rule('workshop', 'add reference assessment',
+                       'exassessment.php?asid={workshop_referenceassessment}', '{workshop_examplesubmission}');
+        $rules[] = new restore_log_rule('workshop', 'update reference assessment',
+                       'exassessment.php?asid={workshop_referenceassessment}', '{workshop_examplesubmission}');
+
+        $rules[] = new restore_log_rule('workshop', 'add example assessment',
+                       'exassessment.php?asid={workshop_exampleassessment}', '{workshop_examplesubmission}');
+        $rules[] = new restore_log_rule('workshop', 'update example assessment',
+                       'exassessment.php?asid={workshop_exampleassessment}', '{workshop_examplesubmission}');
+
+        $rules[] = new restore_log_rule('workshop', 'view submission',
+                       'submission.php?cmid={course_module}&id={workshop_submission}', '{workshop_submission}');
+        $rules[] = new restore_log_rule('workshop', 'add submission',
+                       'submission.php?cmid={course_module}&id={workshop_submission}', '{workshop_submission}');
+        $rules[] = new restore_log_rule('workshop', 'update submission',
+                       'submission.php?cmid={course_module}&id={workshop_submission}', '{workshop_submission}');
+
+        $rules[] = new restore_log_rule('workshop', 'view example',
+                       'exsubmission.php?cmid={course_module}&id={workshop_examplesubmission}', '{workshop_examplesubmission}');
+        $rules[] = new restore_log_rule('workshop', 'add example',
+                       'exsubmission.php?cmid={course_module}&id={workshop_examplesubmission}', '{workshop_examplesubmission}');
+        $rules[] = new restore_log_rule('workshop', 'update example',
+                       'exsubmission.php?cmid={course_module}&id={workshop_examplesubmission}', '{workshop_examplesubmission}');
+
+        $rules[] = new restore_log_rule('workshop', 'update aggregate grades', 'view.php?id={course_module}', '{workshop}');
+        $rules[] = new restore_log_rule('workshop', 'update switch phase', 'view.php?id={course_module}', '[phase]');
+        $rules[] = new restore_log_rule('workshop', 'update clear aggregated grades', 'view.php?id={course_module}', '{workshop}');
+        $rules[] = new restore_log_rule('workshop', 'update clear assessments', 'view.php?id={course_module}', '{workshop}');
+
+        return $rules;
+    }
+
+    /**
+     * Define the restore log rules that will be applied
+     * by the {@link restore_logs_processor} when restoring
+     * course logs. It must return one array
+     * of {@link restore_log_rule} objects
+     *
+     * Note this rules are applied when restoring course logs
+     * by the restore final task, but are defined here at
+     * activity level. All them are rules not linked to any module instance (cmid = 0)
+     */
+    static public function define_restore_log_rules_for_course() {
+        $rules = array();
+
+        $rules[] = new restore_log_rule('workshop', 'view all', 'index.php?id={course}', null);
+
+        return $rules;
+    }
 }