remove old readme
[atutor.git] / mods / _core / courses / admin / default_side.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12 // $Id$ $
13
14 define('AT_INCLUDE_PATH', '../../../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16
17 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
18
19
20 if (isset($_POST['cancel'])) {
21         $msg->addFeedback('CANCELLED');
22         header('Location: courses.php');
23         exit;
24 }
25
26 if (isset($_POST['submit'])) {
27
28         $side_menu = '';
29         $_stack_names = array();
30
31         foreach($_stacks as $name=>$file) {
32                 $_stack_names[] = $name;
33         }
34
35         $_POST['stack'] = array_unique($_POST['stack']);
36         $_POST['stack'] = array_intersect($_POST['stack'], $_stack_names);
37
38         foreach($_POST['stack'] as $dropdown) {
39                 if($dropdown != '') {
40                         $side_menu .= $dropdown . '|';
41                 }
42         }
43         $side_menu = substr($side_menu, 0, -1);
44
45         if (!($_config_defaults['side_defaults'] == $side_menu) && (strlen($side_menu) < 256)) {
46                 $sql    = "REPLACE INTO ".TABLE_PREFIX."config VALUES('side_defaults', '$side_menu')";
47         } else if ($_config_defaults['side_defaults'] == $side_menu) {
48                 $sql    = "DELETE FROM ".TABLE_PREFIX."config WHERE name='side_defaults'";
49         }
50
51         $result = mysql_query($sql, $db);
52         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
53         header('Location:'. $_SERVER[PHP_SELF]);
54         exit;
55 }
56
57 require(AT_INCLUDE_PATH.'header.inc.php');
58
59 $num_stack = count($_stacks);   
60 $side_menu = explode('|', $_config['side_defaults']);
61 $savant->assign('side_menu', $side_menu);
62 $savant->assign('num_stack', $num_stack);
63 $savant->display('admin/courses/default_side.tmpl.php');
64 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>