~ubuntu-branches/ubuntu/natty/moodle/natty

« back to all changes in this revision

Viewing changes to mod/assignment/restorelib.php

  • Committer: Bazaar Package Importer
  • Author(s): Tomasz Muras
  • Date: 2010-10-30 12:19:28 UTC
  • mfrom: (1.1.12 upstream) (3.1.10 squeeze)
  • Revision ID: james.westby@ubuntu.com-20101030121928-qzobi6mctpnk4dif
Tags: 1.9.9.dfsg2-2
* Added Romanian translation
* Updated Japanese translation (closes: #596820)
* Backporting security fixes from Moodle 1.9.10 (closes: #601384)
   - Updated embedded CAS to 1.1.3
   - Added patch for MDL-24523:
     clean_text() not filtering text in markdown format
   - Added patch for MDL-24810 and upgraded customized HTML Purifier to 4.2.0 
   - Added patch for MDL-24258:
     students can delete their forum posts later than $CFG->maxeditingtime 
     under certain conditions
   - Added patch for MDL-23377:
     Can't delete quiz attempts in course without enrolled students

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php //$Id: restorelib.php,v 1.33.2.2 2008/12/11 04:37:11 dongsheng Exp $
 
1
<?php //$Id: restorelib.php,v 1.33.2.6 2009/08/15 07:58:36 mjollnir_ Exp $
2
2
    //This php script contains all the stuff to backup/restore
3
3
    //assignment mods
4
4
 
105
105
                //We have the newid, update backup_ids
106
106
                backup_putid($restore->backup_unique_code,$mod->modtype,
107
107
                             $mod->id, $newid);
 
108
                // load up the subtype and see if it wants anything further restored.
 
109
                $class = 'assignment_' . $assignment->assignmenttype;
 
110
                require_once($CFG->dirroot . '/mod/assignment/lib.php');
 
111
                require_once($CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php');
 
112
                call_user_func(array($class, 'restore_one_mod'), $info, $restore, $assignment);
 
113
 
108
114
                //Now check if want to restore user data and do it.
109
115
                if (restore_userdata_selected($restore,'assignment',$mod->id)) { 
110
116
                    //Restore assignmet_submissions
111
 
                    $status = assignment_submissions_restore_mods($mod->id, $newid,$info,$restore) && $status;
 
117
                    $status = assignment_submissions_restore_mods($mod->id, $newid,$info,$restore, $assignment) && $status;
112
118
                }
113
119
            } else {
114
120
                $status = false;
121
127
    }
122
128
 
123
129
    //This function restores the assignment_submissions
124
 
    function assignment_submissions_restore_mods($old_assignment_id, $new_assignment_id,$info,$restore) {
 
130
    function assignment_submissions_restore_mods($old_assignment_id, $new_assignment_id,$info,$restore, $assignment) {
125
131
 
126
132
        global $CFG;
127
133
 
199
205
                $status = assignment_restore_files ($old_assignment_id, $new_assignment_id, 
200
206
                                                    $olduserid, $submission->userid, $restore);
201
207
 
 
208
                $submission->id = $newid;
 
209
                $class = 'assignment_' . $assignment->assignmenttype;
 
210
                require_once($CFG->dirroot . '/mod/assignment/lib.php');
 
211
                require_once($CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php');
 
212
                call_user_func(array($class, 'restore_one_submission'), $sub_info, $restore, $assignment, $submission);
202
213
            } else {
203
214
                $status = false;
204
215
            }