+ course data..................................NO EXISTS
+ user data....................................NO EXISTS
+ files........................................NO EXISTS
- x journals........................................NO EXISTS
+ x journals........................................IN PROGRESS
+ course data..................................NO EXISTS
+ user data....................................NO EXISTS
+ files........................................NO EXISTS
- x peer graded assignments.........................NO EXISTS
+ x peer graded assignments.........................IN PROGRESS
+ course data..................................NO EXISTS
+ user data....................................NO EXISTS
+ files........................................NO EXISTS
+ course data..................................NO EXISTS
+ user data....................................NO EXISTS
+ files........................................NO EXISTS
- x resources.......................................NO EXISTS
+ x resources.......................................IN PROGRESS
+ course data..................................NO EXISTS
+ user data....................................NO EXISTS
+ files........................................NO EXISTS
- x surveys.........................................NO EXISTS
+ x surveys.........................................IN PROGRESS
+ course data..................................NO EXISTS
+ user data....................................NO EXISTS
+ + files........................................NO EXISTS
- Compress the backup (zip)..................................NO EXISTS
- XML File................................................NO EXISTS
- Course Files............................................NO EXISTS
- User Files..............................................NO EXISTS
- - Browse backup files........................................NO EXISTS
+ - Browse backup files........................................DONE. TO FILE MANAGER
- Obtain info about backup files.............................NO EXISTS
- - Download backup files......................................NO EXISTS
- - Delete backup files........................................NO EXISTS
+ - Download backup files......................................DONE. TO FILE MANAGER
+ - Delete backup files........................................DONE. TO FILE MANAGER
- Program automatic backups..................................NO EXISTS
Restore Details:
- Course Files............................................NO EXISTS
- User Files..............................................NO EXISTS
- Obtain info about backup files.............................NO EXISTS
- - Upload backup files........................................NO EXISTS
+ - Upload backup files........................................DONE. TO FILE MANAGER
========== ========== ========== =========== =========== =========== ===
}
//Calculate the format string
$backup_name_format = get_string("backupnameformat");
- //If non-translated, use "%%Y%%m%%d-%%H%%M"
+ //If non-translated, use "%Y%m%d-%H%M"
if (substr($backup_name_format,0,1) == "[") {
$backup_name_format = "%%Y%%m%%d-%%H%%M";
}
-
$backup_name .= "-".userdate(time(),$backup_name_format,99,false).".zip";
echo $backup_name;
//Add as hidden name
echo "<input type=\"hidden\" name=\"backup_name\" value=\"".$backup_name."\">";
echo "</td></tr>";
+ //Calculate the temp dir name to do all the work
+ $tempdir_name = userdate(time(),"%Y%m%d%H%M",99,false);
+ //Add as hidden name
+ echo "<input type=\"hidden\" name=\"tempdir_name\" value=\"".$tempdir_name."\">";
+
//Line
echo "<tr><td colspan=\"2\"><hr noshade size=\"1\"></td></tr>";
--- /dev/null
+<?PHP //$Id$
+ //This php script contains all the stuff to backup/restore
+ //journal mods
+
+ //This is the "graphical" structure of the journal mod:
+ //
+ // journal
+ // (CL,pk->id)
+ // |
+ // |
+ // |
+ // journal_entries
+ // (UL,pk->id, fk->journal)
+ //
+ // Meaning: pk->primary key field of the table
+ // fk->foreign key to link with parent
+ // nt->nested field (recursive data)
+ // CL->course level info
+ // UL->user level info
+ // files->table may have files)
+ //
+ //-----------------------------------------------------------
+
+ function journal_backup_mods($course,$user_data=false) {
+ print "hola";
+ }
+
+ ////Return an array of info (name,value)
+ function journal_check_backup_mods($course,$user_data=false) {
+ //First the course data
+ $info[0][0] = get_string("modulenameplural","journal");
+ if ($ids = journal_ids ($course)) {
+ $info[0][1] = count($ids);
+ } else {
+ $info[0][1] = 0;
+ }
+
+ //Now, if requested, the user_data
+ if ($user_data) {
+ $info[1][0] = get_string("entries","journal");
+ if ($ids = journal_entry_ids_by_course ($course)) {
+ $info[1][1] = count($ids);
+ } else {
+ $info[1][1] = 0;
+ }
+ }
+ return $info;
+ }
+
+
+
+
+
+
+ // INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
+
+ //Returns an array of journals id
+ function journal_ids ($course) {
+
+ global $CFG;
+
+ return get_records_sql ("SELECT a.id, a.course
+ FROM {$CFG->prefix}journal a
+ WHERE a.course = '$course'");
+ }
+
+ //Returns an array of journal entries id
+ function journal_entry_ids_by_course ($course) {
+
+ global $CFG;
+
+ return get_records_sql ("SELECT s.id , s.journal
+ FROM {$CFG->prefix}journal_entries s,
+ {$CFG->prefix}journal a
+ WHERE a.course = '$course' AND
+ s.journal = a.id");
+ }
+?>
--- /dev/null
+<?PHP //$Id$
+ //This php script contains all the stuff to backup/restore
+ //pgassignment mods
+
+ //This is the "graphical" structure of the pgassignment mod:
+ //
+ // pgassignment
+ // (CL,pk->id)
+ // |
+ // -----------------------------------
+ // | |
+ // pgassignment_elements pgassignment_submissions
+ // (CL,pk->id, fk->pgassignment) (UL,pk->id, fk->pgassignment,files)
+ // |
+ // |
+ // |
+ // pgasignments_grades
+ // (UL,pk->id,fk->submission)
+ //
+ // Meaning: pk->primary key field of the table
+ // fk->foreign key to link with parent
+ // nt->nested field (recursive data)
+ // CL->course level info
+ // UL->user level info
+ // files->table may have files)
+ //
+ //-----------------------------------------------------------
+
+ function pgassignment_backup_mods($course,$user_data=false) {
+ print "hola";
+ }
+
+ ////Return an array of info (name,value)
+ function pgassignment_check_backup_mods($course,$user_data=false) {
+ //First the course data
+ $info[0][0] = get_string("modulenameplural","pgassignment");
+ if ($ids = pgassignment_ids ($course)) {
+ $info[0][1] = count($ids);
+ } else {
+ $info[0][1] = 0;
+ }
+ //Elements
+ $info[1][0] = get_string("elements","pgassignment");
+ if ($ids = pgassignment_element_ids_by_course ($course)) {
+ $info[1][1] = count($ids);
+ } else {
+ $info[1][1] = 0;
+ }
+
+ //Now, if requested, the user_data
+ if ($user_data) {
+ //Submissions
+ $info[2][0] = get_string("submissions","pgassignment");
+ if ($ids = pgassignment_submission_ids_by_course ($course)) {
+ $info[2][1] = count($ids);
+ } else {
+ $info[2][1] = 0;
+ }
+ //Grades
+ $info[3][0] = get_string("grades","pgassignment");
+ if ($ids = pgassignment_grade_ids_by_course ($course)) {
+ $info[3][1] = count($ids);
+ } else {
+ $info[3][1] = 0;
+ }
+ }
+ return $info;
+ }
+
+
+
+
+
+
+ // INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
+
+ //Returns an array of pgassignments id
+ function pgassignment_ids ($course) {
+
+ global $CFG;
+
+ return get_records_sql ("SELECT a.id, a.course
+ FROM {$CFG->prefix}pgassignment a
+ WHERE a.course = '$course'");
+ }
+
+ //Returns an array of pgassignment elements id
+ function pgassignment_element_ids_by_course ($course) {
+
+ global $CFG;
+
+ return get_records_sql ("SELECT s.id , s.pgassignment
+ FROM {$CFG->prefix}pgassignment_elements s,
+ {$CFG->prefix}pgassignment a
+ WHERE a.course = '$course' AND
+ s.pgassignment = a.id");
+ }
+
+ //Returns an array of pgassignment submissions id
+ function pgassignment_submission_ids_by_course ($course) {
+
+ global $CFG;
+
+ return get_records_sql ("SELECT s.id , s.pgassignment
+ FROM {$CFG->prefix}pgassignment_submissions s,
+ {$CFG->prefix}pgassignment a
+ WHERE a.course = '$course' AND
+ s.pgassignment = a.id");
+ }
+
+ //Returns an array of pgassignment grades id
+ function pgassignment_grade_ids_by_course ($course) {
+
+ global $CFG;
+
+ return get_records_sql ("SELECT g.id , g.submission, s.pgassignment
+ FROM {$CFG->prefix}pgassignment_grades g,
+ {$CFG->prefix}pgassignment_submissions s,
+ {$CFG->prefix}pgassignment a
+ WHERE a.course = '$course' AND
+ s.pgassignment = a.id AND
+ g.submission = s.id");
+ }
+
+?>
function resource_check_backup_mods($course,$user_data=false) {
//First the course data
$info[0][0] = get_string("modulenameplural","resource");
- if ($ids = choice_ids ($course)) {
+ if ($ids = resource_ids ($course)) {
$info[0][1] = count($ids);
} else {
$info[0][1] = 0;
// INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
//Returns an array of resources id
- function resources_ids ($course) {
+ function resource_ids ($course) {
global $CFG;
--- /dev/null
+<?PHP //$Id$
+ //This php script contains all the stuff to backup/restore
+ //survey mods
+
+ //This is the "graphical" structure of the survey mod:
+ // --------------------
+ // survey | survey_questions |
+ // (CL,pk->id) |(CL,pk->id,?????) |
+ // | --------------------
+ // |
+ // -----------------------------------
+ // | |
+ // survey_analysis survey_answers
+ // (UL,pk->id, fk->survey) (UL,pk->id, fk->survey)
+ //
+ // Meaning: pk->primary key field of the table
+ // fk->foreign key to link with parent
+ // nt->nested field (recursive data)
+ // CL->course level info
+ // UL->user level info
+ // files->table may have files)
+ //
+ //-----------------------------------------------------------
+
+ function survey_backup_mods() {
+ print "hola";
+ }
+
+ ////Return an array of info (name,value)
+ function survey_check_backup_mods($course,$user_data=false) {
+ //First the course data
+ $info[0][0] = get_string("modulenameplural","survey");
+ if ($ids = survey_ids ($course)) {
+ $info[0][1] = count($ids);
+ } else {
+ $info[0][1] = 0;
+ }
+
+ //Now, if requested, the user_data
+ if ($user_data) {
+ //Subscriptions
+ $info[1][0] = get_string("answers","survey");
+ if ($ids = survey_answer_ids_by_course ($course)) {
+ $info[1][1] = count($ids);
+ } else {
+ $info[1][1] = 0;
+ }
+ }
+ return $info;
+ }
+
+
+
+
+
+
+ // INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
+
+ //Returns an array of surveys id
+ function survey_ids ($course) {
+
+ global $CFG;
+
+ return get_records_sql ("SELECT a.id, a.course
+ FROM {$CFG->prefix}survey a
+ WHERE a.course = '$course'");
+ }
+
+ //Returns an array of survey answer id
+ function survey_answer_ids_by_course ($course) {
+
+ global $CFG;
+
+ return get_records_sql ("SELECT s.id , s.survey
+ FROM {$CFG->prefix}survey_answers s,
+ {$CFG->prefix}forum a
+ WHERE a.course = '$course' AND
+ s.survey = a.id");
+ }
+
+?>