<?php $ca = get_call_attempt($operator_id, true); $appointment = false; $availability = is_using_availability($case_id); $chatenabled = get_setting("chat_enabled"); if (empty($chatenabled)) { $chatenabled = false; } else { $chatenabled = true; } if ($ca) { if (is_on_appointment($ca)) { $appointment = true; } } if (!is_respondent_selection($operator_id) && AUTO_DIAL_SECONDS == false) { $data = get_limesurvey_url($operator_id); } else { $data = get_respondentselection_url($operator_id); } $db->CompleteTrans(); xhtml_object($data, "main-content"); ?> </div> <div id="respondent" class="header"> <?php xhtml_object("respondent.php", "main-respondent"); ?> </div>
//create a call on the first available number by priority $sql = "SELECT c. *\r\n\t\t\t\t\t\tFROM contact_phone AS c\r\n\t\t\t\t\t\tLEFT JOIN (\r\n\t\t\t\t\t\t\t\tSELECT contact_phone.contact_phone_id\r\n\t\t\t\t\t\t\t\tFROM contact_phone\r\n\t\t\t\t\t\t\t\tLEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )\r\n\t\t\t\t\t\t\t\tLEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )\r\n\t\t\t\t\t\t\t\tWHERE contact_phone.case_id = '{$case_id}'\r\n\t\t\t\t\t\t\t\tAND outcome.tryagain =0\r\n\t\t\t\t\t\t\t ) AS l ON l.contact_phone_id = c.contact_phone_id\r\n\t\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t SELECT contact_phone_id\r\n\t\t\t\t\t\t FROM `call`\r\n\t\t\t\t\t\t WHERE call_attempt_id = '{$ca}'\r\n\t\t\t\t\t\t AND outcome_id NOT IN (15,18)\r\n\t\t\t\t\t\t) as ca on ca.contact_phone_id = c.contact_phone_id\r\n\t\t\t\t\t\tWHERE c.case_id = '{$case_id}'\r\n\t\t\t\t\t\tAND l.contact_phone_id IS NULL\r\n\t\t\t\t\t\tAND ca.contact_phone_id IS NULL\r\n\t\t\t\t\t\torder by c.priority ASC"; } $rs = $db->GetRow($sql); if (!empty($rs)) { $contact_phone_id = $rs['contact_phone_id']; if (!isset($rs['respondent_id'])) { $sql = "SELECT respondent_id\r\n\t\t\t\t\t\t\tFROM respondent\r\n\t\t\t\t\t\t\tWHERE 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", "embeddedobject content"); ?> </div> </div> <?php xhtml_foot(); //if ($db->HasFailedTrans()){ print "<p>FAILED AT END of index</p>"; exit();}
/** * Get the complete URL for the Limesurvey questionnaire of respondent selection * If no call available, return an error screen * * @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, $interface2 = false) { global $db; $db->StartTrans(); $url = "nocallavailable.php"; $call_id = get_call($operator_id); $amp = "&"; if (!$escape) { $amp = "&"; } if ($call_id) { $sid = get_limesurvey_id($operator_id, true); //true for RS if ($sid != false && !empty($sid) && $sid != 'NULL') { $url = LIME_URL . "index.php?interviewer=interviewer" . $amp . "loadall=reload" . $amp . "sid={$sid}" . $amp . "token={$call_id}" . $amp . "lang=" . DEFAULT_LOCALE; } else { if (is_respondent_selection($operator_id) === false) { $url = get_limesurvey_url($operator_id); if (!$escape) { $url = str_replace("&", "&", $url); } } else { $url = 'rs_intro.php'; } } } //if ($db->HasFailedTrans()) { print "FAILED in get_limesurvey_url"; exit; } $db->CompleteTrans(); return $url; }