* @copyright Australian Consortium for Social and Political Research Inc 2007,2008 * @package queXS * @subpackage user * @link http://www.acspri.org.au/ queXS was writen for Australian Consortium for Social and Political Research Incorporated (ACSPRI) * @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"); $popupcall = false; $operator_id = get_operator_id(); if ($operator_id === false) die(); $db->StartTrans(); if (isset($_GET['endwork'])) { $call_id = get_call($operator_id); if ($call_id) { //Don't end the case if we are on a call $popupcall = true; } else { if (isset($_GET['note'])) { $case_id = get_case_id($operator_id,false); $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); //if ($db->HasFailedTrans()){ print "

FAILED AT ENDWORK

"; exit();} $db->CompleteTrans(); include("waitnextcase_interface2.php"); exit(); } } if (isset($_GET['endcase'])) { if (isset($_GET['note'])) { $case_id = get_case_id($operator_id,false); $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); } $endthecase = true; if (isset($_GET['outcome'])) { $outcome_id = intval($_GET['outcome']); end_call($operator_id,$outcome_id); $sql = "SELECT tryanother FROM outcome WHERE outcome_id = '$outcome_id'"; $rs = $db->GetRow($sql); if (!empty($rs) && $rs['tryanother'] == 1) { //we can try another number... $case_id = get_case_id($operator_id,false); $call_attempt_id = get_call_attempt($operator_id,false); //check if there is another number to try... $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 $rs = $db->GetAll($sql); if (!empty($rs)) $endthecase = false; } } if ($endthecase) { end_call_attempt($operator_id); end_case($operator_id); $db->CompleteTrans(); //need to complete here otherwise getting the case later will fail include("waitnextcase_interface2.php"); exit(); } } $js = array("js/popup.js","js/tabber.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); $body = true; $script = ""; if (AUTO_LOGOUT_MINUTES !== false) { $js[] = "include/nap-1.0.0/js/jquery.nap-1.0.0.js"; $script = ""; $body = false; } if ($popupcall) $js[] = "js/popupcallonload.js"; if (HEADER_EXPANDER) { $js[] = "js/headerexpand_interface2.js"; $js[] = "js/headerexpandmanual_interface2.js"; } else if (HEADER_EXPANDER_MANUAL) { $js[] = "js/headerexpand_interface2.js"; $js[] = "js/headerexpandmanual_interface2.js"; } xhtml_head(T_("queXS"), $body, array("css/index_interface2.css","css/tabber_interface2.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js); print $script; $case_id = get_case_id($operator_id,true); $sql = "SELECT q.self_complete, q.referral FROM questionnaire as q, `case` as c WHERE c.case_id = $case_id AND c.questionnaire_id = q.questionnaire_id"; $scr = $db->GetRow($sql); $sc = $scr['self_complete']; $ref = $scr['referral']; ?>
GetRow($sql); if (!empty($rs)) { $contact_phone_id = $rs['contact_phone_id']; if (!isset($rs['respondent_id'])) { $sql = "SELECT respondent_id FROM respondent WHERE case_id = $case_id"; $respondent_id = $db->GetOne($sql); } else { $respondent_id = $rs['respondent_id']; } $call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true); } } if (!is_respondent_selection($operator_id)) $data = get_limesurvey_url($operator_id); else $data = get_respondentselection_url($operator_id,true,true); //use second interface xhtml_object($data,"main-content"); ?>
<?php  echo T_('/>
">

">

">

">

" id="tab-shifts">

">

">

">

">

">

HasFailedTrans()){ print "

FAILED AT END of index

"; exit();} $db->CompleteTrans(); ?>