';
echo $OUTPUT->heading(get_string('messages', 'chat'), 3);
$allmessages = array();
$options = new stdClass();
$options->para = false;
$options->newlines = true;
$params = array('last' => $last, 'groupid' => $groupid, 'chatid' => $chat->id, 'chatentered' => $chatentered);
if ($newonly) {
$lastsql = "AND timestamp > :last";
} else {
$lastsql = "";
}
$groupselect = $groupid ? "AND (groupid=:groupid OR groupid=0)" : "";
$messages = $DB->get_records_select("chat_messages_current",
"chatid = :chatid AND timestamp > :chatentered $lastsql $groupselect", $params,
"timestamp DESC");
if ($messages) {
foreach ($messages as $message) {
$allmessages[] = chat_format_message($message, $course->id, $USER);
}
}
echo '
';
echo '
' . get_string('from') . ' |
' . get_string('message', 'message') . ' |
' . get_string('time') . ' |
';
if (empty($allmessages)) {
echo get_string('nomessagesfound', 'message');
} else {
foreach ($allmessages as $message) {
echo $message->basic;
}
}
echo '
';
echo '
';
echo $OUTPUT->container_end();
echo $OUTPUT->footer();