* @copyright 2012 VLACS * @author David Zaharee <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; require_once dirname(__FILE__) . '/lib.php'; require_login(0, false); $PAGE->set_context(context_system::instance()); # verify session $sessionid = required_param('session', PARAM_INT); if (!helpmenow_verify_session($sessionid)) { helpmenow_fatal_error(get_string('permission_error', 'block_helpmenow')); } # figure out if the user should see plugins $session = $DB->get_record('block_helpmenow_session', array('id' => $sessionid)); $privileged = helpmenow_check_privileged($session); # title if (!$privileged and isset($session->queueid)) { $title = $DB->get_field('block_helpmenow_queue', 'name', array('id' => $session->queueid)); } else { $sql = "\n SELECT u.*\n FROM {block_helpmenow_session2user} s2u\n JOIN {user} u ON u.id = s2u.userid\n WHERE s2u.sessionid = {$sessionid}\n AND s2u.userid <> {$USER->id}\n "; $other_user_recs = $DB->get_records_sql($sql); $other_users = array(); if (!empty($other_user_recs)) { foreach ($other_user_recs as $r) { $other_users[] = fullname($r); } } $title = implode(', ', $other_users); $history_name = get_string('chat_history', 'block_helpmenow') . ': ' . $title; }
public static function on_chat_refresh($request, &$response) { global $DB; $session = $DB->get_record('block_helpmenow_session', array('id' => $request->session)); if (helpmenow_check_privileged($session)) { $response->wiziq = self::display($request->session, true); } }