From: stronk7 Date: Sun, 18 May 2003 15:51:20 +0000 (+0000) Subject: Course Header and Backup info is showed now !! X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=76bf541df831f056fa7eb3223ce40fb311fb53eb;p=moodle.git Course Header and Backup info is showed now !! I'll start using sessions to mange all this data. --- diff --git a/backup/restore_precheck.html b/backup/restore_precheck.html index a9453cecd9..b16a000e33 100644 --- a/backup/restore_precheck.html +++ b/backup/restore_precheck.html @@ -74,8 +74,6 @@ $info = restore_read_xml_info ($xml_file); //Reading course_header from file $course_header = restore_read_xml_course_header ($xml_file); -print_object ($info); -print_object ($course_header); } //End the main ul @@ -85,12 +83,17 @@ print_object ($course_header); echo ""; echo ""; - if (!$status) { - error ("An error has ocurred"); + //Now we print in other table, the backup and the course it contains info + if ($info and $course_header and $status) { + //First, the course info + $status = restore_print_course_header($course_header); + //Now, the backup info + if ($status) { + $status = restore_print_info($info); + } } - - if ($info and $course_header) { + if (!$status) { + error ("An error has ocurred"); } - ?> diff --git a/backup/restorelib.php b/backup/restorelib.php index a5ba570a0c..554e1950fe 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -64,6 +64,120 @@ return $info; } + + //This function prints the contents from the info parammeter passed + function restore_print_info ($info) { + + $status = true; + if ($info) { + //This is tha align to every ingo table + $table->align = array ("RIGHT","LEFT"); + //This is the nowrap clause + $table->wrap = array ("","NOWRAP"); + //The width + $table->width = "70%"; + //Put interesting info in table + //The backup original name + $tab[0][0] = "".get_string("backuporiginalname").":"; + $tab[0][1] = $info->backup_name; + //The moodle version + $tab[1][0] = "".get_string("moodleversion").":"; + $tab[1][1] = $info->backup_moodle_release." (".$info->backup_moodle_version.")"; + //The backup version + $tab[2][0] = "".get_string("backupversion").":"; + $tab[2][1] = $info->backup_backup_release." (".$info->backup_backup_version.")"; + //The backup date + $tab[3][0] = "".get_string("backupdate").":"; + $tab[3][1] = userdate($info->backup_date); + //Print title + print_heading(get_string("backup").":"); + $table->data = $tab; + //Print backup general info + print_table($table); + //Now backup contents in another table + $tab = array(); + //First mods info + $mods = $info->mods; + $elem = 0; + foreach ($mods as $key => $mod) { + $tab[$elem][0] = "".get_string("modulenameplural",$key).":"; + if ($mod->backup == "false") { + $tab[$elem][1] = get_string("notincluded"); + } else { + if ($mod->userinfo == "true") { + $tab[$elem][1] = get_string("included")." ".get_string("withuserdata"); + } else { + $tab[$elem][1] = get_string("included")." ".get_string("withoutuserdata"); + } + } + $elem++; + } + //Users info + $tab[$elem][0] = "".get_string("users").":"; + $tab[$elem][1] = get_string($info->backup_users); + $elem++; + //Logs info + $tab[$elem][0] = "".get_string("logs").":"; + if ($info->backup_logs == "true") { + $tab[$elem][1] = get_string("yes"); + } else { + $tab[$elem][1] = get_string("no"); + } + $elem++; + //User Files info + $tab[$elem][0] = "".get_string("userfiles").":"; + if ($info->backup_user_files == "true") { + $tab[$elem][1] = get_string("yes"); + } else { + $tab[$elem][1] = get_string("no"); + } + $elem++; + //Course Files info + $tab[$elem][0] = "".get_string("coursefiles").":"; + if ($info->backup_course_files == "true") { + $tab[$elem][1] = get_string("yes"); + } else { + $tab[$elem][1] = get_string("no"); + } + $elem++; + $table->data = $tab; + //Print title + print_heading(get_string("backupdetails").":"); + //Print backup general info + print_table($table); + } else { + $status = false; + } + + return $status; + } + + //This function prints the contents from the course_header parammeter passed + function restore_print_course_header ($course_header) { + + $status = true; + if ($course_header) { + //This is tha align to every ingo table + $table->align = array ("RIGHT","LEFT"); + //The width + $table->width = "70%"; + //Put interesting course header in table + //The course name + $tab[0][0] = "".get_string("name").":"; + $tab[0][1] = $course_header->course_fullname." (".$course_header->course_shortname.")"; + //The course summary + $tab[1][0] = "".get_string("summary").":"; + $tab[1][1] = $course_header->course_summary; + $table->data = $tab; + //Print title + print_heading(get_string("course").":"); + //Print backup course header info + print_table($table); + } else { + $status = false; + } + return $status; + } //=====================================================================================