2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Import from DCARF SVN

This commit is contained in:
azammitdcarf
2008-10-15 04:41:48 +00:00
parent 6f117f9de5
commit f988e1dad9
26 changed files with 3256 additions and 0 deletions

223
appointment.php Normal file
View File

@@ -0,0 +1,223 @@
<?
/**
* Create an appointment for the currently assigned 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Calendar functions
*/
include("functions/functions.calendar.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
/**
* Input functions
*/
include("functions/functions.input.php");
$operator_id = get_operator_id();
$questionnaire_id = get_questionnaire_id($operator_id);
$case_id = get_case_id($operator_id);
if (!$case_id){
xhtml_head(T_("Appointment error"));
print("<div>" . T_("You have not been assigned a case therefore cannot create an appointment") . "</div>");
xhtml_foot();
exit();
}
if(isset($_POST['firstName']) && isset($_POST['lastName']) && isset($_POST['Time_zone_name']))
{
//add a new respondent
add_respondent($case_id,$_POST['firstName'],$_POST['lastName'],$_POST['Time_zone_name']);
}
if(isset($_GET['phonenum']))
{
//add a new phone number
add_contact_phone($case_id,$_GET['phonenum']);
}
if(isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && isset($_POST['month']) && isset($_POST['year']) && isset($_POST['respondent_id']) && isset($_POST['contact_phone_id']))
{
//make appointment
$day = bigintval($_POST['day']);
$month = bigintval($_POST['month']);
$year = bigintval($_POST['year']);
$respondent_id = bigintval($_POST['respondent_id']);
$contact_phone_id = bigintval($_POST['contact_phone_id']);
$start = $_POST['start'];
$end = $_POST['end'];
$call_attempt_id = get_call_attempt($operator_id);
make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$day,$month,$year,$start,$end);
xhtml_head(T_("Appointment made"),true,false,false,"onload='top.close()'");
xhtml_foot();
}
xhtml_head(T_("Appointment"),true,array("css/respondent.css"),array("js/window.js"));
//select a respondent from a list or create a new one
print("<p>" . T_("Select a respondent") . "</p>");
display_respondent_list($case_id,isset($_GET['respondent_id'])?bigintval($_GET['respondent_id']):false);
if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
//ability to create a new one
?>
<p><? echo T_("Create new respondent:"); ?></p>
<form id="addRespondent" method="post" action="">
<? display_respondent_form(); ?>
<p><input type="submit" value="<? echo T_("Add this respondent"); ?>"/></p>
</form>
<?
}
else if(isset($_GET['respondent_id']))
{
$respondent_id = bigintval($_GET['respondent_id']);
if (isset($_GET['d']) && isset($_GET['m']) && isset($_GET['y']))
{
$day = bigintval($_GET['d']);
$month = bigintval($_GET['m']);
$year = bigintval($_GET['y']);
display_calendar($respondent_id,$questionnaire_id,$year,$month,$day);
display_time($respondent_id,$day,$month,$year,isset($_GET['start'])?$_GET['start']:false,isset($_GET['end'])?$_GET['end']:false);
if (isset($_GET['end']) && isset($_GET['start']))
{
$list = return_contact_phone_list($case_id);
print "<p>" . T_("Select phone number:") . "</p>";
if (isset($_GET['contact_phone_id'])) $contact_phone_id = bigintval($_GET['contact_phone_id']);
else $contact_phone_id = -1;
print "<div><select id='phonenum' name='phonenum' onchange=\"LinkUp('phonenum')\"><option>" . T_("None") . "</option>";
foreach($list as $l)
{
$id = $l['contact_phone_id'];
$selected = "";
if ($id == $contact_phone_id) $selected="selected='selected'";
print "<option value='?contact_phone_id=$id&amp;start={$_GET['start']}&amp;end={$_GET['end']}&amp;d=$day&amp;y=$year&amp;m=$month&amp;respondent_id=$respondent_id' $selected>{$l['phone']} - {$l['description']}</option>";
}
print "<option value='?contact_phone_id=0&amp;start={$_GET['start']}&amp;end={$_GET['end']}&amp;d=$day&amp;y=$year&amp;m=$month&amp;respondent_id=$respondent_id' class='addresp'>" . T_("Add new phone number") . "</option></select></div>";
if(isset($_GET['contact_phone_id']))
{
$contact_phone_id = bigintval($_GET['contact_phone_id']);
if ($contact_phone_id == 0)
{
//ability to add a new one
?>
<p><? echo T_("Add new phone number (with area code, eg 0398761234):"); ?></p>
<form id="addPhone" method="get" action="">
<p><input type="text" name="phonenum"/></p>
<p><input type="submit" value="<? echo T_("Add this phone number"); ?>"/>
<input type="hidden" name="start" value="<? print $_GET['start']; ?>"/>
<input type="hidden" name="end" value="<? print $_GET['end']; ?>"/>
<input type="hidden" name="d" value="<? print $day; ?>"/>
<input type="hidden" name="m" value="<? print $month; ?>"/>
<input type="hidden" name="y" value="<? print $year; ?>"/>
<input type="hidden" name="respondent_id" value="<? print $respondent_id; ?>"/></p>
</form>
<?
}
else
{
foreach($list as $l)
{
if ($l['contact_phone_id'] == $contact_phone_id)
$phonenum = $l['phone'];
}
?>
<p><? echo T_("Appointment:"); ?></p>
<form id="appointment" method="post" action="">
<? print "<p>" . T_("Accept appointment from ") .convert_time($_GET['start']).T_(" till ").convert_time($_GET['end']).T_(" on ") . "$day/$month/$year? " . T_("on") . " $phonenum </p>"; ?>
<p>
<input type="hidden" name="start" value="<? print $_GET['start']; ?>"/>
<input type="hidden" name="end" value="<? print $_GET['end']; ?>"/>
<input type="hidden" name="day" value="<? print $day; ?>"/>
<input type="hidden" name="month" value="<? print $month; ?>"/>
<input type="hidden" name="year" value="<? print $year; ?>"/>
<input type="hidden" name="respondent_id" value="<? print $respondent_id; ?>"/>
<input type="hidden" name="contact_phone_id" value="<? print $contact_phone_id; ?>"/>
<input type="submit" value="Make appointment"/></p>
</form>
<?
}
}
}
}
else
{
display_calendar($respondent_id,$questionnaire_id);
}
}
xhtml_foot();
?>

99
appointmentlist.php Normal file
View File

