a10ef3029778995e0ed24a1aa0d90854df73e242
[atutor.git] / docs / mods / _standard / chat / options.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 session_write_close();
17 //authenticate(USER_CLIENT, USER_ADMIN);
18 require(AT_INCLUDE_PATH.'../mods/_standard/chat/lib/chat.inc.php');
19
20 $myPrefs = getPrefs($_SESSION['login']);
21
22 require('include/html/chat_header.inc.php');
23 ?>
24 <table width="100%" border="0" cellpadding="5" cellspacing="0">
25 <tr>
26         <th align="left"><?php echo _AT('chat_options'); ?></th>
27 </tr>
28 </table>
29
30 <table width="100%" border="0" cellpadding="5" cellspacing="0">
31 <tr>
32         <td align="right"><a href="prefs.php" target="_top" onfocus="this.className='highlight'" onblur="this.className=''"><?php echo _AT('chat_edit_prefs'); ?></a> | <a href="logout.php" target="_top" accesskey="q" onfocus="this.className='highlight'" onblur="this.className=''"><?php  echo _AT('chat_exit'); ?></a></td></tr></table>
33 <br /><br />
34 <table width="100%" border="0" cellpadding="5" cellspacing="0"><tr>
35 <th
36 align="left"><?php echo _AT('chat_list_and_history'); ?></th></tr></table><?php
37         echo '<ul>';
38         if ($dir = opendir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/users/')) {
39                 while (($file = readdir($dir)) !== false) {
40                         if (($file == '..') || ($file == '.')) {
41                                 continue;
42                         }
43
44                         $chatName       = substr($file, 0, -strlen('.prefs'));
45                         $la                     = getLastAccessed($chatName);
46                         $now            = time();
47
48                         if (($la == 0) || (!$la)) {
49                                 $la = 0;
50                         } else if ($now - $la < $admin['chatSessionLifeSpan']) {
51                                 $colour = getChatIDColour($chatName, $myPrefs['colours']);
52                                 if ($chatName == $_SESSION['login']) {
53                                         echo '<li><a href="filterHistory.php?filterChatID='.$chatName.'" target="_top" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><span style="color:'.$colour.'">'.$chatName.'</span></a> ('._AT('chat_you').')</li>';
54                                 } else if($chatName != '') {
55                                         echo '<li><a href="filterHistory.php?filterChatID='.$chatName.'" target="_top" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'"><span style="color:'.$colour.'">'.$chatName.'</span></a></li>';
56                                 }
57                         } else {
58                 resetLastAccessed($chatName);
59                                 $topMsgNum = $bottomMsgNum = 0;
60                 howManyMessages($topMsgNum, $bottomMsgNum);
61                                 postMessage(_AT('chat_system'),
62                                                 require(AT_INCLUDE_PATH.'../mods/_standard/chat/lib/chat.inc.php'),     _AT('chat_user_logged_out', $chatName),
63                                                         $topMsgNum,
64                                                         $bottomMsgNum);
65                         }
66                 }
67         }
68         closedir($dir);
69         echo '</ul>';
70
71         echo '<table width="100%" border="0" cellpadding="5" cellspacing="0">
72            <tr><td align="right"><a href="history.php" target="_top" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AT('chat_full_history').'</a> | <a href="options.php" target="options" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AT('chat_refresh_user_list').'</a></td></tr></table>';
73
74     //if ($myPrefs['navigationAidFlag'] > 0) {
75         echo '<br /><br />';
76                 echo '<table width="100%" border="0" cellpadding="5" cellspacing="0">
77            <tr><td align="left"><h4>'._AT('chat_quick_keys').'</h4></td></tr></table>';
78
79         echo '<ul><li>'._AT('chat_altc').'</li>
80                <li>'._AT('chat_post').'</li>
81                <li>'._AT('chat_altr').'</li>
82                <li>'._AT('chat_altm').'</li>
83                <li>'._AT('chat_altq').'</li></ul>';
84     //}
85 ?>
86 <?php
87 require('include/html/chat_footer.inc.php');
88 ?>