2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay & Joel Kronenberg */
6 /* Adaptive Technology Resource Centre / University of Toronto */
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 // $Id: index.php 7515 2008-05-09 20:04:05Z hwong $
15 define('AT_INCLUDE_PATH', '../../../include/');
18 require(AT_INCLUDE_PATH.'vitals.inc.php');
20 require(AT_INCLUDE_PATH.'../mods/_standard/chat/lib/chat.inc.php');
21 $admin = getAdminSettings();
23 require(AT_INCLUDE_PATH.'header.inc.php');
26 <p align="center"><a href="mods/_standard/chat/chat.php?firstLoginFlag=1"><strong> <?php echo _AT('enter_chat'); ?></strong></a></p><br />
29 $orders = array('asc' => 'desc', 'desc' => 'asc');
30 $cols = array('name' => 1, 'date' => 1);
32 if (isset($_GET['asc'])) {
34 $col = isset($cols[$_GET['asc']]) ? $_GET['asc'] : 'date';
35 } else if (isset($_GET['desc'])) {
37 $col = isset($cols[$_GET['desc']]) ? $_GET['desc'] : 'date';
44 $tran_files = array();
45 if (!@opendir(AT_CONTENT_DIR . 'chat/')){
46 mkdir(AT_CONTENT_DIR . 'chat/', 0777);
49 if(!file_exists(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/admin.settings')){
50 @mkdir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'], 0777);
51 @mkdir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/', 0776);
52 @mkdir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/msgs/', 0776);
53 @mkdir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/users/', 0776);
54 @copy('admin.settings.default', AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/admin.settings');
55 @chmod (AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/admin.settings', 0777);
59 if ($dir = @opendir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/')) {
60 while (($file = readdir($dir)) !== false) {
61 if (substr($file, -strlen('.html')) == '.html') {
62 $la = stat(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/'.$file);
64 $file = str_replace('.html', '', $file);
65 $tran_files[$file] = $la['ctime'];
70 if (count($tran_files) == 0) {
71 echo '<p>'._AT('chat_none_found').'</p>';
74 <form name="form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
76 <table class="data" rules="cols" summary="">
78 <?php if ($col == 'name'): ?>
81 <?php elseif($col == 'date'): ?>
88 <th scope="col"><a href="<?php echo url_rewrite('chat/index.php?'.$orders[$order].'=name'); ?>"><?php echo _AT('chat_transcript');?></a></th>
89 <th scope="col"><?php echo _AT('status'); ?></th>
90 <th scope="col"><a href="<?php echo url_rewrite('chat/index.php?'.$orders[$order].'=date'); ?>"><?php echo _AT('date'); ?></a></th>
95 if (($col == 'date') && ($order == 'asc')) {
97 } else if (($col == 'date') && ($order == 'desc')) {
99 } else if (($col == 'name') && ($order == 'asc')) {
101 } else if (($col == 'name') && ($order == 'desc')) {
108 <?php foreach ($tran_files as $file => $date) { ?>
109 <tr onmousedown="document.location='<?php echo AT_BASE_HREF; ?>chat/view_transcript.php?t=<?php echo $file; ?>'">
110 <td><a href="<?php echo url_rewrite('chat/view_transcript.php?t='.$file); ?>"><?php echo $file; ?></a></td>
112 <?php if (($file.'.html' == $admin['tranFile']) && ($admin['produceTran'])) {
113 echo _AT('chat_currently_active');
115 echo _AT('chat_inactive');
121 $startend_date_longs_format=_AT('startend_date_longs_format');
122 echo AT_date($startend_date_longs_format, $date, AT_DATE_UNIX_TIMESTAMP);
133 require(AT_INCLUDE_PATH.'footer.inc.php');