From 16d775ec4b447b2752315281927d37290f7c59ee Mon Sep 17 00:00:00 2001 From: azammitdcarf Date: Wed, 5 Oct 2011 04:29:41 +0000 Subject: [PATCH] Added ALTERNATE_INTERFACE config directive (defaults to false) Alternate interface appears for non VoIP users when ALTERNATE_INTERFACE set to true This interface is a bit faster to operate (less popup windows) and makes more sense when not using the system to auto-dial Sponsored by Zimi --- admin/quotarow.php | 10 + call_interface2.php | 483 +++++++++++++++++++++++++++++ config.default.php | 10 + contactdetails.php | 10 +- css/index_interface2.css | 81 +++++ css/respondent_interface2.css | 13 + functions/functions.operator.php | 98 +++++- include/limesurvey/index.php | 15 +- index.php | 10 +- index_interface2.php | 330 ++++++++++++++++++++ js/headerexpandmanual.js | 6 + js/headerexpandquestionnaire.js | 2 + js/popupcallonload.js | 4 + js/window_ie6_interface2.js | 37 +++ js/window_interface2.js | 41 +++ rs_answeringmachine_interface2.php | 96 ++++++ rs_business_interface2.php | 67 ++++ rs_callback_interface2.php | 95 ++++++ rs_intro_interface2.php | 131 ++++++++ rs_project_end.php | 10 +- rs_project_end_interface2.php | 90 ++++++ rs_project_intro_interface2.php | 92 ++++++ rs_quota_end.php | 9 + status_interface2.php | 211 +++++++++++++ waitnextcase_interface2.php | 84 +++++ 25 files changed, 2022 insertions(+), 13 deletions(-) create mode 100644 call_interface2.php create mode 100644 css/index_interface2.css create mode 100644 css/respondent_interface2.css create mode 100644 index_interface2.php create mode 100644 js/headerexpandquestionnaire.js create mode 100644 js/popupcallonload.js create mode 100644 js/window_ie6_interface2.js create mode 100644 js/window_interface2.js create mode 100644 rs_answeringmachine_interface2.php create mode 100644 rs_business_interface2.php create mode 100644 rs_callback_interface2.php create mode 100644 rs_intro_interface2.php create mode 100644 rs_project_end_interface2.php create mode 100644 rs_project_intro_interface2.php create mode 100644 status_interface2.php create mode 100644 waitnextcase_interface2.php diff --git a/admin/quotarow.php b/admin/quotarow.php index 798598df..e9357199 100755 --- a/admin/quotarow.php +++ b/admin/quotarow.php @@ -147,6 +147,12 @@ if ($questionnaire_id != false) print "

" . T_("Copied quotas") . "

"; } + if (isset($_POST['copy_sample_import_id_with_adjustment'])) + { + copy_row_quota_with_adjusting($questionnaire_id,$sample_import_id,bigintval($_POST['copy_sample_import_id_with_adjustment'])); + print "

" . T_("Copied quotas") . "

"; + } + print "

" . T_("Current row quotas (click to delete)") . "

"; $sql = "SELECT questionnaire_sample_quota_row_id,lime_sgqa,value,completions,quota_reached,lime_sid,comparison,exclude_var,exclude_val,current_completions @@ -196,6 +202,10 @@ if ($questionnaire_id != false) print "

" . T_("Copy quotas for this sample to (No error/duplicate checking): "); display_chooser($ss,"copy_sample_import_id","copy_sample_import_id",false,false,false,false); print "

"; + + print "

" . T_("Copy quotas for this sample to (No error/duplicate checking) with adjusting: "); + display_chooser($ss,"copy_sample_import_id_with_adjustment","copy_sample_import_id_with_adjustment",false,false,false,false); + print "