@@ -0,0 +1,99 @@
<?
/**
* Display appointments for this case and their outcomes if any
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
xhtml_head(T_("Appointment List"),true,array("css/table.css"),false,false,15);
//List the case appointment
// display in respondent time so that the operator will be able to
// quote verbatim to the respondent if necessary
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
if ($case_id)
{
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',r.Time_zone_name),'".TIME_FORMAT."') as end, c.completed_call_id, IFNULL(ou.firstName,'" . T_("Not yet called") . "') as firstName, CONCAT(r.firstName, ' ', r.lastName) as respname, IFNULL(o.description,'" . T_("Not yet called") . "') as des
FROM `appointment` as c
JOIN respondent as r on (r.respondent_id = c.respondent_id)
LEFT JOIN (`call` as ca, outcome as o, operator as ou) on (ca.call_id = c.completed_call_id and ca.outcome_id = o.outcome_id and ou.operator_id = ca.operator_id)
WHERE c.case_id = '$case_id'
ORDER BY c.start DESC";
}
else
{
$sql = "SELECT q.description, DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',r.Time_zone_name),'".TIME_FORMAT."') as end, c.completed_call_id, IFNULL(ou.firstName,'" . T_("Not yet called") . "') as firstName, r.firstName as rname, r.lastName as rsname, IFNULL(o.description,'" . T_("Not yet called") . "') as des
FROM `appointment` as c
JOIN respondent as r on (r.respondent_id = c.respondent_id)
JOIN `case` as ca on (ca.case_id = c.case_id)
LEFT JOIN (`call` as ca, outcome as o, operator as ou) on (ca.call_id = c.completed_call_id and ca.outcome_id = o.outcome_id and ou.operator_id = ca.operator_id)
WHERE oq.operator_id = '$operator_id'
AND ca.questionnaire_id = oq.questionnaire_id
ORDER BY c.start DESC";
}
$rs = $db->GetAll($sql);
if (empty($rs))
{
if ($case_id)
print "<p>" . T_("No appointments made") . "</p>";
else
print "<p>" . T_("No future appointments scheduled") . "</p>";
}
else
{
xhtml_table($rs,array("start","end","respname","des","firstName"),array(T_("Start"),T_("End"),T_("Respondent"),T_("Outcome"),T_("Operator")));
}
xhtml_foot();
?>

433
call.php Normal file
View File

@@ -0,0 +1,433 @@
<?
/**
* Popup screen to manage calling and hanging up and assigning outcomes to calls
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Calendar functions
*/
include("functions/functions.calendar.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
/**
* Input functions
*/
include("functions/functions.input.php");
/**
* LimeSurvey functions
*/
include("functions/functions.limesurvey.php");
/**
* Display appropriate outcomes based on current call attempt status
*
* @param int $contacted 0 for not contacted, 1 for contacted (a person on the phone)
* @param int $ca Call attempt id
* @param int $case_id The Case id
*
*/
function display_outcomes($contacted,$ca,$case_id)
{
global $db;
//see if the case is completed
if (limesurvey_is_completed($case_id))
{
$sql = "SELECT outcome_id,description
FROM outcome
WHERE outcome_id = 10";
}
else
{
//see if we have made an appointment on this call attempt
$sql = "SELECT appointment_id
FROM appointment
WHERE completed_call_id IS NULL
AND call_attempt_id = '$ca'";
$rs = $db->GetAll($sql);
if (!empty($rs))
{
//we have an appointment made ... only select appointment ID's
$sql = "SELECT outcome_id,description
FROM outcome
WHERE outcome_type_id = '5'";
}
else
{
if ($contacted === false)
{
$sql = "SELECT outcome_id,description
FROM outcome";
}
else
{
$contacted = bigintval($contacted);
$sql = "SELECT outcome_id,description
FROM outcome
WHERE contacted = '$contacted'";
}
}
}
$rs = $db->GetAll($sql);
print "<div>";
if (!empty($rs))
{
$do = false;
if (isset($_GET['defaultoutcome'])) $do = bigintval($_GET['defaultoutcome']);
foreach($rs as $r)
{
if ($do == $r['outcome_id']) $selected = "checked='checked'"; else $selected = "";
print "<div><label class='label'><input type='radio' class='radio' name='outcome' id='outcome-{$r['outcome_id']}' value='{$r['outcome_id']}' $selected/>" . T_($r['description']) . "</label></div>";
}
}
print "</div>";
}
//display the respondents phone numbers as a drop down list for this call
global $db;
$operator_id = get_operator_id();
if (isset($_POST['submit']))
{
if (isset($_POST['contact_phone']))
{
$contact_phone_id = bigintval($_POST['contact_phone']);
$call_attempt_id = get_call_attempt($operator_id);
$respondent_id = get_respondent_id($call_attempt_id);
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id);
if (VOIP_ENABLED && $call_id)
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->dial(get_extension($operator_id),get_call_number($call_id));
if (is_respondent_selection($operator_id))
$btext = "onload='openParentObject(\"main-content\",\"rs_intro.php\"); top.close();'";
else
$btext = "onload='top.close();'";
xhtml_head(T_("Call"),true,array("css/call.css"),array("js/window.js"),$btext);
}
}
else if (isset($_POST['outcome']))
{
$outcome_id = bigintval($_POST['outcome']);
end_call($operator_id,$outcome_id);
if (VOIP_ENABLED)
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->hangup(get_extension($operator_id));
//disable recording
$newtext = T_("Start REC");
xhtml_head(T_("Call"),true,array("css/call.css"),array("js/window.js"),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\"); top.close();'");
}
}
else
{
//if no outcome selected, just hang up the call
if (VOIP_ENABLED)
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->hangup(get_extension($operator_id));
//disable recording
$newtext = T_("Start REC");
xhtml_head(T_("Call"),true,array("css/call.css"),array("js/window.js"),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\"); top.close();'");
}
}
print "<p></p>"; //for XHTML
xhtml_foot();
exit();
}
$call_attempt_id = get_call_attempt($operator_id);
$case_id = get_case_id($operator_id);
/**
* Set the state manually if necessary (i.e if VOIP state is playing up)
*/
if (isset($_GET['newstate']))
{
$ns = bigintval($_GET['newstate']);
$sql = "UPDATE `call`
SET state = '$ns'
WHERE case_id = '$case_id'
AND operator_id = '$operator_id'
AND call_attempt_id = '$call_attempt_id'
AND outcome_id = '0'";
$db->Execute($sql);
}
xhtml_head(T_("Call"),true,array("css/call.css"),array("js/window.js"));
$state = is_on_call($operator_id);
switch($state)
{
case false: //no call made
case 0: //not called -- shouldn't come here as we should create requesting call immediately
print "<div class='status'>" . T_("Not on a call") . "</div>";
//if we are on an appointment, we will just call the specified number for the appointment
$appointment_id = is_on_appointment($call_attempt_id);
if ($appointment_id)
{
if (isset($_GET['end']))
{
//end the case
if (!isset($_GET['end'])) print "<div>" . T_("End work") . "</div>";
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p>";
}
else
{
//determine whether to begin calling based on extension status
$es = 1;
if (VOIP_ENABLED)
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$ext = get_extension($operator_id);
if ($v->getExtensionStatus($ext))
$es = 1;
else
$es = 0;
}
if ($es)
{
$sql = "SELECT c.*
FROM contact_phone as c, appointment as a
WHERE a.appointment_id = '$appointment_id'
AND a.contact_phone_id = c.contact_phone_id";
$r = $db->GetRow($sql);
print "<div>" . T_("Press the call button to dial the number for this appointment:") . "</div>";
print "<form action='?' method='post'><div>";
print "<p>" . T_("Number to call:") . " {$r['phone']} - {$r['description']}</p>";
print "</div><div><input type='hidden' id='contact_phone' name='contact_phone' value='{$r['contact_phone_id']}'/><input type='submit' value='Call' name='submit' id='submit'/></div></form>";
}
else
print "<div>" . T_("Your VoIP extension is not enabled. Please close this window and enable VoIP by clicking once on the red button that says 'VoIP Off'") . "</div>";
}
}
else
{
//determine whether we should make any more calls based on the last call outcome
$sql = "SELECT o.tryanother, o.require_note
FROM `call` as c, `outcome` as o
WHERE c.call_attempt_id = '$call_attempt_id'
AND c.outcome_id = o.outcome_id
ORDER BY call_id DESC
LIMIT 1";
$rs = $db->GetRow($sql);
if (!isset($_GET['end']) && (empty($rs) || $rs['tryanother'] == 1)) //dial another number only when available and not ending
{
$rn = 0;
if (!empty($rs) && $rs['require_note'] == 1) $rn = 1;
//an exclusion left join
$sql = "SELECT c. *
FROM contact_phone AS c
LEFT JOIN (
SELECT contact_phone.contact_phone_id
FROM contact_phone
LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )
LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )
WHERE contact_phone.case_id = '$case_id'
AND outcome.tryagain =0
) AS l ON l.contact_phone_id = c.contact_phone_id
LEFT JOIN
(
SELECT contact_phone_id
FROM `call`
WHERE call_attempt_id = '$call_attempt_id'
AND outcome_id != 18
) as ca on ca.contact_phone_id = c.contact_phone_id
WHERE c.case_id = '$case_id'
AND l.contact_phone_id IS NULL
AND ca.contact_phone_id IS NULL"; //only select numbers that should be tried again and have not been tried in this attempt which are not the accidental hang up outcome
//could be updated to take in to account the time delay and outcome
$rs = $db->GetAll($sql);
if (!empty($rs))
{
//determine whether to begin calling based on extension status
$es = 1;
if (VOIP_ENABLED)
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$ext = get_extension($operator_id);
if ($v->getExtensionStatus($ext))
$es = 1;
else
$es = 0;
}
if ($es)
{
print "<div>" . T_("Select phone number to dial:") . "</div>";
print "<form action='?' method='post'><div><select id='contact_phone' name='contact_phone'>";
foreach($rs as $r)
{
print "<option value='{$r['contact_phone_id']}'>{$r['phone']} - {$r['description']}</option>";
}
print "</select></div><div><input type='submit' value='Call' name='submit' id='submit'/></div></form>";
}
else
print "<div>" . T_("Your VoIP extension is not enabled. Please close this window and enable VoIP by clicking once on the red button that says 'VoIP Off'") . "</div>";
}
else //no phone numbers left
{
//end the case
print "<div>" . T_("The last call completed this call attempt") . "</div>";
if ($rn) // a note is required to be entered
{
print "<div><label for='note'>" . T_("Enter a reason for this outcome before completing this case:") . "</label><input type='text' id='note' name='note' size='48'/><br/><br/><br/><br/></div>";
//put these lower on the screen so they don't get "automatically" clicked
print "<p><a href='javascript:openParentNote(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParentNote(\"endwork=endwork\")'>" . T_("End work") . "</a></p>";
}
else
{
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p";
}
}
}
else //don't try any more
{
$rn = 0;
if (!empty($rs) && $rs['require_note'] == 1) $rn = 1;
//end the case
if ($rn) // a note is required to be entered
{
print "<div><label for='note'>" . T_("Enter a reason for this outcome before completing this case:") . "</label><input type='text' id='note' name='note' size='48'/><br/><br/><br/><br/></div>";
print "<p><a href='javascript:openParentNote(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParentNote(\"endwork=endwork\")'>" . T_("End work") . "</a></p>";
}
else
{
if (!isset($_GET['end'])) print "<div>" . T_("The last call completed this call attempt") . "</div>";
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p>";
}
}
}
break;
case 1: //requesting call
print "<div class='status'>" . T_("Requesting call") . "</div>";
print "<div><a href='?newstate=3'>" . T_("Call Answered") . "</a></div>";
print "<form action='?' method='post'>";
display_outcomes(0,$call_attempt_id,$case_id);
print "<div><input type='submit' value='" . T_("Hangup") . "' name='submit' id='submit'/></div></form>";
break;
case 2: //ringing
print "<div class='status'>" . T_("Ringing") . "</div>";
print "<div><a href='?newstate=3'>" . T_("Call Answered") . "</a></div>";
print "<form action='?' method='post'>";
display_outcomes(0,$call_attempt_id,$case_id);
print "<div><input type='submit' value='" . T_("Hangup") . "' name='submit' id='submit'/></div></form>";
break;
case 3: //answered
print "<div class='status'>" . T_("Answered") . "</div>";
print "<div><a href='?newstate=2'>" . T_("Not Answered") . "</a></div>";
print "<form action='?' method='post'>";
display_outcomes(1,$call_attempt_id,$case_id);
print "<div><input type='submit' value='" . T_("Hangup") . "' name='submit' id='submit'/></div></form>";
break;
case 4: //requires coding
print "<div class='status'>" . T_("Requires coding") . "</div>";
print "<form action='?' method='post'>";
display_outcomes(false,$call_attempt_id,$case_id);
print "<div><input type='submit' value='" . T_("Assign outcome") . "' name='submit' id='submit'/></div></form>";
break;
case 5: //done -- shouldn't come here as should be coded + done
default:
print "<div class='status'>" . T_("Error: Close window") . "</div>";
break;
}
xhtml_foot();
?>

