1. DONE: check user->idnumber
2. DONE: check user->lang (at restore set mi_nt where ma_nt).
3. DONE: check course->lang (at restore set mi_nt where ma_nt).
- 4. TODO: user_students->enrol (analyse and proceed).
- 5. TODO: user_teachers->enrol (analyse and proceed).
- 6. TODO: user->policyagreed (analyse and proceed).
+ 4. DONE: user_students->enrol (analyse and proceed).
+ 5. DONE: user_teachers->enrol (analyse and proceed).
+ 6. DONE: user->policyagreed (analyse and proceed).
7. TODO: groups->password
8. TODO: assignment->emailteachers
9. TODO: exercise->usepassword and exercise->password
fwrite ($bf,full_tag("AUTH",4,false,$user_data->auth));
fwrite ($bf,full_tag("GUID",4,false,$user_data->guid));
fwrite ($bf,full_tag("CONFIRMED",4,false,$user_data->confirmed));
+ fwrite ($bf,full_tag("POLICYAGREED",4,false,$user_data->policyagreed));
fwrite ($bf,full_tag("DELETED",4,false,$user_data->deleted));
fwrite ($bf,full_tag("USERNAME",4,false,$user_data->username));
fwrite ($bf,full_tag("PASSWORD",4,false,$user_data->password));
fwrite ($bf,full_tag("TIMEEND",6,false,$tea->timeend));
fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$tea->timemodified));
fwrite ($bf,full_tag("TIMEACCESS",6,false,$tea->timeaccess));
+ fwrite ($bf,full_tag("ENROL",6,false,$tea->enrol));
//Print ROLE end
fwrite ($bf,end_tag("ROLE",5,true));
}
fwrite ($bf,full_tag("TIMEEND",6,false,$stu->timeend));
fwrite ($bf,full_tag("TIME",6,false,$stu->time));
fwrite ($bf,full_tag("TIMEACCESS",6,false,$stu->timeaccess));
+ fwrite ($bf,full_tag("ENROL",6,false,$stu->enrol));
//Print ROLE end
fwrite ($bf,end_tag("ROLE",5,true));
}
$user->auth = $CFG->auth;
}
+ //We need to process the POLICYAGREED field to recalculate it:
+ // - if the destination site is different (by wwwroot) reset it.
+ // - if the destination site is the same (by wwwroot), leave it unmodified
+
+ if ($restore->original_wwwroot != $CFG->wwwroot) {
+ $user->policyagreed = 0;
+ } else {
+ //Nothing to do, we are in the same server
+ }
+
//We are going to create the user
//The structure is exactly as we need
$newid = insert_record ("user",$user);
//Set course and user
$user->roles['teacher']->course = $restore->course_id;
$user->roles['teacher']->userid = $newid;
+
+ //Need to analyse the enrol field
+ // - if it isn't set, set it to $CFG->enrol
+ // - if we are in a different server (by wwwroot), set it to $CFG->enrol
+ // - if we are in the same server (by wwwroot), maintain it unmodified.
+ if (empty($user->roles['teacher']->enrol)) {
+ $user->roles['teacher']->enrol = $CFG->enrol;
+ } else if ($restore->original_wwwroot != $CFG->wwwroot) {
+ $user->roles['teacher']->enrol = $CFG->enrol;
+ } else {
+ //Nothing to do. Leave it unmodified
+ }
+
//Insert data in user_teachers
//The structure is exactly as we need
$status = insert_record("user_teachers",$user->roles['teacher']);
//Set course and user
$user->roles['student']->course = $restore->course_id;
$user->roles['student']->userid = $newid;
+
+ //Need to analyse the enrol field
+ // - if it isn't set, set it to $CFG->enrol
+ // - if we are in a different server (by wwwroot), set it to $CFG->enrol
+ // - if we are in the same server (by wwwroot), maintain it unmodified.
+ if (empty($user->roles['student']->enrol)) {
+ $user->roles['student']->enrol = $CFG->enrol;
+ } else if ($restore->original_wwwroot != $CFG->wwwroot) {
+ $user->roles['student']->enrol = $CFG->enrol;
+ } else {
+ //Nothing to do. Leave it unmodified
+ }
+
//Insert data in user_students
//The structure is exactly as we need
$status = insert_record("user_students",$user->roles['student']);
case "CONFIRMED":
$this->info->tempuser->confirmed = $this->getContents();
break;
+ case "POLICYAGREED":
+ $this->info->tempuser->policyagreed = $this->getContents();
+ break;
case "DELETED":
$this->info->tempuser->deleted = $this->getContents();
break;
case "TIMEACCESS":
$this->info->temprole->timeaccess = $this->getContents();
break;
+ case "ENROL":
+ $this->info->temprole->enrol = $this->getContents();
+ break;
case "NAME":
$this->info->tempuserpreference->name = $this->getContents();
break;