2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2002-2009 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or */
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /************************************************************************/
\r
14 define('AT_INCLUDE_PATH', '../../../include/');
\r
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
16 authenticate(AT_PRIV_ADMIN);
\r
18 if (isset($_POST['up'])) {
\r
19 $up = key($_POST['up']);
\r
20 $_new_modules = array();
\r
21 if (isset($_POST['main'])) {
\r
22 foreach ($_POST['main'] as $m) {
\r
24 $last_m = array_pop($_new_modules);
\r
25 $_new_modules[] = $m;
\r
26 $_new_modules[] = $last_m;
\r
28 $_new_modules[] = $m;
\r
32 $_POST['main'] = $_new_modules;
\r
35 $_POST['submit'] = TRUE;
\r
36 } else if (isset($_POST['down'])) {
\r
37 $_new_modules = array();
\r
39 $down = key($_POST['down']);
\r
41 if (isset($_POST['main'])) {
\r
42 foreach ($_POST['main'] as $m) {
\r
47 $_new_modules[] = $m;
\r
49 $_new_modules[] = $down;
\r
54 $_POST['main'] = $_new_modules;
\r
57 $_POST['submit'] = TRUE;
\r
60 if (isset($_POST['submit'])) {
\r
61 if (isset($_POST['main'])) {
\r
62 $_POST['main'] = array_intersect($_POST['main'], $_modules);
\r
63 $_POST['main'] = array_unique($_POST['main']);
\r
64 $main_links = implode('|', $_POST['main']);
\r
68 $main_links = $addslashes($main_links);
\r
69 $sql = "REPLACE INTO ".TABLE_PREFIX."fha_student_tools VALUES ($_SESSION[course_id], '$main_links', 1)";
\r
70 $result = mysql_query($sql, $db);
\r
72 $msg->addFeedback('STUDENT_TOOLS_SAVED');
\r
73 header('Location: '.$_SERVER['PHP_SELF']);
\r
77 require(AT_INCLUDE_PATH.'header.inc.php');
\r
79 $fha_student_tools = array();
\r
81 $sql = "SELECT links FROM ".TABLE_PREFIX."fha_student_tools WHERE course_id=$_SESSION[course_id] AND links <> ''";
\r
82 $result = mysql_query($sql, $db);
\r
83 if ($row = mysql_fetch_assoc($result)) {
\r
84 $fha_student_tools = explode('|', $row['links']);
\r
87 $_current_modules = array_merge($fha_student_tools, array_diff($_modules, $fha_student_tools));
\r
89 $num_modules = count($fha_student_tools);
\r
91 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
\r
92 <table class="data" rules="rows" summary="">
\r
95 <th scope="cols"><?php echo _AT('section'); ?></th>
\r
96 <th><?php echo _AT('order'); ?></th>
\r
101 <td colspan="2"><input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" /></td>
\r
106 <?php foreach ($_current_modules as $module): ?>
\r
107 <?php if ($module == 'mods/_standard/student_tools/index.php') { continue; } ?>
\r
111 <?php if (in_array($module, $fha_student_tools)): ?>
\r
112 <input type="checkbox" name="main[]" value="<?php echo $module; ?>" id="m<?php echo $count; ?>" checked="checked" />
\r
114 <input type="checkbox" name="main[]" value="<?php echo $module; ?>" id="m<?php echo $count; ?>" />
\r
116 <label for="m<?php echo $count; ?>"><?php
\r
117 if (isset($_pages[$module]['title'])) {
\r
118 echo $_pages[$module]['title'];
\r
120 echo _AT($_pages[$module]['title_var']);
\r
125 <?php if (!in_array($module, $fha_student_tools)): ?>
\r
128 <?php if (($count != $num_main+1) && ($count > 1)): ?>
\r
129 <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;" />
\r
131 <img src="images/clr.gif" alt="" width="12" />
\r
133 <?php if (($count != $num_main) && ($count < $num_modules)): ?>
\r
134 <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;"/>
\r
136 <img src="images/clr.gif" alt="" width="12" />
\r
149 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>