85
callhistory.php Normal file
View File

@@ -0,0 +1,85 @@
<?
/**
* Display a list of calls and outcomes for this operator over time
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
xhtml_head(T_("Case History List"),true,array("css/table.css"),false,false,15);
//List the case call history
// display in respondent time so that the operator will be able to
// quote verbatim to the respondent if necessary
$operator_id = get_operator_id();
if ($operator_id)
{
global $db;
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as start,CONVERT_TZ(c.end,'UTC',op.Time_zone_name) as end, o.description as des, c.case_id as case_id, r.firstName as firstName
FROM `call` as c
JOIN (operator as op, outcome as o, respondent as r) on (c.operator_id = op.operator_id and c.outcome_id = o.outcome_id and r.respondent_id = c.respondent_id)
WHERE c.operator_id = '$operator_id'
ORDER BY c.start DESC
LIMIT 25";
$rs = $db->GetAll($sql);
if (empty($rs))
print "<p>" . T_("No calls ever made") . "</p>";
else
xhtml_table($rs,array("start","case_id","des","firstName"),array(T_("Date/Time"),T_("Case ID"),T_("Outcome"),T_("Respondent")));
}
else
print "<p>" . T_("No operator") . "</p>";
xhtml_foot();
?>

84
calllist.php Normal file
View File

@@ -0,0 +1,84 @@
<?
/**
* Display a list of calls and outcomes for this 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
xhtml_head(T_("Call List"),true,array("css/table.css"),false,false,15);
//List the case call history
// display in respondent time so that the operator will be able to
// quote verbatim to the respondent if necessary
$case_id = get_case_id(get_operator_id());
if ($case_id)
{
global $db;
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,CONVERT_TZ(c.end,'UTC',r.Time_zone_name) as end, op.firstName, op.lastName, o.description as des, cp.phone as cphone
FROM `call` as c
JOIN (operator as op, outcome as o, respondent as r, contact_phone as cp) on (c.operator_id = op.operator_id and c.outcome_id = o.outcome_id and r.respondent_id = c.respondent_id and c.contact_phone_id = cp.contact_phone_id)
WHERE c.case_id = '$case_id'
ORDER BY c.start DESC";
$rs = $db->GetAll($sql);
if (empty($rs))
print "<p>" . T_("No calls made") . "</p>";
else
xhtml_table($rs,array("start","des","cphone","firstName"),array(T_("Date/Time"),T_("Outcome"),T_("Number called"),T_("Operator")));
}
else
print "<p>" . T_("No case") . "</p>";
xhtml_foot();
?>

114
casenote.php Normal file
View File

@@ -0,0 +1,114 @@
<?
/**
* Display notes for this case and the ability to add notes
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
xhtml_head(T_("Case Notes"),true,array("css/table.css","css/casenote.css"),false, (isset($_GET['add'])) ? "onload=\"document.getElementById('note').focus();\"" : false);
//List the case note history
// display in the operators time
if (isset($_GET['add']))
{
?>
<form method="post" action="?">
<p>
<input type="text" class="textclass" name="note" id="note"/><input class="submitclass" type="submit" name="submit" value="<? echo T_("Add note"); ?>"/>
</p>
</form>
<p><a href="?"><? echo T_("Go back"); ?></a></p>
<?
}
else
{
global $db;
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
if ($case_id)
{
if (isset($_POST['note']))
{
$note = $db->qstr($_POST['note']);
$sql = "INSERT INTO `case_note` (case_note_id,case_id,operator_id,note,datetime)
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
}
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.datetime,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as time, op.firstName, op.lastName, c.note as note
FROM `case_note` as c
JOIN (operator as op) on (c.operator_id = op.operator_id)
WHERE c.case_id = '$case_id'
ORDER BY c.datetime DESC";
$rs = $db->GetAll($sql);
print "<div><a href=\"?add=add\">" . T_("Add note") . "</a></div>";
if (empty($rs))
print "<p>" . T_("No notes") . "</p>";
else
xhtml_table($rs,array("time","firstName","note"),array(T_("Date/Time"),T_("Operator"),T_("Note")));
}
else
print "<p>" . T_("No case") . "</p>";
}
xhtml_foot();
?>

131
config.inc.php Normal file
View File

@@ -0,0 +1,131 @@
<?
/**
* Configuration file
*
*
* 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 configuration
* @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
*
*/
/**
* The default time zone
*/
define('DEFAULT_TIME_ZONE', 'Australia/Victoria');
/**
* Date time format for displaying
*
* see http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
* for configuration details for DATE_TIME_FORMAT and TIME_FORMAT
*/
define('DATE_TIME_FORMAT','%a %d %b %I:%i%p');
/**
* Time format for displaying: see above for mySQL details
*/
define('TIME_FORMAT','%I:%i%p');
/**
* Flag for VoIP with Asterisk to be enabled or not
*/
define('VOIP_ENABLED',true);
/**
* The Asterisk server address
*/
define('VOIP_SERVER','asterisk.dcarf');
/**
* The meet me room id for the VOIP Server
*/
define('MEET_ME_ROOM','5000');
/**
* Whether to automatically pop up a coding window when the respondent hangs up
*/
define('AUTO_POPUP',false);
/**
* The extension of the supervisor for dialing the supervisor
*/
define('SUPERVISOR_EXTENSION',"0392517290");
/**
* The path to limesurvey
*/
define('LIME_PATH', 'include/limesurvey/');
/**
* The path to queXS from the server root
*/
define('QUEXS_PATH', '/quexs/');
/**
* The complete URL to limesurvey
*/
define('LIME_URL','http://' . $_SERVER['SERVER_NAME'] . QUEXS_PATH . LIME_PATH);
/**
* The complete URL to this copy of queXS
*/
define('QUEXS_URL','http://' . $_SERVER['SERVER_NAME'] . QUEXS_PATH);
/**
* The default locale (language)
*/
define('DEFAULT_LOCALE','en');
/**
* Path to ADODB
*/
define('ADODB_PATH',dirname(__FILE__).'/../adodb/');
/**
* Database configuration for queXS
*/
define('DB_USER', 'quexs');
define('DB_PASS', 'quexs');
define('DB_HOST', 'database.dcarf');
define('DB_NAME', 'quexs');
define('DB_TYPE', 'mysqlt');
/**
* The prefix for the limesurvey database
*/
define('LIME_PREFIX','lime_');
/**
* Limesurvey database information
*/
define('LDB_USER', 'quexs');
define('LDB_PASS', 'quexs');
define('LDB_HOST', 'database.dcarf');
define('LDB_NAME', 'quexs');
define('LDB_TYPE', 'mysqlt');
?>

