require_once dirname(__FILE__) . '/lib.php'; require_login(0, false); // Date is a string representation of the starting date for the history to be // shown. "-1 year" is default, but a date such as "20130610" will work also // This limits by the session creation date, so it may not be exact. $date = optional_param('date', '', PARAM_TEXT); if (!$date) { $date = strtotime("-1 year"); } else { $date = strtotime($date); } $contact_list = helpmenow_contact_list::get_plugin(); $is_admin = $contact_list::is_admin(); # verify session $sessionid = required_param('session', PARAM_INT); if (!(helpmenow_verify_session($sessionid) or $is_admin)) { helpmenow_fatal_error(get_string('permission_error', 'block_helpmenow')); } $session = $DB->get_record('block_helpmenow_session', array('id' => $sessionid)); # title $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 "; $chat_users = $DB->get_records_sql($sql); $other_users = array(); $i = 0; $joinlist = ''; foreach ($chat_users as $r) { $other_users[] = fullname($r); $joinlist .= "JOIN {block_helpmenow_session2user} s2u{$i} ON s.id = s2u{$i}.sessionid AND s2u{$i}.userid={$r->id} "; $i += 1; } $title = get_string('chat_history', 'block_helpmenow') . ': ' . implode(', ', $other_users);
helpmenow_fatal_error('You do not have permission to view this page.'); } if (!($user2plugin = helpmenow_user2plugin_wiziq::get_user2plugin())) { helpmenow_fatal_error('No user2plugin'); } if ($test) { if (!$user2plugin->verify_active_meeting(true)) { $user2plugin->create_meeting(); # create meeting only if we don't have one } redirect($user2plugin->presenter_url); } $session_id = required_param('sessionid', PARAM_INT); $reopen = optional_param('reopen', 0, PARAM_INT); # verify sesion if (!helpmenow_verify_session($session_id)) { helpmenow_fatal_error('You do not have permission to view this page.'); } if ($reopen) { redirect($user2plugin->presenter_url); } if ($user2plugin->verify_active_meeting(true)) { $js = <<<EOF close(); EOF; } else { $user2plugin->create_meeting(); # create meeting only if we don't have one $js = <<<EOF window.name = 'wiziq_session'; window.location.replace("{$user2plugin->presenter_url}")
/** * ajax method for inviting users to gtm session * @param object $request ajax request * @return object */ function helpmenow_gotomeeting_invite($request) { global $USER, $CFG, $DB; # verify sesion if (!helpmenow_verify_session($request->session)) { throw new Exception('Invalid session'); } if (!($record = $DB->get_record('block_helpmenow_user2plugin', array('userid' => $USER->id, 'plugin' => 'gotomeeting')))) { throw new Exception('No u2p record'); } $user2plugin = new helpmenow_user2plugin_gotomeeting(null, $record); $message = fullname($USER) . ' has invited you to GoToMeeting, <a target="_blank" href="' . $user2plugin->join_url . '">click here</a> to join.'; $message_rec = (object) array('userid' => null, 'sessionid' => $request->session, 'time' => time(), 'message' => $message); $DB->insert_record('block_helpmenow_message', $message_rec); return new stdClass(); }