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']);
38 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
39 header('Location: index.php');
44 require(AT_INCLUDE_PATH.'header.inc.php');
46 $row = $Backup->getRow($_REQUEST['backup_id']);
50 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
51 <input type="hidden" name="backup_id" value="<?php echo $_REQUEST['backup_id']; ?>" />
53 <div class="input-form">
55 <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><?php echo _AT('material'); ?><br />
57 <input type="checkbox" value="1" name="all" id="all" onclick="javascript:selectAll();" /><label for="all"><?php echo _AT('material_select_all'); ?></label><br /><br />
59 <input type="checkbox" value="1" name='material[properties]' id='m0' /><label for='m0'><?php echo _AT('banner'); ?></label><br />
62 $modules = $moduleFactory->getModules(AT_MODULE_STATUS_ENABLED, 0, TRUE);
63 $keys = array_keys($modules);
65 <?php foreach($keys as $module_name): ?>
66 <?php $module =& $modules[$module_name]; ?>
67 <?php if ($module->isBackupable()): ?>
68 <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 />
74 <?php echo _AT('action'); ?><br />
75 <input type="radio" checked="checked" name="action" value="append" id="append" /><label for="append"><?php echo _AT('append_content'); ?></label><br />
77 <input type="radio" name="action" value="overwrite" id="overwrite" /><label for="overwrite"><?php echo _AT('overwite_content'); ?></label><br />
80 <div class="row buttons">
81 <input type="submit" name="submit" value="<?php echo _AT('restore'); ?>" />
82 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
87 <script language="javascript" type="text/javascript">
89 function selectAll() {
90 if (document.form.all.checked == true) {
91 document.form.m0.checked = true;
92 <?php foreach($keys as $module_name): $module =& $modules[$module_name]; if ($module->isBackupable()): ?>
93 document.form.m<?php echo ++$i; ?>.checked = true;
94 <?php endif; endforeach; ?>
96 document.form.m0.checked = false;
98 <?php foreach($keys as $module_name): $module =& $modules[$module_name]; if ($module->isBackupable()): ?>
99 document.form.m<?php echo ++$i; ?>.checked = false;
100 <?php endif; endforeach; ?>
106 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>