74
db.inc.php Normal file
View File

@@ -0,0 +1,74 @@
<?
/**
* Database configuration file
*
*
* 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 configuration
* @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
*
*/
/**
* Set locale
*/
include_once(dirname(__FILE__).'/lang.inc.php');
/**
* Include ADODB
*/
if (!(include_once(ADODB_PATH . 'adodb.inc.php')))
{
print "<p>ERROR: Please modify config.inc.php for ADODB_PATH to point to your ADODb installation</p>";
}
/**
* Include ADODB session handling functions
*/
if (!(include_once(ADODB_PATH . 'session/adodb-session2.php')))
{
print "<p>ERROR: Please modify config.inc.php for ADODB_PATH to point to your ADODb installation</p>";
}
//if PEAR not installed:
set_include_path("."); //TEMP ONLY
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__).'/include/pear/');
//global database variable
$db = newADOConnection(DB_TYPE);
$db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
//global database variable for limesurvey
$ldb = newADOConnection(LDB_TYPE);
$ldb->Connect(LDB_HOST, LDB_USER, LDB_PASS, LDB_NAME);
$ldb->SetFetchMode(ADODB_FETCH_ASSOC);
//store session in database (see sessions2 table)
ADOdb_Session::config(DB_TYPE, DB_HOST, DB_USER, DB_PASS, DB_NAME,$options=false);
?>

