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 /****************************************************************************/
13 // $Id: restore.php 10142 2010-08-17 19:17:26Z hwong $
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 authenticate(AT_PRIV_ADMIN);
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 $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">
54 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('restore'); ?></legend>
56 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><?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'); ?>" class="button"/>
83 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" class="button"/>
89 <script language="javascript" type="text/javascript">
91 function selectAll() {
92 if (document.form.all.checked == true) {
93 document.form.m0.checked = true;
94 <?php foreach($keys as $module_name): $module =& $modules[$module_name]; if ($module->isBackupable()): ?>
95 document.form.m<?php echo ++$i; ?>.checked = true;
96 <?php endif; endforeach; ?>
98 document.form.m0.checked = false;
100 <?php foreach($keys as $module_name): $module =& $modules[$module_name]; if ($module->isBackupable()): ?>
101 document.form.m<?php echo ++$i; ?>.checked = false;
102 <?php endif; endforeach; ?>
108 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>