} else { $plugins_init = ''; } if (!isset($session->queueid)) { $history_url = new moodle_url("{$CFG->wwwroot}/blocks/helpmenow/history.php#recent"); $history_url->param('session', $sessionid); $history_url->param('date', '-1 year'); $action = new popup_action('click', $history_url->out(), $sessionid, array('height' => 400, 'width' => 500)); $history_link = $OUTPUT->action_link($history_url->out(), $history_name, $action); $history_link = '<div>' . $history_link . '</div>'; } else { $history_link = ''; } $textarea_message = get_string('textarea_message', 'block_helpmenow'); # default text in chat input box $jplayer = helpmenow_jplayer(); # jquery plugin for bell sound $version = HELPMENOW_CLIENT_VERSION; if ($history = helpmenow_get_history($sessionid)) { $messages = helpmenow_format_messages($history); foreach ($history as $m) { $last_message = $m->id; } } else { $messages = ''; $last_message = 0; } $messages = $history_link . $messages; echo <<<EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
function helpmenow_block_interface() { global $CFG, $USER, $OUTPUT, $DB; helpmenow_ensure_user_exists(); $output = ''; $output .= <<<EOF <div id="helpmenow_queue_div"></div> EOF; $contact_list = helpmenow_contact_list::get_plugin(); if ($contact_list::is_teacher()) { $helpmenow_user = $DB->get_record('block_helpmenow_user', array('userid' => $USER->id)); $instyle = $outstyle = ''; if ($helpmenow_user->isloggedin) { $outstyle = 'style="display: none;"'; } else { $instyle = 'style="display: none;"'; } $login_url = new moodle_url("{$CFG->wwwroot}/blocks/helpmenow/login.php"); $login_url->param('login', 0); $action = new popup_action('click', $login_url->out(), "login", array('height' => 400, 'width' => 500)); $logout = $OUTPUT->action_link($login_url->out(), get_string('leave_office', 'block_helpmenow'), $action); $login_url->param('login', 1); $action = new popup_action('click', $login_url->out(), "login", array('height' => 400, 'width' => 500)); $login = $OUTPUT->action_link($login_url->out(), get_string('enter_office', 'block_helpmenow'), $action); $my_office = get_string('my_office', 'block_helpmenow'); $out_of_office = get_string('out_of_office', 'block_helpmenow'); $online_students = get_string('online_students', 'block_helpmenow'); $output .= <<<EOF <div id="helpmenow_office"> <div><b>{$my_office}</b></div> <div id="helpmenow_motd" onclick="helpmenow.block.toggleMOTD(true);" style="border:1px dotted black; width:12em; min-height:1em; padding:.2em; margin-top:.5em;">{$helpmenow_user->motd}</div> <textarea id="helpmenow_motd_edit" onkeypress="return helpmenow.block.keypressMOTD(event);" onblur="helpmenow.block.toggleMOTD(false)" style="display:none; margin-top:.5em;" rows="4" cols="22"></textarea> <div style="text-align: center; font-size:small; margin-top:.5em;"> <div id="helpmenow_logged_in_div_0" {$instyle}>{$logout}</div> <div id="helpmenow_logged_out_div_0" {$outstyle}>{$out_of_office} | {$login}</div> </div> <div style="margin-top:.5em;">{$online_students}</div> <div id="helpmenow_users_div"></div> </div> EOF; } else { if ($contact_list::is_student()) { $output .= ' <div>' . get_string('instructors', 'block_helpmenow') . '</div> <div id="helpmenow_users_div"></div> '; } } $jplayer = helpmenow_jplayer(); $version = HELPMENOW_CLIENT_VERSION; if (!empty($CFG->helpmenow_title)) { $titlename = $CFG->helpmenow_title; } else { $titlename = get_string('helpmenow', 'block_helpmenow'); } $output .= <<<EOF <hr /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> {$jplayer} <script src="{$CFG->wwwroot}/blocks/helpmenow/javascript/lib/jquery.titlealert.js" type="text/javascript"></script> <script src="{$CFG->wwwroot}/blocks/helpmenow/javascript/lib/json2.js" type="text/javascript"></script> <script type="text/javascript" src="{$CFG->wwwroot}/blocks/helpmenow/javascript/client/{$version}/lib.js"></script> <script type="text/javascript" src="{$CFG->wwwroot}/blocks/helpmenow/javascript/client/{$version}/block.js"></script> <script type="text/javascript"> helpmenow.setServerURL("{$CFG->wwwroot}/blocks/helpmenow/ajax.php"); helpmenow.setTitleName("{$titlename}"); </script> <div id="helpmenow_chime"></div> EOF; return $output; }