2 /****************************************************************************/
4 /****************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or */
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************************/
15 define('AT_INCLUDE_PATH', '../../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_BACKUPS);
19 require(AT_INCLUDE_PATH.'../mods/_core/backups/classes/Backup.class.php');
20 require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
22 if (isset($_POST['backup_id'])) {
23 $ids = explode('_', $_POST['backup_id']);
28 if (isset($_POST['restore'], $backup_id)) {
29 header('Location: restore.php?backup_id=' . $backup_id . SEP . 'course=' . $course);
32 } else if (isset($_POST['download'], $backup_id)) {
33 $Backup = new Backup($db, $course);
34 $Backup->download($backup_id);
35 exit; // never reached
37 } else if (isset($_POST['delete'], $backup_id)) {
38 header('Location: delete.php?backup_id=' . $backup_id . SEP . 'course=' . $course);
41 } else if (isset($_POST['edit'], $backup_id)) {
42 header('Location: edit.php?backup_id=' . $backup_id . SEP . 'course=' . $course);
44 } else if (!empty($_POST) && !$backup_id) {
45 $msg->addError('NO_ITEM_SELECTED');
49 require(AT_INCLUDE_PATH.'header.inc.php');
52 <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
53 <input type="hidden" name="course" value="<?php echo $_REQUEST['course']; ?>" />
55 <table class="data" summary="" rules="groups" style="width: 90%">
58 <th><?php echo _AT('file_name'); ?></th>
59 <th><?php echo _AT('date_created'); ?></th>
60 <th><?php echo _AT('file_size'); ?></th>
61 <th><?php echo _AT('description'); ?></th>
66 <td colspan="4"><input type="submit" name="restore" value="<?php echo _AT('restore'); ?>" />
67 <input type="submit" name="download" value="<?php echo _AT('download'); ?>" />
68 <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />
69 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" /></td>
75 $Backup = new Backup($db);
77 if (isset($_REQUEST['course']) && $_REQUEST['course']) {
78 $course = intval($_REQUEST['course']);
79 $sql = "SELECT course_id, title FROM ".TABLE_PREFIX."courses WHERE course_id=$course ORDER BY title";
81 $sql = "SELECT course_id, title FROM ".TABLE_PREFIX."courses ORDER BY title";
83 $result = mysql_query($sql, $db);
84 while ($course = mysql_fetch_assoc($result)) {
86 $Backup->setCourseID($course['course_id']);
87 $list = $Backup->getAvailableList();
89 echo '<tr><th colspan="4">'.$course['title'].'</th></tr>';
91 if (empty($list)) { ?>
93 <td colspan="4"><?php echo _AT('none_found'); ?></td>
99 foreach ($list as $row) {
100 echo '<tr onmousedown="document.form1[\'c'.$row['backup_id'].'_'.$row['course_id'].'\'].checked = true; rowselect(this);" id="r_'.$row['backup_id'].'"><td><input type="radio" value="'.$row['backup_id'].'_'.$row['course_id'].'" name="backup_id" id="c'.$row['backup_id'].'_'.$row['course_id'].'" />';
101 echo '<label for="c'.$row['backup_id'].'_'.$row['course_id'].'">'.$row['file_name'].'</label></td>';
102 echo '<td>'.AT_date(_AT('filemanager_date_format'), $row['date_timestamp'], AT_DATE_UNIX_TIMESTAMP).'</td>';
103 echo '<td align="right">'.get_human_size($row['file_size']).'</td>';
104 echo '<td>'.AT_print($row['description'], 'backups.description').'</td>';
111 <?php if (!$num_backups): ?>
113 <td colspan="4"><?php echo _AT('none_found'); ?></td>
120 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>