2 /****************************************************************************/
4 /****************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton */
6 /* Adaptive Technology Resource Centre / University of Toronto */
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');
18 authenticate(AT_PRIV_ADMIN);
19 require(AT_INCLUDE_PATH.'classes/Backup/Backup.class.php');
20 require(AT_INCLUDE_PATH.'lib/filemanager.inc.php');
22 $Backup =& new Backup($db, $_SESSION['course_id']);
24 if (!isset($_REQUEST['backup_id'])) {
25 header('Location: index.php');
29 if (isset($_POST['cancel'])) {
30 $msg->addFeedback('CANCELLED');
31 header('Location: index.php');
33 } else if (isset($_POST['submit'])) {
34 if (!$_POST['material']) {
35 $msg->addError(array('EMPTY_FIELDS', _AT('material')));
37 $Backup->restore($_POST['material'], $_POST['action'], $_POST['backup_id']);
39 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
40 header('Location: index.php');
45 require(AT_INCLUDE_PATH.'header.inc.php');
47 $row = $Backup->getRow($_REQUEST['backup_id']);
51 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
52 <input type="hidden" name="backup_id" value="<?php echo $_REQUEST['backup_id']; ?>" />
54 <div class="input-form">
56 <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><?php echo _AT('material'); ?><br />
58 <input type="checkbox" value="1" name="all" id="all" onclick="javascript:selectAll();" /><label for="all"><?php echo _AT('material_select_all'); ?></label><br /><br />
60 <input type="checkbox" value="1" name='material[properties]' id='m0' /><label for='m0'><?php echo _AT('banner'); ?></label><br />
63 $modules = $moduleFactory->getModules(AT_MODULE_STATUS_ENABLED, 0, TRUE);
64 $keys = array_keys($modules);
66 <?php foreach($keys as $module_name): ?>
67 <?php $module =& $modules[$module_name]; ?>
68 <?php if ($module->isBackupable()): ?>
69 <input type="checkbox" value="1" name="material[<?php echo $module_name; ?>]" id="m<?php echo ++$i; ?>" /><label for="m<?php echo $i; ?>"><?php echo $module->getName(); ?></label><br />
75 <?php echo _AT('action'); ?><br />
76 <input type="radio" checked="checked" name="action" value="append" id="append" /><label for="append"><?php echo _AT('append_content'); ?></label><br />
78 <input type="radio" name="action" value="overwrite" id="overwrite" /><label for="overwrite"><?php echo _AT('overwite_content'); ?></label><br />
81 <div class="row buttons">
82 <input type="submit" name="submit" value="<?php echo _AT('restore'); ?>" />
83 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
88 <script language="javascript" type="text/javascript">
90 function selectAll() {
91 if (document.form.all.checked == true) {
92 document.form.m0.checked = true;
93 <?php foreach($keys as $module_name): $module =& $modules[$module_name]; if ($module->isBackupable()): ?>
94 document.form.m<?php echo ++$i; ?>.checked = true;
95 <?php endif; endforeach; ?>
97 document.form.m0.checked = false;
99 <?php foreach($keys as $module_name): $module =& $modules[$module_name]; if ($module->isBackupable()): ?>
100 document.form.m<?php echo ++$i; ?>.checked = false;
101 <?php endif; endforeach; ?>
107 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>