diff --git a/appointment.php b/appointment.php new file mode 100644 index 00000000..3c265c9d --- /dev/null +++ b/appointment.php @@ -0,0 +1,223 @@ + + * @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("
" . T_("You have not been assigned a case therefore cannot create an appointment") . "
"); + 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("

" . T_("Select a respondent") . "

"); + +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 + ?> +

+
+ +

"/>

+
+ " . T_("Select phone number:") . "

"; + + if (isset($_GET['contact_phone_id'])) $contact_phone_id = bigintval($_GET['contact_phone_id']); + else $contact_phone_id = -1; + + print "
"; + + + 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 + ?> +

+
+

+

"/> + + + + + +

+
+ +

+
+ " . T_("Accept appointment from ") .convert_time($_GET['start']).T_(" till ").convert_time($_GET['end']).T_(" on ") . "$day/$month/$year? " . T_("on") . " $phonenum

"; ?> +

+ + + + + + + +

+
+ diff --git a/appointmentlist.php b/appointmentlist.php new file mode 100644 index 00000000..af305502 --- /dev/null +++ b/appointmentlist.php @@ -0,0 +1,99 @@ + + * @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 "

" . T_("No appointments made") . "

"; + else + print "

" . T_("No future appointments scheduled") . "

"; +} +else +{ + xhtml_table($rs,array("start","end","respname","des","firstName"),array(T_("Start"),T_("End"),T_("Respondent"),T_("Outcome"),T_("Operator"))); +} + + +xhtml_foot(); + + +?> diff --git a/call.php b/call.php new file mode 100644 index 00000000..a11a2648 --- /dev/null +++ b/call.php @@ -0,0 +1,433 @@ + + * @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 "
"; + 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 "
"; + } + } + print "
"; + + +} + + +//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 "

"; //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 "
" . T_("Not on a call") . "
"; + + + //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 "
" . T_("End work") . "
"; + print "

" . T_("End case") . "

"; + print "

" . T_("End work") . "

"; + } + 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 "
" . T_("Press the call button to dial the number for this appointment:") . "
"; + + print "
"; + print "

" . T_("Number to call:") . " {$r['phone']} - {$r['description']}

"; + print "
"; + } + else + print "
" . 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'") . "
"; + } + } + 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 "
" . T_("Select phone number to dial:") . "
"; + + print "
"; + } + else + print "
" . 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'") . "
"; + } + else //no phone numbers left + { + //end the case + print "
" . T_("The last call completed this call attempt") . "
"; + + if ($rn) // a note is required to be entered + { + print "




"; + //put these lower on the screen so they don't get "automatically" clicked + print "

" . T_("End case") . "

"; + print "

" . T_("End work") . "

"; + } + else + { + print "

" . T_("End case") . "

"; + print "

" . T_("End work") . "



"; + print "

" . T_("End case") . "

"; + print "

" . T_("End work") . "

"; + } + else + { + if (!isset($_GET['end'])) print "
" . T_("The last call completed this call attempt") . "
"; + print "

" . T_("End case") . "

"; + print "

" . T_("End work") . "

"; + } + } + } + break; + case 1: //requesting call + print "
" . T_("Requesting call") . "
"; + print "
" . T_("Call Answered") . "
"; + print "
"; + display_outcomes(0,$call_attempt_id,$case_id); + print "
"; + break; + case 2: //ringing + print "
" . T_("Ringing") . "
"; + print "
" . T_("Call Answered") . "
"; + print "
"; + display_outcomes(0,$call_attempt_id,$case_id); + print "
"; + break; + case 3: //answered + print "
" . T_("Answered") . "
"; + print "
" . T_("Not Answered") . "
"; + print "
"; + display_outcomes(1,$call_attempt_id,$case_id); + print "
"; + break; + case 4: //requires coding + print "
" . T_("Requires coding") . "
"; + print "
"; + display_outcomes(false,$call_attempt_id,$case_id); + print "
"; + break; + case 5: //done -- shouldn't come here as should be coded + done + default: + print "
" . T_("Error: Close window") . "
"; + break; + +} + + +xhtml_foot(); + + +?> diff --git a/callhistory.php b/callhistory.php new file mode 100644 index 00000000..b0b79a43 --- /dev/null +++ b/callhistory.php @@ -0,0 +1,85 @@ + + * @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 "

