2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
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 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../../../../include/');
18 require(AT_INCLUDE_PATH.'vitals.inc.php');
19 require(AT_INCLUDE_PATH.'../mods/_standard/chat/lib/chat.inc.php');
21 if (isset($_GET['view'], $_GET['file'])) {
22 header("Location:view_transcript.php?t=".$_GET['file']);
24 } else if ((isset($_GET['view']) || isset($_GET['delete'])) && !isset($_GET['file'])) {
25 $msg->addError('NO_ITEM_SELECTED');
28 $admin = getAdminSettings();
30 if (isset($_GET['delete'], $_GET['file'])) {
32 if (($_GET['file'].'.html' == $admin['tranFile']) && ($admin['produceTran'])) {
33 $msg->addError('TRANSCRIPT_ACTIVE');
35 header("Location:delete_transcript.php?m=".$_GET['file']);
39 require(AT_INCLUDE_PATH.'header.inc.php');
41 $orders = array('asc' => 'desc', 'desc' => 'asc');
42 $cols = array('name' => 1, 'date' => 1);
44 if (isset($_GET['asc'])) {
46 $col = isset($cols[$_GET['asc']]) ? $_GET['asc'] : 'date';
47 } else if (isset($_GET['desc'])) {
49 $col = isset($cols[$_GET['desc']]) ? $_GET['desc'] : 'date';
56 $tran_files = array();
57 if (!@opendir(AT_CONTENT_DIR . 'chat/')){
58 mkdir(AT_CONTENT_DIR . 'chat/', 0777);
61 if(!file_exists(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/admin.settings')){
62 @mkdir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'], 0777);
63 @mkdir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/', 0776);
64 @mkdir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/msgs/', 0776);
65 @mkdir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/users/', 0776);
66 @copy('admin.settings.default', AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/admin.settings');
67 @chmod (AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/admin.settings', 0777);
71 if ($dir = @opendir(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/')) {
72 while (($file = readdir($dir)) !== false) {
73 if (substr($file, -strlen('.html')) == '.html') {
74 $la = stat(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/'.$file);
76 $file = str_replace('.html', '', $file);
77 $tran_files[$file] = $la['ctime'];
82 if (count($tran_files) == 0) {
83 echo '<div style="width:90%;" class="input-form"><p>'._AT('chat_none_found').'</p></div>';
86 <form name="form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
88 <table class="data" rules="cols" summary="">
90 <?php if ($col == 'name'): ?>
94 <?php elseif($col == 'date'): ?>
101 <th scope="col"> </th>
102 <th scope="col"><a href="mods/_standard/chat/index.php?<?php echo $orders[$order]; ?>=name"><?php echo _AT('chat_transcript');?></a></th>
103 <th scope="col"><?php echo _AT('status'); ?></th>
104 <th scope="col"><a href="mods/_standard/chat/index.php?<?php echo $orders[$order]; ?>=date"><?php echo _AT('date'); ?></a></th>
110 if (($col == 'date') && ($order == 'asc')) {
112 } else if (($col == 'date') && ($order == 'desc')) {
114 } else if (($col == 'name') && ($order == 'asc')) {
116 } else if (($col == 'name') && ($order == 'desc')) {
123 <?php foreach ($tran_files as $file => $date) { ?>
124 <tr onmousedown="document.form['<?php echo $file; ?>'].checked = true; rowselect(this);" id="r_<?php echo $file; ?>">
125 <td><input type="radio" name="file" value="<?php echo $file; ?>" id="<?php echo $file; ?>" /></td>
127 <td><label for="<?php echo $file; ?>"><?php echo $file; ?></label></td>
129 <?php if (($file.'.html' == $admin['tranFile']) && ($admin['produceTran'])) {
130 echo _AT('chat_currently_active');
132 echo _AT('chat_inactive');
136 <td><?php echo AT_DATE(_AT('server_date_format'), $date); ?></td>
143 <td colspan="4"><input type="submit" name="view" value="<?php echo _AT('view'); ?>" /> <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" /></td>
152 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>