require_once("../config.php");
require_once("../backup/lib.php");
+ optional_variable($courseid);
+
require_login();
if (!isadmin()) {
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");
"<a href=\"../admin/backup.php\">$strbackup</a> -> ".
$strlogs);
- print_heading($strbackup);
-
- print_simple_box("<center>".get_string("backuploglaststatus")."</center>", "center", "50%");
- echo "<br />";
-
- 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 "<table border=0 align=center cellpadding=3 cellspacing=3>";
- //Print table header
- echo "<tr nowrap>";
- echo "<td nowrap align=center><font size=3>$strcourse</font></td>";
- echo "<td nowrap align=center colspan=3><font size=3>$strtimetaken</font></td>";
- echo "<td nowrap align=center><font size=3>$strstatus</font></td>";
- echo "<td nowrap align=center><font size=3>$strnext</font></td>";
- foreach ($courses as $course) {
- //Get the course shortname
- $coursename = get_field ("course","fullname","id",$course->courseid);
- if ($coursename) {
- echo "<tr nowrap>";
- echo "<td nowrap><font size=2><a href=\"../course/view.php?id=$course->courseid\">".$coursename."</a></td>";
- echo "<td nowrap><font size=2>".userdate($course->laststarttime,$strftimedatetime)."</td>";
- echo "<td nowrap><font size=2> - </td>";
- echo "<td nowrap><font size=2>".userdate($course->lastendtime,$strftimedatetime)."</td>";
- if (!$course->laststatus) {
- echo "<td nowrap align=center><font size=2 color=red>".$strerror."</td>";
- } else {
- echo "<td nowrap align=center><font size=2 color=green>".$strok."</td>";
+ //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 "<table border=0 align=center cellpadding=3 cellspacing=3>";
+ //Print table header
+ echo "<tr nowrap>";
+ echo "<td nowrap align=center><font size=3>$strcourse</font></td>";
+ echo "<td nowrap align=center colspan=3><font size=3>$strtimetaken</font></td>";
+ echo "<td nowrap align=center><font size=3>$strstatus</font></td>";
+ echo "<td nowrap align=center><font size=3>$strnext</font></td>";
+ foreach ($courses as $course) {
+ //Get the course shortname
+ $coursename = get_field ("course","fullname","id",$course->courseid);
+ if ($coursename) {
+ echo "<tr nowrap>";
+ echo "<td nowrap><font size=2><a href=\"../course/view.php?id=$course->courseid\">".$coursename."</a></td>";
+ echo "<td nowrap><font size=2>".userdate($course->laststarttime,$strftimedatetime)."</td>";
+ echo "<td nowrap><font size=2> - </td>";
+ echo "<td nowrap><font size=2>".userdate($course->lastendtime,$strftimedatetime)."</td>";
+ if (!$course->laststatus) {
+ echo "<td nowrap align=center><font size=2 color=red>".$strerror."</td>";
+ } else {
+ echo "<td nowrap align=center><font size=2 color=green>".$strok."</td>";
+ }
+ echo "<td nowrap><font size=2>".userdate($course->nextstarttime,$strftimedatetime)."</td>";
+ echo "</tr>";
}
- echo "<td nowrap><font size=2>".userdate($course->nextstarttime,$strftimedatetime)."</td>";
- echo "</tr>";
}
-
-
-
-
-
+ echo "</table>";
}
- echo "</table>";
+ 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();
?>