~adamzammit/quexs/quexslinkcall

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php 
/**
 * Display status of case
 *
 *
 *	This file is part of queXS
 *	
 *	queXS is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *	
 *	queXS is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *	
 *	You should have received a copy of the GNU General Public License
 *	along with queXS; if not, write to the Free Software
 *	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *
 * @author Adam Zammit <adam.zammit@deakin.edu.au>
 * @copyright Deakin University 2007,2008
 * @package queXS
 * @subpackage user
 * @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
 * 
 */

/**
 * Configuration file
 */
include ("config.inc.php");

/**
 * Database file
 */
include ("db.inc.php");

/** 
 * Authentication
 */
require ("auth-interviewer.php");


/**
 * XHTML functions
 */
include ("functions/functions.xhtml.php");

/**
 * Operator functions
 */
include("functions/functions.operator.php");



$operator_id = get_operator_id();

if ($operator_id == false)
{
	xhtml_head(T_("Status"));
	print "<p>" . T_("No operator") . "</p>";
	xhtml_foot();
	die();
}

$state = is_on_call($operator_id);
$btext = false;

if ($state == 4 && AUTO_POPUP)
	$btext = "onload=\"poptastic('call.php')\"";

$js = array("js/popupkeep.js");
if (AUTO_LOGOUT_MINUTES !== false)
{  
        $js[] = "include/jquery/jquery-1.4.2.min.js";
        $js[] = "js/childnap.js";
}

xhtml_head(T_("Status"),true,array("css/status.css"),$js,$btext,60,false,false,false,false);

print "<div class='text'>" . get_operator_time($operator_id,DATE_TIME_FORMAT) ."</div>";

//need to determine VoIP status by confirming with the VoIP server if this operator is online

//Then confirm whether or not they are on a call (or use the database table, call to determine)

if (is_voip_enabled($operator_id))
{
  $ext = get_extension($operator_id);
	$exta = $ext;
	//Get just the start of the extension for auto dial out
	$exts = explode('/', $ext, 2);
		if (isset($exts[1]))
			$exta = $exts[1];
	$extp = get_extension_password($operator_id);
	if (get_extension_status($operator_id))
		print "<div class='online statusbutton'>" . T_("VoIP On") . "</div>";
	else
    print "<div class='offline statusbutton'><a href='voip/downloadvoipclient.php'>" . T_("VoIP Off") . "</a></div>";

  print "<div class='statusbutton'>" . T_("Extension") . ": $ext</div>";
}
else
	print "<div class='online statusbutton'>" . T_("No VoIP") . "</div>";

if (!$state || $state == 5)
{
	print("<div class='offline statusbutton'>" . T_("No call") . "</div>");
}
else if ($state == 4)
{
	print("<div class='tobecoded statusbutton'>" . T_("To be coded") . "</div>");
}
else if ($state == 1)
{
	print("<div class='online statusbutton'>" . T_("Requesting") . "</div>");
}
else if ($state == 2)
{
	print("<div class='online statusbutton'>" . T_("Ringing") . "</div>");
}
else if ($state == 3)
{
	print("<div class='online statusbutton'>" . T_("Answered") . "</div>");
}


$ca = get_call_attempt($operator_id,false);
if ($ca)
{
	print "<div class='text'>" . get_respondent_time(get_respondent_id($ca),TIME_FORMAT) ."</div>";
	if (is_on_appointment($ca)) print "<div class='online statusbutton'>" . T_("APPT") . "</div>";
	if (missed_appointment($ca)) print "<div class='tobecoded statusbutton'>" . T_("MISSED") . "</div>";
}
else
	print "<div class='text'>" . T_("No case") . "</div>";

xhtml_foot();

?>