6c837e5298427e86404373a268352c23a8c340cb
[atutor.git] / docs / mods / _standard / chat / prefs2.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
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 /****************************************************************/
13
14 define('AT_INCLUDE_PATH', '../../../include/');
15         require(AT_INCLUDE_PATH.'vitals.inc.php');
16         //authenticate(USER_CLIENT, USER_ADMIN);
17 require(AT_INCLUDE_PATH.'../mods/_standard/chat/lib/chat.inc.php');
18         //not getting session username
19         $myPrefs = getPrefs($_SESSION['login']);
20
21         if ($_POST['submit'] || $_POST['submit_r'] || $_POST['submit_p']) {
22                 getAndWriteFormPrefs($myPrefs);
23
24                 if ($_POST['submit_p']) {
25                         $location = './prefs.php?firstLoginFlag='.$addslashes($_POST['firstLoginFlag']);
26                 } else if ($_POST['submit_r']) {
27                         $location = './chat.php?firstLoginFlag='.$addslashes($_POST['firstLoginFlag']);
28                 }
29
30                 Header('Location: '.$location);
31                 exit;
32         }
33         writePrefs($myPrefs, $_SESSION['username']);
34
35 require('include/html/chat_header.inc.php');
36 ?>
37 <table width="100%" border="0" cellpadding="5" cellspacing="0">
38 <tr>
39         <th align="left"><h4><?php echo _AT('chat_layout_prefs'); ?></h4></th>
40 </tr>
41 </table>
42 <br />
43 <form action="prefs2.php" name="f1" method="post" target="_top">
44         <input type="hidden" name="firstLoginFlag" value="<?php echo $_REQUEST['firstLoginFlag']; ?>" />
45
46 <?php
47     if ($myPrefs['newestFirstFlag'] > 0) {
48        $nFFSelT = 'selected';
49     }
50 ?>
51
52 <p><b><?php echo _AT('chat_order_prefs'); ?></b>
53         <select name="newestFirstFlag">
54                 <option value="0"><?php echo _AT('chat_oldnew_prefs'); ?></option>
55                 <option value="1" <?php echo $nFFSelT;?>><?php echo _AT('chat_newold_prefs'); ?></option>
56         </select></p>
57 <p><?php echo _AT('chat_message_order_help') ;?></p>
58
59 <?php
60     if ($myPrefs['onlyNewFlag'] > 0) {
61        $oNFSelT = 'selected';
62     }
63 ?>
64
65 <p><b><?php echo _AT('chat_newmsg_prefs'); ?></b>
66         <select name="onlyNewFlag">
67                 <option value="0"><?php echo _AT('no'); ?></option>
68         <option value="1" <?php echo $oNFSelT;?>><?php echo _AT('yes'); ?></option>
69         </select></p>
70 <p><?php echo _AT('chat_message_new_help') ;?></p>
71
72 <table width="100%" border="0" cellpadding="5" cellspacing="0">
73 <tr>
74         <td align="left"><input type="submit" value="<?php echo _AT('previous'); ?>" name="submit_p" class="submit" onFocus="this.className='submit highlight'" onBlur="this.className='submit'" /> <input type="submit" value="<?php echo _AT('chat_enter'); ?>" name="submit_r" class="submit" onFocus="this.className='submit highlight'" onBlur="this.className='submit'" /></td>
75 </tr>
76 </table>
77
78 </form>
79 <?php require('include/html/chat_footer.inc.php'); ?>