1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11require_once('tiki-setup.php');
12include_once('lib/live_support/lslib.php');
13header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
14header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
15header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
16header("Cache-Control: post-check=0, pre-check=0", false);
17header("Pragma: no-cache"); // HTTP/1.0
18$access->check_feature('feature_live_support');
19if ($tiki_p_live_support_admin != 'y' && ! $lsadminlib->is_operator($user)) {
20	$smarty->assign('errortype', 401);
21	$smarty->assign('msg', tra("You are neither an administrator nor an operator of live support."));
22	$smarty->display("error.tpl");
23	die;
24}
25$smarty->assign('isOperator', $lsadminlib->is_operator($user));
26
27$max_active_request = $lslib->get_max_active_request();
28$smarty->assign('new_requests', 'n');
29if (isset($max_active_request)) {
30	if (! isset($_SESSION['max_request'])) {
31		$_SESSION['max_request'] = $max_active_request;
32		$smarty->assign('new_requests', 'y');
33	} else {
34		if ($max_active_request != $_SESSION['max_request']) {
35			$_SESSION['max_request'] = $max_active_request;
36			$smarty->assign('new_requests', 'y');
37		}
38	}
39}
40$requests = $lslib->get_requests('active');
41$smarty->assign('requests', $requests);
42$smarty->assign('chats', $lslib->get_requests('op_accepted'));
43$smarty->assign('last', $lslib->get_last_request());
44if (isset($_REQUEST['status'])) {
45	$lslib->set_operator_status($user, $_REQUEST['status']);
46}
47$smarty->assign('status', $lslib->get_operator_status($user));
48// Display the template
49$smarty->display("tiki-live_support_console.tpl");
50