made a copy
[atutor.git] / tools / backup / create.php
1 <?php
2 /****************************************************************************/
3 /* ATutor                                                                                                                                       */
4 /****************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton        */
6 /* Adaptive Technology Resource Centre / University of Toronto                          */
7 /* http://atutor.ca                                                                                                                     */
8 /*                                                                                                                                                      */
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 /****************************************************************************/
13 // $Id$
14
15 define('AT_INCLUDE_PATH', '../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 authenticate(AT_PRIV_ADMIN);
18
19 $course = $_SESSION['course_id'];
20 require(AT_INCLUDE_PATH.'classes/Backup/Backup.class.php');
21 $Backup =& new Backup($db, $_SESSION['course_id']);
22
23 if (isset($_POST['cancel'])) {
24         $msg->addFeedback('CANCELLED');
25         header('Location: index.php');
26         exit;
27 } else if (isset($_POST['submit'])) {
28         //make backup of current course
29         $Backup->create($_POST['description']);
30         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
31         header('Location: index.php');
32         exit;
33 }
34
35 require(AT_INCLUDE_PATH.'header.inc.php');
36
37 ?>
38 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
39
40 <div class="input-form">
41         <fieldset class="group_form"><legend class="group_form"><?php echo _AT('create_backup'); ?></legend>
42         <div class="row">
43                 <?php echo _AT('create_backup_about', AT_COURSE_BACKUPS); ?>
44         </div>
45
46         <?php if ($Backup->getNumAvailable() >= AT_COURSE_BACKUPS): ?>
47                 <div class="row">
48                         <p><strong><?php echo _AT('max_backups_reached'); ?></strong></p>
49                 </div>
50         <?php else: ?>
51                 <div class="row">
52                         <label for="desc"><?php echo _AT('optional_description'); ?></label>
53                         <textarea cols="35" rows="2" id="desc" name="description"></textarea>
54                 </div>
55
56                 <div class="row buttons">
57                         <input type="submit" name="submit" value="<?php echo _AT('create'); ?>" accesskey="s" /> 
58                         <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
59                 </div>
60         <?php endif; ?>
61 </div>
62 </form>
63
64 <?php require (AT_INCLUDE_PATH.'footer.inc.php');  ?>