From 7a9e8dae461f5092545825d4e2a5323eba3bdb7f Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 24 Feb 2004 13:46:12 +0000 Subject: [PATCH] Preliminary support of backup_logs included. It doesn't show info yet but I need to commit it now (traveling next two hours) :-) --- backup/log.php | 98 ++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/backup/log.php b/backup/log.php index 854af5082a..5fd4031602 100644 --- a/backup/log.php +++ b/backup/log.php @@ -4,6 +4,8 @@ require_once("../config.php"); require_once("../backup/lib.php"); + optional_variable($courseid); + require_login(); if (!isadmin()) { @@ -14,8 +16,9 @@ error("Site isn't defined!"); } -/// Otherwise print the form. - + //Get needed strings + $backuploglaststatus = get_string("backuploglaststatus"); + $backuplogdetailed = get_string("backuplogdetailed"); $stradmin = get_string("administration"); $strconfiguration = get_string("configuration"); $strbackup = get_string("backup"); @@ -34,56 +37,59 @@ "$strbackup -> ". $strlogs); - print_heading($strbackup); - - print_simple_box("
".get_string("backuploglaststatus")."
", "center", "50%"); - echo "
"; - - print_simple_box_start("center", "", "$THEME->cellheading"); - - //Now, get every record from backup_courses - $courses = get_records("backup_courses"); - - if (!$courses) { - notify("No logs found!"); - } else { - echo ""; - //Print table header - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - foreach ($courses as $course) { - //Get the course shortname - $coursename = get_field ("course","fullname","id",$course->courseid); - if ($coursename) { - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - if (!$course->laststatus) { - echo ""; - } else { - echo ""; + //Decide when to show last execution logs or detailed logs + //Lastlog view + if (!$courseid) { + print_heading($backuploglaststatus); + print_simple_box_start("center", "", "$THEME->cellheading"); + //Now, get every record from backup_courses + $courses = get_records("backup_courses"); + + if (!$courses) { + notify("No logs found!"); + } else { + echo "
$strcourse$strtimetaken$strstatus$strnext
courseid\">".$coursename."".userdate($course->laststarttime,$strftimedatetime)." - ".userdate($course->lastendtime,$strftimedatetime)."".$strerror."".$strok."
"; + //Print table header + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + foreach ($courses as $course) { + //Get the course shortname + $coursename = get_field ("course","fullname","id",$course->courseid); + if ($coursename) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + if (!$course->laststatus) { + echo ""; + } else { + echo ""; + } + echo ""; + echo ""; } - echo ""; - echo ""; } - - - - - + echo "
$strcourse$strtimetaken$strstatus$strnext
courseid\">".$coursename."".userdate($course->laststarttime,$strftimedatetime)." - ".userdate($course->lastendtime,$strftimedatetime)."".$strerror."".$strok."".userdate($course->nextstarttime,$strftimedatetime)."
".userdate($course->nextstarttime,$strftimedatetime)."
"; } - echo ""; + print_simple_box_end(); + //Detailed View !! + } else { + print_heading($backuplogdetailed); + print_simple_box_start("center", "", "$THEME->cellheading"); + + //First, me get all the distinct backups for that course in backup_log + $executions = get_records_sql("SELECT DISTINCT id,laststarttime + FROM {$CFG->prefix}backup_log + WHERE courseid = '$courseid'"); + + print_simple_box_end(); } - - print_simple_box_end(); - print_footer(); ?> -- 2.39.5