3 * packages/preferences.php
5 * This file is part of ATutor, see http://www.atutor.ca
7 * Copyright (C) 2005 Matthai Kurian
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; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 define('AT_INCLUDE_PATH', '../../../include/');
25 require(AT_INCLUDE_PATH.'vitals.inc.php');
29 $sql = "SELECT lvalue, rvalue
30 FROM ".TABLE_PREFIX."cmi
32 AND member_id = " . $_SESSION[member_id]
35 $result = mysql_query($sql, $db);
36 while ($row = mysql_fetch_assoc($result)) {
37 $p[$row['lvalue']] = $row['rvalue'];
40 if (!isset ($p['auto_advance'])) {
41 $p['auto_advance'] = 0;
42 $sql = "INSERT INTO ".TABLE_PREFIX."cmi
43 VALUES (NULL, 0, $_SESSION[member_id], 'auto_advance', '0')";
44 $result = mysql_query($sql, $db);
47 if (!isset ($p['show_rte_communication'])) {
48 $p['show_rte_communication'] = 0;
49 $sql = "INSERT INTO ".TABLE_PREFIX."cmi
50 VALUES (NULL, 0, $_SESSION[member_id],
51 'show_rte_communication', '0'
53 $result = mysql_query($sql, $db);
56 if (isset ($_POST['upd'])) {
57 $p['auto_advance'] = $_POST['auto_advance'];
58 $sql = "UPDATE ".TABLE_PREFIX."cmi
59 SET rvalue = '$p[auto_advance]'
60 WHERE member_id = $_SESSION[member_id]
62 AND lvalue = 'auto_advance'
64 $result1 = mysql_query($sql, $db);
67 $p['show_rte_communication'] = $_POST['show_rte_communication'];
68 $sql = "UPDATE ".TABLE_PREFIX."cmi
69 SET rvalue = '$p[show_rte_communication]'
70 WHERE member_id = $_SESSION[member_id]
72 AND lvalue = 'show_rte_communication'
74 $result2 = mysql_query($sql, $db);
76 if ($result1 && $result2) {
77 $msg->addFeedback (SCORM_SETTINGS_SAVED);
79 $msg->addError (SCORM_SETTINGS_SAVE_FAILED);
83 require(AT_INCLUDE_PATH.'header.inc.php');
86 <div class="input-form" style="padding:1em;">
87 <form name="form1" method="post"
88 enctype="multipart/form-data">
89 <input type="hidden" name="upd" value="1">
91 <p> <?php echo _AT(packages_auto_advance_info);?> </p>
93 <input type="checkbox" id="auto_advance" name="auto_advance" value="1"
94 <?php echo ($p['auto_advance']?'checked':'');?> />
95 <label for="auto_advance"><?php echo _AT('packages_auto_advance');?><label>
98 <p> <?php echo _AT(packages_show_rte_communication_info);?> </p>
100 <input type="checkbox" id="show_rte_communication" name="show_rte_communication"
102 <?php echo ($p['show_rte_communication']?'checked':'');?> />
103 <label for="show_rte_communication">
104 <?php echo _AT('packages_show_rte_communication');?>
108 <div class="row buttons">
109 <input type="submit" name="submit" value="<?php echo _AT('save');?> " />
115 <?php require (AT_INCLUDE_PATH.'footer.inc.php');?>