67
endwork.php Normal file
View File

@@ -0,0 +1,67 @@
<?
/**
* Display the end work screen to the operator
*
*
* 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
*
* @todo integrate with users system: have a forwarding URL?
*
*/
/**
* Language file
*/
include ("lang.inc.php");
/**
* XHTML functions
*/
include_once("functions/functions.xhtml.php");
xhtml_head(T_("End of work"),false);
print "<script type='text/javascript'>
function unhide()
{
document.getElementById('cati').style.visibility = 'visible';
top.location = 'news://turnoffvoip';
}
</script>
</head>
<body>";
print "<h1>" .T_("Work has ended. That is it") . "</h1>";
print "<p><a href='news://turnoffvoip'>First: Turn VoIP off</a></p>";
print "<p id='cati'><a href='http://active.dcarf/work/'> Go back to work screen</a></p>";
xhtml_foot();
?>

162
index.php Normal file
View File

@@ -0,0 +1,162 @@
<?
/**
* Display the main page including all panels and tabs
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
$operator_id = get_operator_id();
if (isset($_GET['endwork']))
{
if (isset($_GET['note']))
{
$case_id = get_case_id($operator_id);
$note = $db->qstr($_GET['note']);
$sql = "INSERT INTO `case_note` (case_note_id,case_id,operator_id,note,datetime)
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
}
end_call_attempt($operator_id);
end_case($operator_id);
include("endwork.php");
exit();
}
if (isset($_GET['endcase']))
{
if (isset($_GET['note']))
{
$case_id = get_case_id($operator_id);
$note = $db->qstr($_GET['note']);
$sql = "INSERT INTO `case_note` (case_note_id,case_id,operator_id,note,datetime)
VALUES (NULL,'$case_id','$operator_id',$note,CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
}
end_call_attempt($operator_id);
end_case($operator_id);
}
xhtml_head(T_("queXS"), true, array("css/index.css","css/tabber.css") , array("js/popup.js","js/tabber.js"));
?>
<div id="casefunctions">
<div class='box'><a href="javascript:poptastic('call.php?end=end');"><? echo T_("End"); ?></a></div>
<div class='box'><a href="javascript:poptastic('appointment.php');"><? echo T_("Appointment"); ?></a></div>
<div class='box'><a href="javascript:poptastic('call.php');"><? echo T_("Call/Hangup"); ?></a></div>
<div class='box'><a href="javascript:poptastic('supervisor.php');"><? echo T_("Supervisor"); ?></a></div>
<div class='box' id='recbox'><a id='reclink' class='offline' href="javascript:poptastic('record.php?start=start');"><? echo T_("Start REC"); ?></a></div>
</div>
<div id="content">
<object class="embeddedobject" id="main-content" data="<? get_case_id($operator_id); get_call_attempt($operator_id); if (!is_respondent_selection($operator_id)) print(get_limesurvey_url($operator_id)); else print "rs_intro.php"; ?>" standby="Loading questionnaire..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div id="respondent">
<object class="embeddedobject" id="main-respondent" data="respondent.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div id="qstatus">
<object class="embeddedobject" id="main-qstatus" data="status.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div id="calllist">
<div class="tabber">
<div class="tabbertab">
<h2><? echo T_("Notes"); ?></h2>
<object class="embeddedobject" id="main-casenotes" data="casenote.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div class="tabbertab">
<h2><? echo T_("Call history"); ?></h2>
<object class="embeddedobject" id="main-calllist" data="calllist.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div class="tabbertab">
<h2><? echo T_("Shifts"); ?></h2>
<object class="embeddedobject" id="main-shifts" data="shifts.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div class="tabbertab">
<h2><? echo T_("Appointments"); ?></h2>
<object class="embeddedobject" id="main-appointmentlist" data="appointmentlist.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div class="tabbertab">
<h2><? echo T_("Performance"); ?></h2>
<object class="embeddedobject" id="main-performance" data="performance.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div class="tabbertab">
<h2><? echo T_("Work history"); ?></h2>
<object class="embeddedobject" id="main-callhistory" data="callhistory.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
<div class="tabbertab">
<h2><? echo T_("Info"); ?></h2>
<object class="embeddedobject" id="main-info" data="info.php" standby="Loading panel..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
</div>
</div>
</div>
<?
xhtml_foot();
?>

55
info.php Normal file
View File

@@ -0,0 +1,55 @@
<?
/**
* Display information about this project/centre
*
*
* 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");
/**
* XHTML
*/
include ("functions/functions.xhtml.php");
/**
* Language
*/
include ("lang.inc.php");
xhtml_head(T_("Information"));
?>
<p>DCARF Number: 1800 232 273</p>
<?
xhtml_foot();
?>

44
lang.inc.php Normal file
View File

@@ -0,0 +1,44 @@
<?
/**
* Language configuration file
*
*
* 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 configuration
* @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
*
*/
/**
* The phpgettext package
*/
require_once(dirname(__FILE__).'/include/php-gettext-1.0.7/gettext.inc');
$locale = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if (empty($locale)) $locale = DEFAULT_LOCALE;
T_setlocale(LC_MESSAGES, $locale);
T_bindtextdomain($locale, dirname(__FILE__)."/locale");
T_bind_textdomain_codeset($locale, 'UTF-8');
T_textdomain($locale);
?>

339
licence.txt Normal file
View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

185
nocaseavailable.php Normal file
View File