"; } } diff --git a/call_interface2.php b/call_interface2.php new file mode 100644 index 00000000..3b0f0c96 --- /dev/null +++ b/call_interface2.php @@ -0,0 +1,483 @@ + + * @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; + + $completed = limesurvey_is_completed($case_id); + + //see if the case is completed + if ($completed) + { + $sql = "SELECT outcome_id,description + FROM outcome + WHERE outcome_id = 10"; + } + else if (limesurvey_is_quota_full($case_id)) + { + $sql = "SELECT outcome_id,description + FROM outcome + WHERE outcome_id = 32"; + } + 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,contacted + FROM outcome + WHERE outcome_id != 10 + ORDER BY contacted ASC, outcome_id ASC"; //don't show completed if not + } + else + { + $contacted = bigintval($contacted); + + $sql = "SELECT outcome_id,description + FROM outcome + WHERE contacted = '$contacted' + AND outcome_id != 10"; //don't show completed if not + } + } + } + $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 = ""; + if (isset($r['contacted']) && $r['contacted'] == 1) $highlight = "style='color:blue;'"; else $highlight = ""; + print "
"; + } + } + print "
"; + + +} + + +//display the respondents phone numbers as a drop down list for this call + +global $db; + +$db->StartTrans(); + +$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,false); + $respondent_id = get_respondent_id($call_attempt_id); + $call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true); + if ($call_id) + { + if (is_voip_enabled($operator_id)) + { + include("functions/functions.voip.php"); + $v = new voip(); + $v->connect(VOIP_SERVER); + $v->dial(get_extension($operator_id),get_call_number($call_id)); + } + $btext = "onload='parent.closePopup();'"; + + $js = "js/window_interface2.js"; + if (browser_ie()) $js = "js/window_ie6_interface2.js"; + xhtml_head(T_("Call"),true,array("css/call.css"),array($js),$btext); + } + } + else if (isset($_POST['outcome'])) + { + $outcome_id = bigintval($_POST['outcome']); + end_call($operator_id,$outcome_id); + if (is_voip_enabled($operator_id)) + { + include("functions/functions.voip.php"); + $v = new voip(); + $v->connect(VOIP_SERVER); + $v->hangup(get_extension($operator_id)); + } + //disable recording + $newtext = T_("Start REC"); + + $js = "js/window_interface2.js"; + if (browser_ie()) $js = "js/window_ie6_interface2.js"; + + //If outcome is final, close the case + $sql = "SELECT o.tryanother + FROM `outcome` as o + WHERE o.outcome_id = '$outcome_id'"; + + $rs = $db->GetRow($sql); + + if (!empty($rs) && $rs['tryanother'] == 0) + { + xhtml_head(T_("Call"),true,array("css/call.css"),array($js),"onload='openParent(\"endcase=endcase\");'"); + } + else + { + $call_attempt_id = get_call_attempt($operator_id,false); + $case_id = get_case_id($operator_id); + //see if we have exhausted the available numbers + $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)) //no more numbers to call, end the case + { + xhtml_head(T_("Call"),true,array("css/call.css"),array($js),"onload='openParent(\"endcase=endcase\");'"); + } + else + { + xhtml_head(T_("Call"),true,array("css/call.css"),array($js),"onload='parent.closePopup();'"); + } + } + } + else + { + //if no outcome selected, just hang up the call + if (is_voip_enabled($operator_id)) + { + include("functions/functions.voip.php"); + $v = new voip(); + $v->connect(VOIP_SERVER); + $v->hangup(get_extension($operator_id)); + } + //disable recording + $newtext = T_("Start REC"); + $js = "js/window_interface2.js"; + if (browser_ie()) $js = "js/window_ie6_interface2.js"; + xhtml_head(T_("Call"),true,array("css/call.css"),array($js),"parent.closePopup();'"); + + } + + print "

