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 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_MODULES);
19 if (isset($_POST['cancel'])) {
20 $msg->addFeedback('CANCELLED');
21 header('Location: ../courses.php');
25 if (isset($_POST['up'])) {
26 $up = key($_POST['up']);
27 $_new_modules = array();
28 if (isset($_POST['main'])) {
29 foreach ($_POST['main'] as $m) {
31 $last_m = array_pop($_new_modules);
33 $_new_modules[] = $last_m;
39 $_POST['main'] = $_new_modules;
41 if (isset($_POST['home'])) {
42 $_new_modules = array();
43 foreach ($_POST['home'] as $m) {
45 $last_m = array_pop($_new_modules);
47 $_new_modules[] = $last_m;
52 $_POST['home'] = $_new_modules;
55 $_POST['submit'] = TRUE;
56 } else if (isset($_POST['down'])) {
57 $_new_modules = array();
59 $down = key($_POST['down']);
61 if (isset($_POST['main'])) {
62 foreach ($_POST['main'] as $m) {
69 $_new_modules[] = $down;
74 $_POST['main'] = $_new_modules;
77 if (isset($_POST['home'])) {
78 $_new_modules = array();
79 foreach ($_POST['home'] as $m) {
86 $_new_modules[] = $down;
91 $_POST['home'] = $_new_modules;
94 $_POST['submit'] = TRUE;
97 if (isset($_POST['submit'])) {
98 if (isset($_POST['main'])) {
99 $_POST['main'] = array_unique($_POST['main']);
100 $_POST['main'] = array_filter($_POST['main']); // remove empties
101 $main_defaults = implode('|', $_POST['main']);
107 if (isset($_POST['home'])) {
108 $_POST['home'] = array_unique($_POST['home']);
109 $_POST['home'] = array_filter($_POST['home']); // remove empties
110 $home_defaults = implode('|', $_POST['home']);
115 if (!($_config_defaults['main_defaults'] == $main_defaults) && (strlen($main_defaults) < 256)) {
116 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES('main_defaults', '$main_defaults')";
117 $result = mysql_query($sql, $db);
119 $sql = "DELETE FROM ".TABLE_PREFIX."config WHERE name='main_defaults_2'";
120 } else if (!($_config_defaults['main_defaults'] == $main_defaults) && (strlen($main_defaults) > 255)) {
121 // we don't have to worry about chopping in the middle since they'll be combined anyway
122 $main_defaults_1 = substr($main_defaults, 0, 255);
123 $main_defaults_2 = substr($main_defaults, 255);
124 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES('main_defaults', '$main_defaults_1')";
125 $result = mysql_query($sql, $db);
127 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES('main_defaults_2', '$main_defaults_2')";
128 } else if ($_config_defaults['main_defaults'] == $main_defaults) {
129 $sql = "DELETE FROM ".TABLE_PREFIX."config WHERE name='main_defaults' OR name='name_defaults_2'";
131 $result = mysql_query($sql, $db);
134 if (!($_config_defaults['home_defaults'] == $home_defaults) && (strlen($home_defaults) < 256)) {
135 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES('home_defaults', '$home_defaults')";
136 $result = mysql_query($sql, $db);
138 $sql = "DELETE FROM ".TABLE_PREFIX."config WHERE name='home_defaults_2'";
140 } else if (!($_config_defaults['home_defaults'] == $home_defaults) && (strlen($home_defaults) > 255)) {
141 // we don't have to worry about chopping in the middle since they'll be combined anyway
142 $home_defaults_1 = substr($home_defaults, 0, 255);
143 $home_defaults_2 = substr($home_defaults, 255);
144 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES('home_defaults', '$home_defaults_1')";
145 $result = mysql_query($sql, $db);
147 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES('home_defaults_2', '$home_defaults_2')";
149 } else if ($_config_defaults['home_defaults'] == $home_defaults) {
150 $sql = "DELETE FROM ".TABLE_PREFIX."config WHERE name='home_defaults' OR name='home_defaults_2'";
152 $result = mysql_query($sql, $db);
154 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
155 header('Location: '.$_SERVER['PHP_SELF']);
160 require(AT_INCLUDE_PATH.'header.inc.php');
162 $main_defaults = explode('|', $_config['main_defaults']);
163 $home_defaults = explode('|', $_config['home_defaults']);
165 $main_defaults = array_filter($main_defaults); // remove empties
166 $home_defaults = array_filter($home_defaults); // remove empties
168 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
169 <table class="data static" rules="rows" summary="">
172 <th scope="cols"><?php echo _AT('section'); ?></th>
173 <th><?php echo _AT('location'); ?></th>
174 <th><?php echo _AT('order'); ?></th>
179 <td colspan="3" style="text-align:right;">
180 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
181 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
187 $module_list = $moduleFactory->getModules(AT_MODULE_STATUS_ENABLED);
188 $keys = array_keys($module_list);
190 foreach ($keys as $dir_name) {
191 $module =& $module_list[$dir_name];
193 if ($module->getStudentTools()) {
194 $student_tools[] = $module->getStudentTools();
201 $_current_modules = $main_defaults;
202 $num_main = count($_current_modules);
203 //main and home merged
204 $_current_modules = array_merge($_current_modules, array_diff($home_defaults, $main_defaults));
205 $num_modules = count($_current_modules);
207 $_current_modules = array_merge($_current_modules, array_diff($student_tools, $_current_modules));
210 foreach ($_current_modules as $tool) :
215 if (isset($_pages[$tool]['title'])) {
216 echo $_pages[$tool]['title'];
218 echo _AT($_pages[$tool]['title_var']);
221 <?php if (in_array($tool, $main_defaults)): ?>
222 <input type="checkbox" name="main[]" value="<?php echo $tool; ?>" id="m<?php echo $tool; ?>" checked="checked" /><label for="m<?php echo $tool; ?>"><?php echo _AT('main_navigation'); ?></label>
224 <input type="checkbox" name="main[]" value="<?php echo $tool; ?>" id="m<?php echo $tool; ?>" /><label for="m<?php echo $tool; ?>"><?php echo _AT('main_navigation'); ?></label>
227 <?php if (in_array($tool, $home_defaults)): ?>
228 <input type="checkbox" name="home[]" value="<?php echo $tool; ?>" id="h<?php echo $tool; ?>" checked="checked" /><label for="h<?php echo $tool; ?>"><?php echo _AT('home'); ?></label>
230 <input type="checkbox" name="home[]" value="<?php echo $tool; ?>" id="h<?php echo $tool; ?>" /><label for="h<?php echo $tool; ?>"><?php echo _AT('home'); ?></label>
234 <?php if (!in_array($tool, $home_defaults) && !in_array($tool, $main_defaults)): ?>
237 <?php if (($count != $num_main+1) && ($count > 1)): ?>
238 <input type="submit" name="up[<?php echo $tool; ?>]" value="<?php echo _AT('move_up'); ?>" title="<?php echo _AT('move_up'); ?>" style="background-color: white; border: 1px solid; padding: 0px;" />
240 <img src="images/clr.gif" alt="" width="12" />
242 <?php if (($count != $num_main) && ($count < $num_modules)): ?>
243 <input type="submit" name="down[<?php echo $tool; ?>]" value="<?php echo _AT('move_down'); ?>" title="<?php echo _AT('move_down'); ?>" style="background-color: white; border: 1px solid; padding: 0px;"/>
245 <img src="images/clr.gif" alt="" width="12" />
256 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>