@@ -0,0 +1,185 @@
<?
/**
* Display error message when no cases available
*
*
* 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
*
* @todo Use calls to the database to determine the real reason why no case is available, not just give a list
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
xhtml_head(T_("No case available"),true,array("css/table.css"));
$operator_id = get_operator_id();
?>
<h1><? echo T_("There is no case currently available"); ?></h1>
<h2><? echo T_("Reasons:"); ?></h2>
<?
/**
* check for reasons why no case is displayed
*/
//you have not been assigned to a questionnaire
$sql = "SELECT oq.questionnaire_id, q.description
FROM operator_questionnaire as oq, questionnaire as q
WHERE oq.operator_id = '$operator_id'
AND q.questionnaire_id = oq.questionnaire_id";
$rs = $db->GetAll($sql);
?>
<p><? echo T_("Assigned questionnaires:"); ?></p>
<?
if (!empty($rs))
xhtml_table($rs,array("questionnaire_id","description"),array(T_("ID"),T_("Description")));
else
{
?> <p class='error'><? echo T_("ERROR: No questionnaires assigned to you"); ?></p> <?
}
//shift restrictions and no shift
$sql = "SELECT q.description, CONVERT_TZ(sh.start, 'UTC', o.Time_zone_name) as st, CONVERT_TZ(sh.end, 'UTC', o.Time_zone_name) as en
FROM operator_questionnaire AS oq
JOIN (questionnaire AS q, operator as o) ON ( oq.questionnaire_id = q.questionnaire_id and o.operator_id = oq.operator_id)
LEFT JOIN shift AS sh ON (
sh.questionnaire_id = oq.questionnaire_id
AND (CONVERT_TZ( NOW( ) , 'System', 'UTC' ) >= sh.start )
AND (CONVERT_TZ( NOW( ) , 'System', 'UTC' ) <= sh.end ))
WHERE oq.operator_id = '$operator_id'
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)";
$rs = $db->GetAll($sql);
?>
<p><? echo T_("Current shifts available:"); ?></p>
<?
if (!empty($rs))
xhtml_table($rs,array("description","st","en"),array(T_("Questionnaire"),T_("Shift start"),T_("Shift end")));
else
{
?> <p class='error'><? echo T_("ERROR: No shifts at this time"); ?></p> <?
}
//call restrictions and outside times
$sql = "SELECT count(*) as c
FROM operator_questionnaire as oq
JOIN (questionnaire_sample as qs, sample_import as si, sample as s) on (
qs.questionnaire_id = oq.questionnaire_id
and si.sample_import_id = qs.sample_import_id
and s.import_id = si.sample_import_id)
LEFT JOIN call_restrict as cr on (
cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name))
and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start
and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
WHERE operator_id = '$operator_id'
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)";
$rs = $db->GetRow($sql);
?>
<p><? echo T_("Call restrictions:"); ?></p>
<?
if ($rs['c'] == 0)
{
?> <p class='error'><? echo T_("ERROR: There are no cases available that fall within call restrictions"); ?></p> <?
}
else
{
print "<p>" . T_("There are ") . $rs['c'] . T_(" unassigned case(s) available within the specified call restrictions") . "</p>";
}
?>
<p><? echo T_("Limesurvey links:"); ?></p>
<?
//no link to limesurvey
$sql = "SELECT q.lime_sid, q.description
FROM questionnaire as q, operator_questionnaire as oq
WHERE oq.operator_id = '1'
AND q.questionnaire_id = oq.questionnaire_id";
$rs = $db->GetAll($sql);
if (!empty($rs))
{
foreach($rs as $r)
{
$sql = "SELECT count(*)
FROM " . LIME_PREFIX ."tokens_{$r['lime_sid']}";
$rs2 = $ldb->GetRow($sql);
if (empty($rs2))
print "<p class='error'>" . T_("ERROR: No tokens table defined for LimeSurvey questionnaire") . " {$r['lime_sid']} " . T_("from questionnaire:") . " {$r['description']}</p>";
else
print "<p>{$r['description']}: " . T_("Tokens table exists for Limesurvey questionnaire:") . " {$r['lime_sid']}</p>";
}
}
else
print "<p class='error'>" . T_("ERROR: Cannot find questionnaires with LimeSurvey ID's") . "</p>";
//no tokens table associated with questionnaire in limesurvey
//no sample associated with questionnaire
xhtml_foot();
?>

93
performance.php Normal file
View File

@@ -0,0 +1,93 @@
<?
/**
* Display the performance of this operator
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
/**
* Performance functions
*/
include("functions/functions.performance.php");
xhtml_head(T_("Performance"),true,array("css/table.css"),false,false,60);
$operator_id = get_operator_id();
$questionnaire_id = get_questionnaire_id($operator_id);
if ($questionnaire_id)
{
$shift_id = is_on_shift($operator_id);
if ($shift_id)
{
/**
* Get the outcomes for all operators on this shift
*
*/
$rs = get_CPH_by_shift($questionnaire_id,$shift_id);
print "<div>" . T_("This shift") . "</div>";
xhtml_table($rs,array("firstName","CPH"),array(T_("Operator"),T_("Completions per hour")),"tclass",array("operator_id" => $operator_id));
}
$rs = get_CPH_by_questionnaire($questionnaire_id);
print "<div>" . T_("This project") . "</div>";
xhtml_table($rs,array("firstName","CPH"),array(T_("Operator"),T_("Completions per hour")),"tclass",array("operator_id" => $operator_id));
}
$rs = get_CPH();
print "<div>" . T_("Overall") . "</div>";
xhtml_table($rs,array("firstName","CPH"),array(T_("Operator"),T_("Completions per hour")),"tclass",array("operator_id" => $operator_id));
xhtml_foot();
?>

100
record.php Normal file
View File

