2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay & Joel Kronenberg */
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');
17 authenticate(AT_PRIV_STYLES);
19 if (isset($_POST['up'])) {
20 $up = key($_POST['up']);
21 $_new_modules = array();
22 if (isset($_POST['main'])) {
23 foreach ($_POST['main'] as $m) {
25 $last_m = array_pop($_new_modules);
27 $_new_modules[] = $last_m;
33 $_POST['main'] = $_new_modules;
36 if (isset($_POST['home'])) {
37 $_new_modules = array();
38 foreach ($_POST['home'] as $m) {
40 $last_m = array_pop($_new_modules);
42 $_new_modules[] = $last_m;
48 $_POST['home'] = $_new_modules;
51 $_POST['submit'] = TRUE;
52 } else if (isset($_POST['down'])) {
53 $_new_modules = array();
55 $down = key($_POST['down']);
57 if (isset($_POST['main'])) {
58 foreach ($_POST['main'] as $m) {
65 $_new_modules[] = $down;
70 $_POST['main'] = $_new_modules;
73 if (isset($_POST['home'])) {
74 $_new_modules = array();
75 foreach ($_POST['home'] as $m) {
82 $_new_modules[] = $down;
87 $_POST['home'] = $_new_modules;
90 $_POST['submit'] = TRUE;
93 // 'search.php', removed
94 if (isset($_POST['submit'])) {
96 if (isset($_POST['main'])) {
97 $_POST['main'] = array_intersect($_POST['main'], $_modules);
98 $_POST['main'] = array_unique($_POST['main']);
99 $main_links = implode('|', $_POST['main']);
104 if (isset($_POST['home'])) {
105 $_POST['home'] = array_intersect($_POST['home'], $_modules);
106 $_POST['home'] = array_unique($_POST['home']);
107 $home_links = implode('|', $_POST['home']);
112 $sql = "UPDATE ".TABLE_PREFIX."courses SET home_links='$home_links', main_links='$main_links' WHERE course_id=$_SESSION[course_id]";
113 $result = mysql_query($sql, $db);
115 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
116 header('Location: modules.php');
121 require(AT_INCLUDE_PATH.'header.inc.php');
125 $_current_modules = array_slice($_pages[AT_NAV_COURSE], 1, -1); // removes index.php and tools/index.php
126 $num_main = count($_current_modules);
127 //main and home merged
128 $_current_modules = array_merge( (array) $_current_modules, array_diff($_pages[AT_NAV_HOME],$_pages[AT_NAV_COURSE]) );
129 $num_modules = count($_current_modules);
131 $_current_modules = array_merge( (array) $_current_modules, array_diff($_modules, $_current_modules));
136 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
137 <table class="data static" rules="rows" summary="">
140 <th scope="cols"><?php echo _AT('section'); ?></th>
141 <th><?php echo _AT('location'); ?></th>
142 <th><?php echo _AT('order'); ?></th>
147 <td colspan="3" style="text-align:right;"><input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" /></td>
151 <?php foreach ($_current_modules as $module): ?>
155 if (isset($_pages[$module]['title'])) {
156 echo $_pages[$module]['title'];
158 echo _AT($_pages[$module]['title_var']);
161 <?php if (in_array($module, $_pages[AT_NAV_COURSE])): ?>
162 <input type="checkbox" name="main[]" value="<?php echo $module; ?>" id="m<?php echo $count; ?>" checked="checked" /><label for="m<?php echo $count; ?>"><?php echo _AT('main_navigation'); ?></label>
164 <input type="checkbox" name="main[]" value="<?php echo $module; ?>" id="m<?php echo $count; ?>" /><label for="m<?php echo $count; ?>"><?php echo _AT('main_navigation'); ?></label>
167 <?php if (in_array($module, $_pages[AT_NAV_HOME])): ?>
168 <input type="checkbox" name="home[]" value="<?php echo $module; ?>" id="h<?php echo $count; ?>" checked="checked" /><label for="h<?php echo $count; ?>"><?php echo _AT('home'); ?></label>
170 <input type="checkbox" name="home[]" value="<?php echo $module; ?>" id="h<?php echo $count; ?>" /><label for="h<?php echo $count; ?>"><?php echo _AT('home'); ?></label>
174 <?php if (!in_array($module, $_pages[AT_NAV_HOME]) && !in_array($module, $_pages[AT_NAV_COURSE])): ?>
177 <?php if (($count != $num_main+1) && ($count > 1)): ?>
178 <input type="submit" name="up[<?php echo $module; ?>]" value="<?php echo _AT('move_up'); ?>" title="<?php echo _AT('move_up'); ?>" style="background-color: white; border: 1px solid; padding: 0px;" />
180 <img src="images/clr.gif" alt="" width="12" />
182 <?php if (($count != $num_main) && ($count < $num_modules)): ?>
183 <input type="submit" name="down[<?php echo $module; ?>]" value="<?php echo _AT('move_down'); ?>" title="<?php echo _AT('move_down'); ?>" style="background-color: white; border: 1px solid; padding: 0px;"/>
185 <img src="images/clr.gif" alt="" width="12" />
195 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>