" . T_("No calls ever made") . "

"; + else + xhtml_table($rs,array("start","case_id","des","firstName"),array(T_("Date/Time"),T_("Case ID"),T_("Outcome"),T_("Respondent"))); +} +else + print "

" . T_("No operator") . "

"; + +xhtml_foot(); + + +?> diff --git a/calllist.php b/calllist.php new file mode 100644 index 00000000..e90a5344 --- /dev/null +++ b/calllist.php @@ -0,0 +1,84 @@ + + * @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 "

" . T_("No calls made") . "

"; + else + xhtml_table($rs,array("start","des","cphone","firstName"),array(T_("Date/Time"),T_("Outcome"),T_("Number called"),T_("Operator"))); +} +else + print "

" . T_("No case") . "

"; + +xhtml_foot(); + + +?> diff --git a/casenote.php b/casenote.php new file mode 100644 index 00000000..8f39d048 --- /dev/null +++ b/casenote.php @@ -0,0 +1,114 @@ + + * @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'])) +{ +?> +
+

+ "/> +

+
+

+ +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 "
" . T_("Add note") . "
"; + + if (empty($rs)) + print "

" . T_("No notes") . "

"; + else + xhtml_table($rs,array("time","firstName","note"),array(T_("Date/Time"),T_("Operator"),T_("Note"))); + } + else + print "

" . T_("No case") . "

"; +} + +xhtml_foot(); + + +?> diff --git a/config.inc.php b/config.inc.php new file mode 100644 index 00000000..d925dd69 --- /dev/null +++ b/config.inc.php @@ -0,0 +1,131 @@ + + * @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'); + + +?> diff --git a/db.inc.php b/db.inc.php new file mode 100644 index 00000000..8d670289 --- /dev/null +++ b/db.inc.php @@ -0,0 +1,74 @@ + + * @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 "

ERROR: Please modify config.inc.php for ADODB_PATH to point to your ADODb installation

"; +} + +/** + * Include ADODB session handling functions + */ +if (!(include_once(ADODB_PATH . 'session/adodb-session2.php'))) +{ + print "

ERROR: Please modify config.inc.php for ADODB_PATH to point to your ADODb installation

"; +} + +//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); + +?> diff --git a/endwork.php b/endwork.php new file mode 100644 index 00000000..c99024f8 --- /dev/null +++ b/endwork.php @@ -0,0 +1,67 @@ + + * @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 " + + "; + +print "

" .T_("Work has ended. That is it") . "

"; + +print "

First: Turn VoIP off

"; + +print "

Go back to work screen

"; + +xhtml_foot(); + + + +?> diff --git a/index.php b/index.php new file mode 100644 index 00000000..6b98afbd --- /dev/null +++ b/index.php @@ -0,0 +1,162 @@ + + * @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")); +?> + +
+
+
+
+
+
+
+ +
+" standby="Loading questionnaire..." type="application/xhtml+xml">

Error, try with Firefox

+
+ +
+

Error, try with Firefox

+
+ +
+

Error, try with Firefox

+
+ + +
+ + +
+ +
+

+

Error, try with Firefox

+
+ + +
+

+

Error, try with Firefox

+
+ + +
+

+

Error, try with Firefox

+
+ + +
+

+

Error, try with Firefox

+
+ + +
+

+

Error, try with Firefox

+
+ +
+

+

Error, try with Firefox

+
+ + +
+

+

Error, try with Firefox

+
+ + +
+ + +
+ + diff --git a/info.php b/info.php new file mode 100644 index 00000000..6d9c992d --- /dev/null +++ b/info.php @@ -0,0 +1,55 @@ + + * @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")); + +?> +

DCARF Number: 1800 232 273