@@ -0,0 +1,100 @@
<?
/**
* Display a list of respondents for this case, and the ability to add them if necessary
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
if (is_on_call($operator_id) == 3)
{
if (isset($_GET['start']))
{
$newtext = T_("Stop REC");
xhtml_head(T_("Record"),true,array("css/call.css"),array("js/window.js"),"onload='toggleRec(\"$newtext\",\"record.php?stop=stop\",\"online\")'");
if (VOIP_ENABLED)
{
$call_id = get_call($operator_id);
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->beginRecord(get_extension($operator_id),"$case_id-$call_id-$operator_id-" . get_operator_time($operator_id,$format = "%Y-%m-%d-%H-%i-%S"));
print "<p>" . T_("Beginning recording...") . "</p>";
}
else
{
print "<p>" . T_("Begin the manual recording now...") . "</p>";
}
}
else if (isset($_GET['stop']))
{
$newtext = T_("Start REC");
xhtml_head(T_("Record"),true,array("css/call.css"),array("js/window.js"),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\")'");
if (VOIP_ENABLED)
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->endRecord(get_extension($operator_id));
print "<p>" . T_("Stopping recording...") . "</p>";
}
else
{
print "<p>" . T_("Stop the manual recording now...") . "</p>";
}
}
}
else
{
xhtml_head(T_("Record"),true,array("css/call.css"));
print "<p>" . T_("Not on a call, so not beginning a recording") . "</p>";
}
xhtml_foot();
?>

157
respondent.php Normal file
View File

@@ -0,0 +1,157 @@
<?
/**
* Display a list of respondents for this case, and the ability to add them if necessary
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Calendar functions
*/
include("functions/functions.calendar.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
/**
* Input functions
*/
include("functions/functions.input.php");
xhtml_head(T_("Respondent Selector"),true,array("css/table.css","css/respondent.css"),array("js/window.js","js/showhide.js"));
//display the respondents as a drop down list for this call attempt
// display in the operators time
global $db;
$operator_id = get_operator_id();
$call_attempt_id = get_call_attempt($operator_id);
$case_id = get_case_id($operator_id);
if (isset($_POST['submit']))
add_respondent($case_id,$_POST['firstName'],$_POST['lastName'],$_POST['Time_zone_name']);
if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
?>
<form method="post" action="?">
<? display_respondent_form(false,$case_id); ?>
<div><input type='submit' name='submit' id='submit' value='<? echo T_("Add respondent"); ?>'/></div>
</form>
<div><a href="?"><? echo T_("Go back"); ?></a></div>
<?
}
else
{
print "<div>" . T_("Case id:") . " $case_id</div>";
print "<div>" . T_("Respondent:") . "</div>";
if (isset($_GET['respondent_id']) && $_GET['respondent_id'] != 0)
{
$respondent_id = bigintval($_GET['respondent_id']);
$sql = "UPDATE `call_attempt`
SET respondent_id = '$respondent_id'
WHERE call_attempt_id = '$call_attempt_id'";
$db->Execute($sql);
}
/* List respondents
*
*/
$sql = "SELECT r.firstName, r.lastName, r.respondent_id,r.Time_zone_name,CASE WHEN c.respondent_id = r.respondent_id THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM respondent AS r
LEFT JOIN call_attempt AS c ON ( c.call_attempt_id = '$call_attempt_id' )
WHERE r.case_id = '$case_id'";
$rs = $db->GetAll($sql);
$timezone = "";
print "<div><select id='respondent' name='respondent' onchange=\"LinkUp('respondent')\"><option value='?respondent_id=0' class='addresp'>" . T_("Add respondent") . "</option>";
if (!empty($rs))
{
foreach($rs as $r)
{
if (!empty($r['selected'])) $timezone = $r['Time_zone_name'];
print "<option value='?respondent_id={$r['respondent_id']}' {$r['selected']}>{$r['firstName']} {$r['lastName']}</option>";
}
}
print "</select></div>";
print "<div>$timezone</div>";
//display sample details
// use type = 1 to limit to non specific sample variables
$sql = "SELECT s.var,s.val
FROM sample_var as s
JOIN `case` as c on (c.case_id = '$case_id' and c.sample_id = s.sample_id)
WHERE s.type = 1";
$rs = $db->GetAll($sql);
print "<div><a id='link1' href=\"javascript:showHide('details','link1');\">" . T_("Show details") . "</a></div>";
print "<div id='details'>";
if (!empty($rs))
{
xhtml_table($rs,array("var","val"),array(T_("Var"),T_("Value")));
}
print "</div>";
}
xhtml_foot();
?>

89
rs_answeringmachine.php Normal file
View File

@@ -0,0 +1,89 @@
<?
/**
* Respondent selection - Answering machine
*
*
* 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");
/**
* XHTML
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
$leavemessage = leave_message($case_id);
xhtml_head(T_("Respondent Selection - Answering machine"),true,array("css/rs.css"), array("js/popup.js"));
if ($leavemessage)
{
//display answering machine text
$sql = "SELECT rs_answeringmachine
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>" . template_replace($r['rs_answeringmachine'],$operator_id,$case_id) . "</p>";
}
else
print "<p class='rstext'>" . T_("Do not leave a message, please hang up") . "</p>";
?>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=29');"><? echo T_("End call with outcome: Business answering machine"); ?></a></p>
<?
if ($leavemessage)
{
?>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=23');"><? echo T_("End call with outcome: Answering machine Message left"); ?></a></p>
<?
}
?>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=24');"><? echo T_("End call with outcome: Answering machine No message left"); ?></a></p>
<p class='rsoption'><a href="rs_intro.php"><? echo T_("Go Back"); ?></a></p>
<?
xhtml_foot();
?>

58
rs_business.php Normal file
View File

@@ -0,0 +1,58 @@
<?
/**
* Respondent selection - Business answers
*
*
* 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");
/**
* XHTML
*/
include ("functions/functions.xhtml.php");
/**
* Language
*/
include ("lang.inc.php");
xhtml_head(T_("Respondent Selection - Business answers"),true,array("css/rs.css"), array("js/popup.js"));
?>
<p class='rstext'><? echo T_("Sorry to bother you, I have called the wrong number")?></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=16');"><? echo T_("End call with outcome: Business number"); ?></a></p>
<p class='rsoption'><a href="rs_intro.php"><? echo T_("Go Back"); ?></a></p>
<?
xhtml_foot();
?>

87
rs_callback.php Normal file
View File

