$string['beep'] = 'beep';
$string['cantlogin'] = 'Could not log in to chat room!!';
$string['cantinsert'] = 'Could not insert a chat message!';
-$string['chat:chat'] = 'Talk in a chat';
+$string['chat:chat'] = 'Access a chat room';
$string['chat:deletelog'] = 'Delete chat logs';
$string['chat:exportsession'] = 'Export chat session';
$string['chat:exportparticipatedsession'] = 'Export participated-in chat session';
$string['chat:readlog'] = 'Read chat logs';
+$string['chat:talk'] = 'Talk in a chat';
$string['chatintro'] = 'Introduction text';
$string['chatname'] = 'Name of this chat room';
$string['chatreport'] = 'Chat sessions';
)
),
+ 'mod/chat:talk' => array(
+
+ 'riskbitmask' => RISK_SPAM,
+
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'student' => CAP_ALLOW,
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'admin' => CAP_ALLOW
+ )
+ ),
+
'mod/chat:readlog' => array(
'captype' => 'read',
require('../lib.php');
$chat_sid = required_param('chat_sid', PARAM_ALPHANUM);
+ $chatid = required_param('chat_id', PARAM_INT);
if (!$chatuser = $DB->get_record('chat_users', array('sid'=>$chat_sid))) {
print_error('notlogged', 'chat');
}
+ if (!$chat = get_record('chat', 'id', $chatid)) {
+ error('Could not find that chat room!');
+ }
+
+ if (!$course = get_record('course', 'id', $chat->course)) {
+ error('Could not find the course this belongs to!');
+ }
+
+ if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
+ error('Course Module ID was incorrect');
+ }
+
+ $context = get_context_instance(CONTEXT_MODULE, $cm->id);
+
//Get the user theme
$USER = $DB->get_record('user', array('id'=>$chatuser->userid));
$meta = ob_get_clean();
print_header('', '', '', 'input_chat_message', $meta, false);
+ if(has_capability('mod/chat:chatlog',$context)){
?>
<form action="../empty.php" method="post" target="empty" id="inputForm"
onsubmit="return empty_field_and_submit()" style="margin:0">
<?php helpbutton('chatting', get_string('helpchatting', 'chat'), 'chat', true, false); ?><br />
<input type="checkbox" id="auto" size="50" value="" checked='true' /><label for="auto"><?php echo get_string('autoscroll', 'chat');?></label>
</form>
+<?php
+ }
+?>
<form action="insert.php" method="post" target="empty" id="sendForm">
<input type="hidden" name="chat_sid" value="<?php echo $chat_sid ?>" />
print_error('cantlogin', 'chat');
}
- $params = "chat_sid=$chat_sid";
+ $params = "chat_id=$id&chat_sid={$chat_sid}";
// fallback to the old jsupdate, but allow other update modes
$updatemode = 'jsupdate';
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2008081400; // The (date) version of this module
+$module->version = 2008081401; // The (date) version of this module
$module->requires = 2007101509; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?