+ diff --git a/lang.inc.php b/lang.inc.php new file mode 100644 index 00000000..1d65649d --- /dev/null +++ b/lang.inc.php @@ -0,0 +1,44 @@ + + * @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); + +?> diff --git a/licence.txt b/licence.txt new file mode 100644 index 00000000..d511905c --- /dev/null +++ b/licence.txt @@ -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. + + + Copyright (C) + + 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. + + , 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. diff --git a/nocaseavailable.php b/nocaseavailable.php new file mode 100644 index 00000000..01759dc1 --- /dev/null +++ b/nocaseavailable.php @@ -0,0 +1,185 @@ + + * @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(); + +?> +

+

+ +GetAll($sql); + +?> +

+

= 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); + +?> +

+

= 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); + +?> +

+

" . T_("There are ") . $rs['c'] . T_(" unassigned case(s) available within the specified call restrictions") . "

"; +} + + + +?> +

+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 "

" . T_("ERROR: No tokens table defined for LimeSurvey questionnaire") . " {$r['lime_sid']} " . T_("from questionnaire:") . " {$r['description']}

"; + else + print "

{$r['description']}: " . T_("Tokens table exists for Limesurvey questionnaire:") . " {$r['lime_sid']}

"; + + } +} +else + print "

" . T_("ERROR: Cannot find questionnaires with LimeSurvey ID's") . "

"; + + +//no tokens table associated with questionnaire in limesurvey + + + +//no sample associated with questionnaire + + + + +xhtml_foot(); + + +?> diff --git a/performance.php b/performance.php new file mode 100644 index 00000000..28f0bc03 --- /dev/null +++ b/performance.php @@ -0,0 +1,93 @@ + + * @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 "
" . T_("This shift") . "
"; + 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 "
" . T_("This project") . "
"; + xhtml_table($rs,array("firstName","CPH"),array(T_("Operator"),T_("Completions per hour")),"tclass",array("operator_id" => $operator_id)); +} + + +$rs = get_CPH(); +print "
" . T_("Overall") . "
"; +xhtml_table($rs,array("firstName","CPH"),array(T_("Operator"),T_("Completions per hour")),"tclass",array("operator_id" => $operator_id)); + +xhtml_foot(); + + +?> diff --git a/record.php b/record.php new file mode 100644 index 00000000..fa25a4e7 --- /dev/null +++ b/record.php @@ -0,0 +1,100 @@ + + * @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 "

" . T_("Beginning recording...") . "

"; + } + else + { + print "

" . T_("Begin the manual recording now...") . "

"; + } + } + 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 "

" . T_("Stopping recording...") . "

"; + } + else + { + print "

" . T_("Stop the manual recording now...") . "

"; + } + } +} +else +{ + xhtml_head(T_("Record"),true,array("css/call.css")); + print "

" . T_("Not on a call, so not beginning a recording") . "

"; +} + +xhtml_foot(); + + + + +?> diff --git a/respondent.php b/respondent.php new file mode 100644 index 00000000..b76f591c --- /dev/null +++ b/respondent.php @@ -0,0 +1,157 @@ + + * @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) +{ +?> +
+ +
+
+
+ +" . T_("Case id:") . " $case_id"; + print "
" . T_("Respondent:") . "
"; + + 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 "
"; + + print "
$timezone
"; + + + + //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 "
" . T_("Show details") . "
"; + print "
"; + if (!empty($rs)) + { + xhtml_table($rs,array("var","val"),array(T_("Var"),T_("Value"))); + } + print "
"; + +} + +xhtml_foot(); + + +?> diff --git a/rs_answeringmachine.php b/rs_answeringmachine.php new file mode 100644 index 00000000..6ec806ba --- /dev/null +++ b/rs_answeringmachine.php @@ -0,0 +1,89 @@ + + * @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 "

" . template_replace($r['rs_answeringmachine'],$operator_id,$case_id) . "

"; +} +else + print "

" . T_("Do not leave a message, please hang up") . "

"; + +?> +

+ +

+ +

+

+ diff --git a/rs_business.php b/rs_business.php new file mode 100644 index 00000000..78819e50 --- /dev/null +++ b/rs_business.php @@ -0,0 +1,58 @@ + + * @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")); + +?> +

