diff --git a/backup/log.php b/backup/log.php
index 854af5082a8..5fd40316024 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);
+ //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");
- 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 "| $strcourse | ";
- echo "$strtimetaken | ";
- echo "$strstatus | ";
- echo "$strnext | ";
- foreach ($courses as $course) {
- //Get the course shortname
- $coursename = get_field ("course","fullname","id",$course->courseid);
- if ($coursename) {
- echo "
";
- echo "| courseid\">".$coursename." | ";
- echo "".userdate($course->laststarttime,$strftimedatetime)." | ";
- echo " - | ";
- echo "".userdate($course->lastendtime,$strftimedatetime)." | ";
- if (!$course->laststatus) {
- echo "".$strerror." | ";
- } else {
- echo "".$strok." | ";
+ if (!$courses) {
+ notify("No logs found!");
+ } else {
+ echo "";
+ //Print table header
+ echo "";
+ echo "| $strcourse | ";
+ echo "$strtimetaken | ";
+ echo "$strstatus | ";
+ echo "$strnext | ";
+ foreach ($courses as $course) {
+ //Get the course shortname
+ $coursename = get_field ("course","fullname","id",$course->courseid);
+ if ($coursename) {
+ echo "
";
+ echo "| courseid\">".$coursename." | ";
+ echo "".userdate($course->laststarttime,$strftimedatetime)." | ";
+ echo " - | ";
+ echo "".userdate($course->lastendtime,$strftimedatetime)." | ";
+ if (!$course->laststatus) {
+ echo "".$strerror." | ";
+ } else {
+ echo "".$strok." | ";
+ }
+ echo "".userdate($course->nextstarttime,$strftimedatetime)." | ";
+ echo "
";
}
- echo "".userdate($course->nextstarttime,$strftimedatetime)." | ";
- echo "";
}
-
-
-
-
-
+ echo "
";
}
- 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();
?>