'.userdate($start).' --> '. userdate($end).'
'; echo $OUTPUT->box_start('center'); $participates = array(); foreach ($messages as $message) { // We are walking FORWARDS through messages. if (!isset($participates[$message->userid])) { $participates[$message->userid] = true; } $formatmessage = chat_format_message($message, $course->id, $USER); if (isset($formatmessage->html)) { echo $formatmessage->html; } } $participatedcap = array_key_exists($USER->id, $participates) && has_capability('mod/chat:exportparticipatedsession', $context); if (!empty($CFG->enableportfolios) && ($canexportsess || $participatedcap)) { require_once($CFG->libdir . '/portfoliolib.php'); $buttonoptions = array( 'id' => $cm->id, 'start' => $start, 'end' => $end, ); $button = new portfolio_add_button(); $button->set_callback_options('chat_portfolio_caller', $buttonoptions, 'mod_chat'); $button->render(); } echo $OUTPUT->box_end(); } if (!$deletesession or !has_capability('mod/chat:deletelog', $context)) { echo $OUTPUT->continue_button("report.php?id=$cm->id"); } echo $OUTPUT->footer(); exit; } // Print the Sessions display. $PAGE->navbar->add($strchatreport); $PAGE->set_title($strchatreport); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('sessions', 'chat'), 2); // Check to see if groups are being used here if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used. $currentgroup = groups_get_activity_group($cm, true); groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/report.php?id=$cm->id"); } else { $currentgroup = false; } $params = array('currentgroup' => $currentgroup, 'chatid' => $chat->id, 'start' => $start, 'end' => $end); // If the user is allocated to a group, only show discussions with people in // the same group, or no group. if (!empty($currentgroup)) { $groupselect = " AND (groupid = :currentgroup OR groupid = 0)"; } else { $groupselect = ""; } // Delete a session if one has been specified. if ($deletesession and has_capability('mod/chat:deletelog', $context) and $confirmdelete and $start and $end and confirm_sesskey()) { $DB->delete_records_select('chat_messages', "chatid = :chatid AND timestamp >= :start AND timestamp <= :end $groupselect", $params); $strdeleted = get_string('deleted'); echo $OUTPUT->notification("$strdeleted: ".userdate($start).' --> '. userdate($end)); unset($deletesession); } // Get the messages. if (empty($messages)) { // May have already got them above. if (!$messages = chat_get_session_messages($chat->id, $currentgroup, 0, 0, 'timestamp DESC')) { echo $OUTPUT->heading(get_string('nomessages', 'chat'), 3); echo $OUTPUT->footer(); exit; } } if ($showall) { $headingstr = get_string('listing_all_sessions', 'chat') . ' '; $headingstr .= html_writer::link("report.php?id={$cm->id}&show_all=0", get_string('list_complete_sessions', 'chat')); echo $OUTPUT->heading($headingstr, 3); } // Show all the sessions. $completesessions = 0; echo ''.userdate($session->sessionstart).' --> '. userdate($session->sessionend).'
'; echo $OUTPUT->box_start(); arsort($session->sessionusers); foreach ($session->sessionusers as $sessionuser => $usermessagecount) { if ($user = $DB->get_record('user', array('id' => $sessionuser))) { $OUTPUT->user_picture($user, array('courseid' => $course->id)); echo ' ' . fullname($user, $canviewfullnames); echo " ($usermessagecount)';
echo "id&start=$session->sessionstart&end=$session->sessionend\">$strseesession";
$participatedcap = (array_key_exists($USER->id, $session->sessionusers)
&& has_capability('mod/chat:exportparticipatedsession', $context));
if (!empty($CFG->enableportfolios) && ($canexportsess || $participatedcap)) {
require_once($CFG->libdir . '/portfoliolib.php');
$buttonoptions = array(
'id' => $cm->id,
'start' => $session->sessionstart,
'end' => $session->sessionend,
);
$button = new portfolio_add_button();
$button->set_callback_options('chat_portfolio_caller', $buttonoptions, 'mod_chat');
$portfoliobutton = $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
if (!empty($portfoliobutton)) {
echo '
' . $portfoliobutton;
}
}
if (has_capability('mod/chat:deletelog', $context)) {
$deleteurl = "report.php?id=$cm->id&start=$session->sessionstart&end=$session->sessionend&deletesession=1";
echo "
$strdeletesession";
}
echo '