+ +

+

+ diff --git a/rs_callback.php b/rs_callback.php new file mode 100644 index 00000000..2cd0ffdd --- /dev/null +++ b/rs_callback.php @@ -0,0 +1,87 @@ + + * @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 "

" . template_replace($r['rs_callback'],$operator_id,$case_id) . "

"; +print "

" . T_("You are: ") . round(limesurvey_percent_complete($case_id),1) . T_("% complete") . "

"; + + +//display outcomes + +?> + +

+

+

+ diff --git a/rs_intro.php b/rs_intro.php new file mode 100644 index 00000000..fa12b537 --- /dev/null +++ b/rs_intro.php @@ -0,0 +1,104 @@ + + * @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 "

". template_replace($r['rs_intro'],$operator_id,$case_id) . "

"; + + +//display outcomes + +if (limesurvey_percent_complete($case_id) == false) +{ + ?> +

+ +

+ +

+

+

+

+

+

+

+

+

+ diff --git a/rs_project_end.php b/rs_project_end.php new file mode 100644 index 00000000..972327f7 --- /dev/null +++ b/rs_project_end.php @@ -0,0 +1,75 @@ + + * @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 "

" . template_replace($r['rs_project_end'],$operator_id,$case_id) . "

"; + +?> +

+ diff --git a/rs_project_intro.php b/rs_project_intro.php new file mode 100644 index 00000000..2dc3bae5 --- /dev/null +++ b/rs_project_intro.php @@ -0,0 +1,87 @@ + + * @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 "

" . template_replace($r['rs_project_intro'],$operator_id,$case_id) . "

"; + + +//display outcomes + +?> + +

+ +

+

+

+ +

+ + diff --git a/shifts.php b/shifts.php new file mode 100644 index 00000000..e76e8cd0 --- /dev/null +++ b/shifts.php @@ -0,0 +1,105 @@ + + * @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 "

" . T_("No shifts for this project") . "

"; + 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 "

" . T_("No future shifts scheduled") . "

"; + else + xhtml_table($rs,array("description","start","end"),array(T_("Questionnaire"),T_("Start"),T_("End"))); + +} + +xhtml_foot(); + +?> diff --git a/status.php b/status.php new file mode 100644 index 00000000..62da22c2 --- /dev/null +++ b/status.php @@ -0,0 +1,117 @@ + + * @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 "
" . get_operator_time($operator_id,"%a %d %b %h:%i%p") ."
"; + +//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 ""; + else + print ""; +} +else + print "
" . T_("No VoIP") . "
"; + +if (!$state || $state == 5) +{ + print("
" . T_("No call") . "
"); +} +else if ($state == 4) +{ + print("
" . T_("To be coded") . "
"); +} +else if ($state == 1) +{ + print("
" . T_("Requesting") . "
"); +} +else if ($state == 2) +{ + print("
" . T_("Ringing") . "
"); +} +else if ($state == 3) +{ + print("
" . T_("Answered") . "
"); +} + + +$ca = get_call_attempt($operator_id); +if ($ca) +{ + print "
" . get_respondent_time(get_respondent_id($ca),"%h:%i%p") ."
"; + if (is_on_appointment($ca)) print "
" . T_("APPT") . "
"; + if (missed_appointment($ca)) print "
" . T_("MISSED") . "
"; +} +else + print "
" . T_("No case") . "
"; + +xhtml_foot(); + +?> diff --git a/supervisor.php b/supervisor.php new file mode 100644 index 00000000..6e83656d --- /dev/null +++ b/supervisor.php @@ -0,0 +1,89 @@ + + * @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 "

" . T_("Calling the supervisor, you may close this window") . "

"; + } + else + { + //print "

" . T_("Click here to call the supervisor's phone. Otherwise close this window") . "

"; + print "

" . T_("Currently Disabled: Please see your supervisor in person") . "

"; + } + } + else + { + print "

" . T_("Try calling the supervisor") . "

"; + } +} +else +{ + print "

" . T_("Not on a call, so not calling the supervisor") . "

"; +} + +xhtml_foot(); + + +?>