$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();} $db->CompleteTrans();
xhtml_head(T_("Respondent Selection") . " - " . T_("Call back"), true, array("include/bootstrap/css/bootstrap.min.css", "css/rs.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\r\n\tFROM questionnaire\r\n\tWHERE questionnaire_id = '{$questionnaire_id}'"; $r = $db->GetRow($sql); if (!empty($r['rs_callback'])) { print "<div class='rstext well rs'>" . template_replace($r['rs_callback'], $operator_id, $case_id) . "</div>"; } print "<p class='rstext alert alert-info'>" . T_("Survey is") . " " . round(limesurvey_percent_complete($case_id), 1) . " % " . T_("complete") . "</p>"; print "<div class=' '>\r\n\t\t<div class='col-lg-2'><p><a class='btn btn-default' href=\"rs_intro.php\" >" . T_("Go Back") . "</a></p></div>"; //filter displayed outcomes if ($questionnaire_id) { $outcomes = $db->GetOne("SELECT q.outcomes FROM `questionnaire` as q WHERE q.questionnaire_id = {$questionnaire_id}"); // $outcomes = explode(",", $outcomes); if (in_array(8, $outcomes)) { $des = $db->GetAll("SELECT description FROM outcome WHERE outcome_id = 8"); print "<div class='col-lg-4'><p class=''><h4 class=' '>" . T_("End call with outcome:") . "</h4></p>\r\n\t\t\t\t\t<p><a class='btn btn-primary' "; if (ALTERNATE_INTERFACE) { print "href=\"javascript:parent.location.href = 'index_interface2.php?outcome=8&endcase=endcase'\">"; } else { print "href=\"javascript:parent.poptastic('call.php?defaultoutcome=8');\">"; } print T_($des[0]['description']) . "</a></p></div>"; } } print "<div class='col-lg-6'>\r\n\t\t\t<p><a href=\"" . get_limesurvey_url($operator_id) . "\" class='btn btn-primary' >" . T_("Yes - Continue where we left off") . "</a></p></div>"; print "</div>"; xhtml_foot();
print "</div>"; print "<div class=\"col-sm-7 \"><h3 class='text-primary'>" . T_("Respondent Selection") . " - " . T_("Introduction") . "</h3>"; //display introduction text $sql = "SELECT rs_intro,rs_project_intro,rs_callback\r\n\t\t\tFROM questionnaire\r\n\t\t\tWHERE questionnaire_id = '{$questionnaire_id}'"; $r = $db->GetRow($sql); if (!empty($r['rs_intro'])) { print "<div class='rstext well rs'>" . template_replace($r['rs_intro'], $operator_id, $case_id) . "</div>"; } print "</div>"; // display continue print "<div class=\"col-sm-7 text-right\" style=\"margin-top: 50px;\">"; print "<p><a class=\"btn btn-lg btn-primary\" href=\""; 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 print get_limesurvey_url($operator_id); } else { print "rs_project_intro.php"; } } else { if (empty($r['rs_callback'])) { //If nothing is specified as a callback screen, skip straight to questionnaire print get_limesurvey_url($operator_id); } else { print "rs_callback.php"; } } print "\">" . T_("Yes - Continue") . "</a></p>"; print "</div>"; } xhtml_foot();
print "<p><a class='btn btn-primary' "; if (ALTERNATE_INTERFACE) { print "href=\"javascript:parent.location.href = 'index_interface2.php?outcome=8&endcase=endcase'\">"; } else { print "href=\"javascript:parent.poptastic('call.php?defaultoutcome=29');\">"; } print $des[0]['description'] . "</a></p>"; } if (in_array(17, $outcomes)) { print "<p><a class='btn btn-primary' "; if (ALTERNATE_INTERFACE) { print "href=\"javascript:parent.location.href = 'index_interface2.php?outcome=17&endcase=endcase'\">"; } else { print "href=\"javascript:parent.poptastic('call.php?defaultoutcome=23');\">"; } print $des[1]['description'] . "</a></p>"; } if (in_array(30, $outcomes)) { print "<p><a class='btn btn-primary' "; if (ALTERNATE_INTERFACE) { print "href=\"javascript:parent.location.href = 'index_interface2.php?outcome=30&endcase=endcase'\">"; } else { print "href=\"javascript:parent.poptastic('call.php?defaultoutcome=24');\">"; } print $des[2]['description'] . "</a></p>"; } print "</div>"; } print "<div class='col-lg-4'><p><a class=\"btn btn-lg btn-primary\" href=\"" . get_limesurvey_url($operator_id) . "\">" . T_("Yes - Continue") . "</a></p></div>"; print "</div>"; xhtml_foot();
/** * 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; }