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 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));
133 $savant->assign('num_modules', $num_modules);
134 $savant->assign('num_main', $num_main);
135 $savant->assign('current_modules', $_current_modules);
136 $savant->display('instructor/course_tools/modules.tmpl.php');
137 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>