"; //for XHTML + xhtml_foot(); + $db->CompleteTrans(); + exit(); +} + +$call_attempt_id = get_call_attempt($operator_id,false); +$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); +} + +$js = "js/window_interface2.js"; +if (browser_ie()) $js = "js/window_ie6_interface2.js"; + +xhtml_head(T_("Call"),true,array("css/call.css"),array($js,"include/jquery-ui/js/jquery-1.4.2.min.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 (is_voip_enabled($operator_id)) + { + if (get_extension_status($operator_id)) + $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 (is_voip_enabled($operator_id)) + { + if (get_extension_status($operator_id)) + $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 "




"; + //give focus on load + 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 ''; + 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 + case 2: //ringing + case 3: //answered + 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(); +$db->CompleteTrans(); + +?> diff --git a/config.default.php b/config.default.php index 762e5fb7..7ac71363 100644 --- a/config.default.php +++ b/config.default.php @@ -232,6 +232,11 @@ if (!defined('HEADER_EXPANDER')) define('HEADER_EXPANDER', false); */ if (!defined('HEADER_EXPANDER_MANUAL')) define('HEADER_EXPANDER_MANUAL', false); +/** + * Contract header at start of questionnaire + */ +if (!defined('HEADER_EXPANDER_QUESTIONNAIRE')) define('HEADER_EXPANDER_QUESTIONNAIRE', false); + /** * Define how many minutes between each system sort (defaults to 5 as this is a common interval for appointments) */ @@ -247,6 +252,11 @@ if (!defined('ALLOW_PAGE_REFRESH')) define ('ALLOW_PAGE_REFRESH',true); */ if (!defined('ALLOW_RESPONDENT_SELECTOR')) define ('ALLOW_RESPONDENT_SELECTOR',true); +/** + * Display a faster alternate interface where VoIP is disabled + */ +if (!defined('ALTERNATE_INTERFACE')) define ('ALTERNATE_INTERFACE',false); + /** * Number of log records to display */ diff --git a/contactdetails.php b/contactdetails.php index 92b90355..914d5e82 100644 --- a/contactdetails.php +++ b/contactdetails.php @@ -87,7 +87,7 @@ if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0) ?>
-
+
@@ -95,8 +95,8 @@ if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0) } else { - print "
" . T_("Case id:") . " $case_id
"; - print "
" . T_("Respondent:"); + print "
" . T_("Case id:") . " $case_id
"; + print "
" . T_("Respondent:"); if (isset($_GET['respondent_id']) && $_GET['respondent_id'] != 0) { @@ -142,7 +142,7 @@ else print " " . $rs[0]['firstName'] . " " . $rs[0]['lastName'] . "
"; } - print "
$timezone
"; + print "
$timezone
"; @@ -155,7 +155,7 @@ else $rs = $db->GetAll($sql); - print "
"; + print "
"; if (!empty($rs)) { xhtml_table($rs,array("var","val"),array(T_("Var"),T_("Value"))); diff --git a/css/index_interface2.css b/css/index_interface2.css new file mode 100644 index 00000000..d0e21946 --- /dev/null +++ b/css/index_interface2.css @@ -0,0 +1,81 @@ +.headerexpand { + position: absolute; + height: 20px; + bottom: 0px; + right: 0px; +} +#headerexpandimage { + height: 20px; +}.box { + margin: 18px; +} +.online { + background: #00FF00; +} +.offline { + background: #FF0000; +} +a { + padding: 3px 0.5em; + margin-left: 3px; + border: 1px solid #778; + background: #DDE; + text-decoration: none; + color: black; +} +a:active { + border: 4px inset; +} + +#header { + position : absolute; + width : 20%; + height : 30%; + top : 0; + right : 0; + bottom : auto; + left : 0; + /*border-bottom: 1px solid #aaa;*/ +} +#calllist { + position : absolute; + width : 50%; + height : 30%; + left : 50%; + top : 0; + right : 0; + bottom : auto; +} +#qstatus { + position : absolute; + width : 30%; + height : 30%; + top : 0; + right : 0; + left: 20%; + bottom : auto; + /*border: 1px solid #aaa;*/ +} +#casefunctions { + position : absolute; + width : 20%; + height : 30%; + top : 0; + right : 0; + left: 0; + bottom : auto; +} +#content { + position : absolute; + top : 30%; + left : 0; + bottom : auto; + width : 100%; + height : 70%; +} +.embeddedobject { + width:100%; + height:100%; + position:absolute; +} + diff --git a/css/respondent_interface2.css b/css/respondent_interface2.css new file mode 100644 index 00000000..969dc18c --- /dev/null +++ b/css/respondent_interface2.css @@ -0,0 +1,13 @@ +.labelclass{ + width:20%; +} +.textclass { + width:70%; + height:80%; +} +.submitclass{ + width:20%; +} +.addresp{ + font-style:italic; +} diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 4cb0cdbd..d53312b7 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -1056,10 +1056,11 @@ function get_call($operator_id,$respondent_id = "",$contact_phone_id = "",$creat * * @param int $operator_id The operator id * @param bool $escape Whether to escape the ampersands default true + * @param bool $interface2 Whether we are using the alternate interface * @return string The URL of the LimeSurvey questionnaire, or the URL of an error screen if none available * */ -function get_respondentselection_url($operator_id,$escape = true) +function get_respondentselection_url($operator_id,$escape = true,$interface2 = false) { global $db; @@ -1078,7 +1079,12 @@ function get_respondentselection_url($operator_id,$escape = true) if ($sid != false && !empty($sid) && $sid != 'NULL') $url = LIME_URL . "index.php?loadall=reload" . $amp . "sid=$sid" . $amp . "token=$call_id" . $amp . "lang=" . DEFAULT_LOCALE; else - $url = 'rs_intro.php'; + { + if ($interface2) + $url = 'rs_intro_interface2.php'; + else + $url = 'rs_intro.php'; + } } //if ($db->HasFailedTrans()) { print "FAILED in get_limesurvey_url"; exit; } @@ -1377,6 +1383,94 @@ function copy_row_quota($questionnaire_id,$sample_import_id,$copy_sample_import_ $db->CompleteTrans(); } +/** + * Copy row quotas from one sample to another with blocking + * Set quota_reached to 0 by default + * + * @param int $questionnaire_id + * @param int $sample_import_id + * @param int $copy_sample_import_id The sample_import_id to copy to + */ +function copy_row_quota_with_blocking($questionnaire_id,$sample_import_id,$copy_sample_import_id) +{ + global $db; + + $db->StartTrans(); + + //Set quota_reached to 0 always + + $sql = "INSERT INTO questionnaire_sample_quota_row (questionnaire_id,sample_import_id,lime_sgqa,value,comparison,completions,exclude_var,exclude_val,quota_reached,description) + SELECT questionnaire_id, $copy_sample_import_id, lime_sgqa,value,comparison,completions,exclude_var,exclude_val,quota_reached,description + FROM questionnaire_sample_quota_row + WHERE questionnaire_id = '$questionnaire_id' + AND sample_import_id = '$sample_import_id'"; + + $db->Execute($sql); + + + update_quotas($questionnaire_id); + + $db->CompleteTrans(); +} + +/** + * Copy row quotas from one sample to another and adjust completion number appropriately to completed in the sample. + * + * @param int $questionnaire_id + * @param int $sample_import_id + * @param int $copy_sample_import_id The sample_import_id to copy to + */ +function copy_row_quota_with_adjusting($questionnaire_id,$sample_import_id,$copy_sample_import_id) +{ + global $db; + + // Copy quotas (defalt Quexs function) + copy_row_quota_with_blocking($questionnaire_id,$sample_import_id,$copy_sample_import_id); + + $db->StartTrans(); + + // Select quotas from the old sample rows and calculate + $sql = "SELECT questionnaire_sample_quota_row_id,q.questionnaire_id,sample_import_id,lime_sgqa,value,comparison,completions,quota_reached,q.lime_sid,qsq.exclude_var,qsq.exclude_val + FROM questionnaire_sample_quota_row as qsq, questionnaire as q + WHERE qsq.questionnaire_id = '$questionnaire_id' + AND q.questionnaire_id = '$questionnaire_id' + #AND qsq.quota_reached != '1' + AND qsq.lime_sgqa != -1 + AND sample_import_id='".$sample_import_id."' + "; + + $rs = $db->GetAll($sql); + + if (isset($rs) && !empty($rs)) + { + //include limesurvey functions + include_once(dirname(__FILE__).'/functions.limesurvey.php'); + + //update all row quotas for this questionnaire + foreach($rs as $r) + { + $completions = limesurvey_quota_completions($r['lime_sgqa'],$r['lime_sid'],$r['questionnaire_id'],$r['sample_import_id'],$r['value'],$r['comparison']); + if ($completions > 0) + { + //Update adjusting the completion number + $sql = "UPDATE questionnaire_sample_quota_row + SET completions = IF(completions>".$completions.",(completions-".$completions."),0), quota_reached = IF(quota_reached = 0,IF(completions=0,1,0),1) + WHERE questionnaire_id = '".$questionnaire_id."' + AND sample_import_id='".$copy_sample_import_id."' + AND lime_sgqa='".$r['lime_sgqa']."' + AND value='".$r['value']."' + AND comparison='".$r['comparison']."'"; + + $db->Execute($sql); + } + + } + } + + $db->CompleteTrans(); +} + + /** * Update the row quota table * diff --git a/include/limesurvey/index.php b/include/limesurvey/index.php index c398fac2..e2346d2b 100644 --- a/include/limesurvey/index.php +++ b/include/limesurvey/index.php @@ -2335,9 +2335,9 @@ function buildsurveysession() "; echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); - doFooter(); - exit; - } + doFooter(); + exit; + } } //BEFORE BUILDING A NEW SESSION FOR THIS SURVEY, LET'S CHECK TO MAKE SURE THE SURVEY SHOULD PROCEED! @@ -2452,6 +2452,15 @@ function buildsurveysession() doFooter(); exit; } + + //This should only happen once, so a good place to add the "start of the limesurrvey instrument code" + //queXS Addition + include_once("quexs.php"); + if(HEADER_EXPANDER_QUESTIONNAIRE && HEADER_EXPANDER_MANUAL) + { + global $js_header_includes; + $js_header_includes[] = '/../../js/headerexpandquestionnaire.js'; //queXS addition + } } // TOKENS REQUIRED, A TOKEN PROVIDED // SURVEY CAPTCHA REQUIRED diff --git a/index.php b/index.php index 27b27c88..dd302561 100644 --- a/index.php +++ b/index.php @@ -45,10 +45,16 @@ include ("functions/functions.xhtml.php"); */ include("functions/functions.operator.php"); -$db->StartTrans(); - $operator_id = get_operator_id(); +if (ALTERNATE_INTERFACE && !is_voip_enabled($operator_id)) +{ + include_once("waitnextcase_interface2.php"); + die(); +} + +$db->StartTrans(); + if (isset($_GET['endwork'])) { diff --git a/index_interface2.php b/index_interface2.php new file mode 100644 index 00000000..686b0062 --- /dev/null +++ b/index_interface2.php @@ -0,0 +1,330 @@ + + * @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"); + +$db->StartTrans(); + + +$popupcall = false; +$operator_id = get_operator_id(); + +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) + $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.js"; + $js[] = "js/headerexpandmanual.js"; +} +else if (HEADER_EXPANDER_MANUAL) +{ + $js[] = "js/headerexpand.js"; + $js[] = "js/headerexpandmanual.js"; +} + + + + +xhtml_head(T_("queXS"), $body, array("css/index_interface2.css","css/tabber.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js); +print $script; + +?> + +
+
+
+
+
<? echo T_('/>
+
+ +
+GetRow($sql); + + if (!empty($rs)) + { + $contact_phone_id = $rs['contact_phone_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"); + +?> +
+ +
+ +
+ + +
+ + +
+ + +
"> +

+
+
+ + + +
"> +

+
+
+ + + + +
"> +

+
+
+ + + + +
" id="tab-shifts"> +

+
+
+ + + + +
"> +

+
+
+ + + + +
"> +

+
+
+ + + +
"> +

+
+
+ + + +
"> +

+
+
+ + + + +
"> +

+
+
+ + + +
+ + +
+ +HasFailedTrans()){ print "

FAILED AT END of index

"; exit();} +$db->CompleteTrans(); + +?> diff --git a/js/headerexpandmanual.js b/js/headerexpandmanual.js index 694cea29..a75b12d2 100644 --- a/js/headerexpandmanual.js +++ b/js/headerexpandmanual.js @@ -4,6 +4,12 @@ $(document).ready(function(){ }); +function headerforcecontract() +{ + $("#headerexpandimage").attr('src',"./images/arrow-down-2.png"); + headercontract(); +} + function headertogglemanual() { if ($("#headerexpandimage").attr('src') == './images/arrow-up-2.png') diff --git a/js/headerexpandquestionnaire.js b/js/headerexpandquestionnaire.js new file mode 100644 index 00000000..b86f16cb --- /dev/null +++ b/js/headerexpandquestionnaire.js @@ -0,0 +1,2 @@ +//Contract on load +$(document).ready(parent.headerforcecontract); diff --git a/js/popupcallonload.js b/js/popupcallonload.js new file mode 100644 index 00000000..89c1dd46 --- /dev/null +++ b/js/popupcallonload.js @@ -0,0 +1,4 @@ +//Contract on load +$(document).ready(function(){ + poptastic('call_interface2.php'); + }); diff --git a/js/window_ie6_interface2.js b/js/window_ie6_interface2.js new file mode 100644 index 00000000..d4d61d78 --- /dev/null +++ b/js/window_ie6_interface2.js @@ -0,0 +1,37 @@ +function LinkUp(element) +{ + var number = document.getElementById(element).selectedIndex; + location.href = document.getElementById(element).options[number].value; +} + +function openParent(get) +{ + parent.location.href = 'index_interface2.php?' + get; +} + + +function openParentNote(get) +{ + parent.location.href = 'index_interface2.php?note=' + document.getElementById('note').value + '&' + get; +} + +function openParentObject(oid,get) +{ + var a = parent.document.getElementById(oid); + if (a) + { + a.src = get; + } + +} + +function toggleRec(text,link,classes) +{ + var a = parent.document.getElementById('reclink'); + if (a) + { + a.innerHTML = text; + a.href = "javascript:poptastic('" + link + "');"; + a.className = classes; + } +} diff --git a/js/window_interface2.js b/js/window_interface2.js new file mode 100644 index 00000000..ba30e175 --- /dev/null +++ b/js/window_interface2.js @@ -0,0 +1,41 @@ +function LinkUp(element) +{ + var number = document.getElementById(element).selectedIndex; + location.href = document.getElementById(element).options[number].value; +} + +function openParent(get) +{ + parent.location.href = 'index_interface2.php?' + get; +} + + +function openParentNote(get) +{ + parent.location.href = 'index_interface2.php?note=' + document.getElementById('note').value + '&' + get; +} + +function openParentObject(oid,get) +{ + var a = parent.document.getElementById(oid); + if (a) + { + var clone = a.cloneNode(true); + var pnode = a.parentNode; + clone.data = get; + pnode.removeChild(a); + pnode.appendChild(clone); + } + +} + +function toggleRec(text,link,classes) +{ + var a = parent.document.getElementById('reclink'); + if (a) + { + a.innerHTML = text; + a.href = "javascript:poptastic('" + link + "');"; + a.className = classes; + } +} diff --git a/rs_answeringmachine_interface2.php b/rs_answeringmachine_interface2.php new file mode 100644 index 00000000..c38075ad --- /dev/null +++ b/rs_answeringmachine_interface2.php @@ -0,0 +1,96 @@ + + * @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); + +$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); + +if (AUTO_LOGOUT_MINUTES !== false) +{ + $js[] = "js/childnap.js"; +} + +xhtml_head(T_("Respondent Selection - Answering machine"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"),$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_interface2.php b/rs_business_interface2.php new file mode 100644 index 00000000..47f929c6 --- /dev/null +++ b/rs_business_interface2.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 + * + */ + +/** + * Configuration file + */ +include ("config.inc.php"); + +/** + * XHTML + */ +include ("functions/functions.xhtml.php"); + +/** + * Language + */ +include ("lang.inc.php"); + +$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); + +if (AUTO_LOGOUT_MINUTES !== false) +{ + $js[] = "js/childnap.js"; +} + + +xhtml_head(T_("Respondent Selection - Business answers"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); + + +?> +

+ +

+

+ diff --git a/rs_callback_interface2.php b/rs_callback_interface2.php new file mode 100644 index 00000000..da45c986 --- /dev/null +++ b/rs_callback_interface2.php @@ -0,0 +1,95 @@ + + * @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"); + +$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); + +if (AUTO_LOGOUT_MINUTES !== false) +{ + $js[] = "js/childnap.js"; +} + + + +xhtml_head(T_("Respondent Selection - Call back"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $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_interface2.php b/rs_intro_interface2.php new file mode 100644 index 00000000..230957b2 --- /dev/null +++ b/rs_intro_interface2.php @@ -0,0 +1,131 @@ + + * @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"); + +$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); + +if (AUTO_LOGOUT_MINUTES !== false) +{ + $js[] = "js/childnap.js"; +} + + +xhtml_head(T_("Respondent Selection - Introduction"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $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,rs_project_intro,rs_callback + 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) +{ + if(empty($r['rs_project_intro'])) + { + //If nothing is specified as a project introduction, skip straight to questionnaire + ?> +

+ +

+ +

+ +

+ +

+

+

+

+

+

+

+

+

+ diff --git a/rs_project_end.php b/rs_project_end.php index 78f45f71..89dc0d03 100644 --- a/rs_project_end.php +++ b/rs_project_end.php @@ -34,6 +34,7 @@ */ include ("config.inc.php"); + /** * Database file */ @@ -49,6 +50,14 @@ include ("functions/functions.xhtml.php"); */ include ("functions/functions.operator.php"); +$operator_id = get_operator_id(); + +//check for alternate interface +if (ALTERNATE_INTERFACE && !is_voip_enabled($operator_id)) +{ + include_once("rs_project_end_interface2.php"); + die(); +} $js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); @@ -61,7 +70,6 @@ if (AUTO_LOGOUT_MINUTES !== false) xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $js); -$operator_id = get_operator_id(); $case_id = get_case_id($operator_id); $questionnaire_id = get_questionnaire_id($operator_id); diff --git a/rs_project_end_interface2.php b/rs_project_end_interface2.php new file mode 100644 index 00000000..a4a96961 --- /dev/null +++ b/rs_project_end_interface2.php @@ -0,0 +1,90 @@ + + * @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_once ("config.inc.php"); + +/** + * Database file + */ +include_once ("db.inc.php"); + +/** + * XHTML functions + */ +include_once ("functions/functions.xhtml.php"); + +/** + * Operator functions + */ +include_once ("functions/functions.operator.php"); + + +$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); + +if (AUTO_LOGOUT_MINUTES !== false) +{ + $js[] = "js/childnap.js"; +} + + + +xhtml_head(T_("Respondent Selection - Project end"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $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) . "

"; + +if (!is_voip_enabled($operator_id) && AUTO_COMPLETE_OUTCOME) +{ + end_call($operator_id,10); + print "

" . T_("Call automatically ended with outcome: Complete - End case") . "

"; +} +else +{ + ?> +

+ diff --git a/rs_project_intro_interface2.php b/rs_project_intro_interface2.php new file mode 100644 index 00000000..bf6b8e57 --- /dev/null +++ b/rs_project_intro_interface2.php @@ -0,0 +1,92 @@ + + * @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"); + +$js = array("js/popup.js","include/jquery-ui/js/jquery-1.4.2.min.js","include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js"); + +if (AUTO_LOGOUT_MINUTES !== false) +{ + $js[] = "js/childnap.js"; +} + +xhtml_head(T_("Respondent Selection - Project Introduction"),true,array("css/rs.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"), $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/rs_quota_end.php b/rs_quota_end.php index f39af001..a3ed9999 100644 --- a/rs_quota_end.php +++ b/rs_quota_end.php @@ -66,9 +66,18 @@ $questionnaire_id = get_questionnaire_id($operator_id); print "

" . template_replace($_GET['message'],$operator_id,$case_id) . "

"; +if (ALTERNATE_INTERFACE && !is_voip_enabled($operator_id)) +{ +?> +

+

+ * @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); + +$js = array("js/popup.js"); + +if (browser_ie()) + $js[] = "js/window_ie6.js"; +else + $js[] = "js/window.js"; + +if (AUTO_LOGOUT_MINUTES !== false) +{ + $js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; + $js[] = "js/childnap.js"; +} + +xhtml_head(T_("Status"),true,array("css/status.css"),$js); + +$ca = get_call_attempt($operator_id,false); +if ($ca) +{ + $respondent_id = get_respondent_id($ca); + $case_id = get_case_id($operator_id); + $fname = get_respondent_variable("firstName",$respondent_id); + $lname = get_respondent_variable("lastName",$respondent_id); + print "

" . T_("Name") . ": $fname $lname

"; + + $appointment = is_on_appointment($ca); + + $call_id = get_call($operator_id); + + $sql = "SELECT o.tryanother, o.require_note + FROM `call` as c, `outcome` as o + WHERE c.call_attempt_id = '$ca' + AND c.outcome_id = o.outcome_id + ORDER BY call_id DESC + LIMIT 1"; + + $rst = $db->GetRow($sql); + + if ((empty($rst) || $rst['tryanother'] == 1)) //dial another number only when available and not ending + { + + if (isset($_POST['contactphone'])) + { + $pcontact_phone_id = intval($_POST['contactphone']); + + //If an outcome already assigned, end the current call and start the enxt one to pcontact_phone_id + //Otherwise bring up the assign outcome window + if (!$call_id) //outcome assigned + { + $call_id = get_call($operator_id,$respondent_id,$pcontact_phone_id,true); + echo ""; + } + else + { + //bring up assign outcome window + print ""; + } + } + + if (!$call_id) + { + if ($appointment) + { + //create a call on the appointment number + $sql = "SELECT cp.* + FROM contact_phone as cp, appointment as a + WHERE cp.case_id = '$case_id' + AND a.appointment_id = '$appointment' + AND a.contact_phone_id = cp.contact_phone_id"; + + } + else + { + //create a call on the first available number by priority + $sql = "SELECT * + FROM contact_phone + WHERE case_id = '$case_id' + ORDER BY priority ASC + LIMIT 1"; + + } + + $rs = $db->GetRow($sql); + $contact_phone_id = $rs['contact_phone_id']; + + $call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true); + } + + if ($appointment) + { + $sql = "SELECT DATE_FORMAT(CONVERT_TZ(a.start,'System', o.Time_zone_name),'%Y-%b-%d %H:%i') as time + FROM appointment as a, operator as o + WHERE o.operator_id = '$operator_id' + AND a.appointment_id = '$appointment'"; + + $rs = $db->GetRow($sql); + + $apdate = $rs['time']; + + + print "
" . T_("Appointment") . ": " . $apdate . "
"; + //if (missed_appointment($ca)) print "
" . T_("MISSED") . "
"; + } + + + $sql = "SELECT c.*, CASE WHEN c.contact_phone_id = ccc.contact_phone_id THEN 'checked=\"checked\"' ELSE '' END as checked + FROM contact_phone as c + LEFT JOIN `call` as ccc ON (ccc.call_id = '$call_id') + 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 = '$ca' + AND outcome_id != 18 + AND outcome_id != 0 + ) 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"; + + + $rs = $db->GetAll($sql); + + + //Display all available numbers for this case as a list of radio buttons + //By default, the selected radio button should have a "call" started for it + //When then next one clicked, it should bring up call screen if no outcome otherwise start new call + print "
"; + foreach($rs as $r) + { + print "
"; + print ""; + print ""; + print "
"; + } + print "
"; + } + else + print "
" . T_("No more numbers to call") . "
"; +} +else + print "
" . T_("No case") . "
"; + +xhtml_foot(); + +?> diff --git a/waitnextcase_interface2.php b/waitnextcase_interface2.php new file mode 100644 index 00000000..7dc16ffc --- /dev/null +++ b/waitnextcase_interface2.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_once("config.inc.php"); + +/** + * XHTML functions + */ +include_once("functions/functions.xhtml.php"); + +/** + * Operator functions + */ +include_once("functions/functions.operator.php"); + + +xhtml_head(T_("queXS"), false, array("css/index_interface2.css","css/tabber.css"),array("js/tabber.js")); + +?> + +
+
+
+
+ +
+
+ +
+
+ +
+
+ + +
+
+
+

+
+
+ + +
+
+ + +