'.get_string('noguests', 'chat').'
'.get_string('liketologin'), get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id); echo $OUTPUT->footer(); exit; } // Completion and trigger events. chat_view($chat, $course, $cm, $context); $strenterchat = get_string('enterchat', 'chat'); $stridle = get_string('idle', 'chat'); $strcurrentusers = get_string('currentusers', 'chat'); // Check to see if groups are being used here. $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); // URL parameters. $params = array(); if ($currentgroup) { $groupselect = " AND groupid = '$currentgroup'"; $groupparam = "_group{$currentgroup}"; $params['groupid'] = $currentgroup; } else { $groupselect = ""; $groupparam = ""; } // Print the page header. echo $OUTPUT->header(); if (has_capability('mod/chat:chat', $context)) { $now = time(); $chattime = $chat->chattime ?? 0; $span = $chattime - $now; if (!empty($chat->schedule) && $span > 0) { $attributes = ['class' => 'border bg-light rounded p-2']; echo html_writer::tag('p', get_string('sessionstartsin', 'chat', format_time($span)), $attributes); } $params['id'] = $chat->id; $chattarget = new moodle_url("/mod/chat/gui_$CFG->chat_method/index.php", $params); echo html_writer::start_div('container-fluid tertiary-navigation'); echo html_writer::start_div('row'); echo html_writer::start_div('navitem'); echo $OUTPUT->action_link($chattarget, $strenterchat, new popup_action('click', $chattarget, "chat{$course->id}_{$chat->id}{$groupparam}", array('height' => 500, 'width' => 700)), ['class' => 'btn btn-primary']); echo html_writer::end_div(); echo html_writer::start_div('navitem'); $params['id'] = $chat->id; $link = new moodle_url('/mod/chat/gui_basic/index.php', $params); $action = new popup_action('click', $link, "chat{$course->id}_{$chat->id}{$groupparam}", array('height' => 500, 'width' => 700)); echo $OUTPUT->action_link($link, get_string('noframesjs', 'message'), $action, array('title' => get_string('modulename', 'chat'), 'class' => 'btn btn-secondary')); echo html_writer::end_div(); echo html_writer::end_div(); echo html_writer::end_div(); // Print the main part of the page. echo $OUTPUT->box_start('generalbox', 'enterlink'); if (($chat->studentlogs or has_capability('mod/chat:readlog', $context)) && !$PAGE->has_secondary_navigation()) { if ($msg = chat_get_session_messages($chat->id, $currentgroup)) { echo ''; echo html_writer::link(new moodle_url('/mod/chat/report.php', array('id' => $cm->id)), get_string('viewreport', 'chat')); echo '
'; } } groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/view.php?id=$cm->id"); echo $OUTPUT->box_end(); } else { groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/view.php?id=$cm->id"); echo $OUTPUT->box_start('generalbox', 'notallowenter'); echo ''.get_string('notallowenter', 'chat').'
'; echo $OUTPUT->box_end(); } chat_delete_old_users(); if ($chatusers = chat_get_users($chat->id, $currentgroup, $cm->groupingid)) { $timenow = time(); echo $OUTPUT->box_start('generalbox', 'chatcurrentusers'); echo $OUTPUT->heading($strcurrentusers, 3); echo '| '; $url = new moodle_url('/user/view.php', array('id' => $chatuser->id, 'course' => $chat->course)); echo html_writer::link($url, $OUTPUT->user_picture($chatuser)); echo ' | ';
echo ' '.fullname($chatuser).' '; echo ''.$stridle.': '.format_time($lastping).''; echo ' |