@@ -0,0 +1,87 @@
<?
/**
* Respondent selection - Call back (respondent already started questionnaire)
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
/**
* Limesurvey functions
*/
include ("functions/functions.limesurvey.php");
xhtml_head(T_("Respondent Selection - Call back"),true,array("css/rs.css"),array("js/popup.js"));
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_callback
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>" . template_replace($r['rs_callback'],$operator_id,$case_id) . "</p>";
print "<p class='rstext'>" . T_("You are: ") . round(limesurvey_percent_complete($case_id),1) . T_("% complete") . "</p>";
//display outcomes
?>
<p class='rsoption'><a href="<? print(get_limesurvey_url($operator_id)); ?>"><? echo T_("Yes - Continue where we left off"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=8');"><? echo T_("End call with outcome: Refusal by respondent"); ?></a></p>
<p class='rsoption'><a href="rs_intro.php"><? echo T_("Go Back"); ?></a></p>
<?
xhtml_foot();
?>

104
rs_intro.php Normal file
View File

@@ -0,0 +1,104 @@
<?
/**
* Respondent selection introduction
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
/**
* Limesurvey functions
*/
include ("functions/functions.limesurvey.php");
xhtml_head(T_("Respondent Selection - Introduction"),true,array("css/rs.css"),array("js/popup.js"));
//display introduction text
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_intro
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>". template_replace($r['rs_intro'],$operator_id,$case_id) . "</p>";
//display outcomes
if (limesurvey_percent_complete($case_id) == false)
{
?>
<p class='rsoption'><a href="rs_project_intro.php"><? echo T_("Yes - Continue"); ?></a></p>
<?
} else {
?>
<p class='rsoption'><a href="rs_callback.php"><? echo T_("Yes - Continue"); ?></a></p>
<?
}
?>
<p class='rsoption'><a href="rs_business.php"><? echo T_("Business number"); ?></a></p>
<p class='rsoption'><a href="rs_answeringmachine.php"><? echo T_("Answering machine"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=2');"><? echo T_("End call with outcome: No answer (ring out or busy) "); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=18');"><? echo T_("End call with outcome: Accidental hang up"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=6');"><? echo T_("End call with outcome: Refusal by unknown person"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=8');"><? echo T_("End call with outcome: Refusal by respondent"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=17');"><? echo T_("End call with outcome: No eligible respondent (person never available on this number)"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=31');"><? echo T_("End call with outcome: Non contact (person not currently available on this number: no appointment made)"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=30');"><? echo T_("End call with outcome: Out of sample (already completed in another mode)"); ?></a></p>
<?
xhtml_foot();
?>

75
rs_project_end.php Normal file
View File

@@ -0,0 +1,75 @@
<?
/**
* Respondent selection - Project End
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
xhtml_head(T_("Respondent Selection - Project End"),true,array("css/rs.css"),array("js/popup.js"));
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_project_end
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>" . template_replace($r['rs_project_end'],$operator_id,$case_id) . "</p>";
?>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=10');"><? echo T_("End call with outcome: Complete"); ?></a></p>
<?
xhtml_foot();
?>

87
rs_project_intro.php Normal file
View File

@@ -0,0 +1,87 @@
<?
/**
* Respondent selection - Project Introduction
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
xhtml_head(T_("Respondent Selection - Project Introduction"),true,array("css/rs.css"),array("js/popup.js"));
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
$questionnaire_id = get_questionnaire_id($operator_id);
//display introduction text
$sql = "SELECT rs_project_intro
FROM questionnaire
WHERE questionnaire_id = '$questionnaire_id'";
$r = $db->GetRow($sql);
print "<p class='rstext'>" . template_replace($r['rs_project_intro'],$operator_id,$case_id) . "</p>";
//display outcomes
?>
<p class='rsoption'><a href="<? print(get_limesurvey_url($operator_id)); ?>"><? echo T_("Yes - Continue"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=8');"><? echo T_("End call with outcome: Refusal by respondent"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=17');"><? echo T_("End call with outcome: No eligible respondent (person not available on this number)"); ?></a></p>
<p class='rsoption'><a href="javascript:poptastic('call.php?defaultoutcome=30');"><? echo T_("End call with outcome: Out of sample (already completed in another mode)"); ?></a></p>
<p class='rsoption'><a href="rs_intro.php"><? echo T_("Go Back"); ?></a></p>
<?
xhtml_foot();
?>

105
shifts.php Normal file
View File

@@ -0,0 +1,105 @@
<?
/**
* Display the shifts for this case, if no case, show all shifts that the operator is assigned to
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
xhtml_head(T_("Shift List"),true,array("css/table.css"),false,false,600);
//List the shifts
// display in operator time
$operator_id = get_operator_id();
$case_id = get_case_id($operator_id);
if ($case_id)
{
global $db;
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as end
FROM `shift` as c, `case` as ca, `operator` as op
WHERE ca.case_id = '$case_id'
AND op.operator_id = '$operator_id'
AND c.questionnaire_id = ca.questionnaire_id
AND c.end >= CONVERT_TZ(NOW(),'System','UTC')
ORDER BY c.start ASC";
$rs = $db->GetAll($sql);
if (empty($rs))
print "<p>" . T_("No shifts for this project") . "</p>";
else
xhtml_table($rs,array("start","end"),array(T_("Start"),T_("End")));
}
else
{
//no case so show all shifts for all projects that I am assigned to
global $db;
$sql = "SELECT q.description,DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as end
FROM `shift` as c, `operator` as op, `operator_questionnaire` as oq, `questionnaire` as q
WHERE op.operator_id = '$operator_id'
AND op.operator_id = oq.operator_id
AND oq.questionnaire_id = c.questionnaire_id
AND q.questionnaire_id = oq.questionnaire_id
AND c.end >= CONVERT_TZ(NOW(),'System','UTC')
ORDER BY c.start ASC";
$rs = $db->GetAll($sql);
if (empty($rs))
print "<p>" . T_("No future shifts scheduled") . "</p>";
else
xhtml_table($rs,array("description","start","end"),array(T_("Questionnaire"),T_("Start"),T_("End")));
}
xhtml_foot();
?>

117
status.php Normal file
View File

@@ -0,0 +1,117 @@
<?
/**
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
$operator_id = get_operator_id();
$state = is_on_call($operator_id);
$btext = false;
if ($state == 4 && AUTO_POPUP)
$btext = "onload=\"poptastic('call.php')\"";
xhtml_head(T_("Status"),true,array("css/status.css"),array("js/popupkeep.js"),$btext,5);
print "<div class='text'>" . get_operator_time($operator_id,"%a %d %b %h:%i%p") ."</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 (VOIP_ENABLED)
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$ext = get_extension($operator_id);
if ($v->getExtensionStatus($ext))
print "<div class='online statusbutton'><a href='news://turnvoipoff/'>" . T_("VoIP On") . "</a></div>";
else
print "<div class='offline statusbutton'><a href='irc://$ext:$ext@asterisk.dcarf'>" . T_("VoIP Off") . "</a></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);
if ($ca)
{
print "<div class='text'>" . get_respondent_time(get_respondent_id($ca),"%h:%i%p") ."</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();
?>

89
supervisor.php Normal file
View File

@@ -0,0 +1,89 @@
<?
/**
* Supervisor help functions
*
*
* 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");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Operator functions
*/
include ("functions/functions.operator.php");
xhtml_head(T_("Supervisor"));
//display introduction text
$operator_id = get_operator_id();
if (is_on_call($operator_id) == 3)
{
if (VOIP_ENABLED)
{
if (isset($_GET['callsupervisor']))
{
include("functions/functions.voip.php");
$v = new voip();
$v->connect(VOIP_SERVER);
$v->addParty($operator_id,SUPERVISOR_EXTENSION);
print "<p>" . T_("Calling the supervisor, you may close this window") . "</p>";
}
else
{
//print "<p><a href='?callsupervisor=callsupervisor'>" . T_("Click here to call the supervisor's phone. Otherwise close this window") . "</a></p>";
print "<p>" . T_("Currently Disabled: Please see your supervisor in person") . "</p>";
}
}
else
{
print "<p>" . T_("Try calling the supervisor") . "</p>";
}
}
else
{
print "<p>" . T_("Not on a call, so not calling the supervisor") . "</p>";
}
xhtml_foot();
?>