示例#1
0
         print "<script type='text/javascript'>parent.poptastic('call_interface2.php');</script>";
     }
 }
 if (!$call_id) {
     $sql = "SELECT c. *\r\n                                FROM contact_phone AS c\r\n                                LEFT JOIN (\r\n                                                SELECT contact_phone.contact_phone_id\r\n                                                FROM contact_phone\r\n                                                LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )\r\n                                                LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )\r\n                                                WHERE contact_phone.case_id = '{$case_id}'\r\n                                                AND outcome.tryagain =0\r\n                                          ) AS l ON l.contact_phone_id = c.contact_phone_id\r\n                                LEFT JOIN\r\n                                (\r\n                                 SELECT contact_phone_id\r\n                                 FROM `call`\r\n                                 WHERE call_attempt_id = '{$ca}'\r\n                                 AND outcome_id != 18\r\n                                ) as ca on ca.contact_phone_id = c.contact_phone_id\r\n                                WHERE c.case_id = '{$case_id}'\r\n                                AND l.contact_phone_id IS NULL\r\n                                AND ca.contact_phone_id IS NULL\r\n\t\t\t\torder by c.priority ASC";
     $numsa = $db->GetRow($sql);
     if (!empty($numsa)) {
         if ($appointment) {
             //create a call on the appointment number
             $sql = "SELECT cp.*\r\n\t\t\t\t\t\tFROM contact_phone as cp, appointment as a\r\n\t\t\t\t\t\tWHERE cp.case_id = '{$case_id}'\r\n\t\t\t\t\t\tAND a.appointment_id = '{$appointment}'\r\n\t\t\t\t\t\tAND a.contact_phone_id = cp.contact_phone_id";
             $rs = $db->GetRow($sql);
             $contact_phone_id = $rs['contact_phone_id'];
         } else {
             $contact_phone_id = $numsa['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\r\n\t\t\t\tFROM appointment as a, operator as o\r\n\t\t\t\tWHERE o.operator_id = '{$operator_id}'\r\n\t\t\t\tAND a.appointment_id = '{$appointment}'";
     $rs = $db->GetRow($sql);
     $apdate = $rs['time'];
     if (missed_appointment($ca)) {
         print "<div class='alert alert-warning'>" . T_("MISSED") . ": " . $apdate . "</div>";
     } else {
         print "<div class='alert alert-info'>" . T_("Appointment") . ": " . $apdate . "</div>";
     }
 }
 if ($call_id) {
     $sql = "SELECT c.*, CASE WHEN c.contact_phone_id = ccc.contact_phone_id THEN 'checked=\"checked\"' ELSE '' END as checked\r\n\t\t\t\tFROM contact_phone as c\r\n\t\t\t\tLEFT JOIN `call` as ccc ON (ccc.call_id = '{$call_id}')\r\n\t\t\t\tLEFT JOIN (\r\n\t\t\t\t\tSELECT contact_phone.contact_phone_id\r\n\t\t\t\t\tFROM contact_phone\r\n\t\t\t\t\tLEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )\r\n\t\t\t\t\tLEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )\r\n\t\t\t\t\tWHERE contact_phone.case_id = '{$case_id}'\r\n\t\t\t\t\tAND outcome.tryagain =0\r\n\t\t\t\t) AS l ON l.contact_phone_id = c.contact_phone_id\r\n\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t(\r\n\t\t\t\t\tSELECT contact_phone_id\r\n\t\t\t\t\tFROM `call`\r\n\t\t\t\t\tWHERE call_attempt_id = '{$ca}'\r\n\t\t\t\t\tAND outcome_id != 18\r\n\t\t\t\t\tAND outcome_id != 0\r\n\t\t\t\t\t) as ca on ca.contact_phone_id = c.contact_phone_id\r\n\t\t\t\tWHERE c.case_id = '{$case_id}'\r\n\t\t\t\tAND l.contact_phone_id IS NULL\r\n\t\t\t\tAND ca.contact_phone_id IS NULL";
     $rs = $db->GetAll($sql);
示例#2
0
文件: quexs.php 项目: ddrmoscow/queXS
/**
 * Get the URL of the respondent selection module
 * 
 * @return string The URL of the respondent selection script
 * @author Adam Zammit <*****@*****.**>
 * @since  2010-10-12
 */
function get_respondent_selection_url()
{
    $db = newADOConnection(DB_TYPE);
    $db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
    $db->SetFetchMode(ADODB_FETCH_ASSOC);
    $url = QUEXS_URL . "nocallavailable.php";
    $operator_id = get_operator_id();
    $call_id = get_call($operator_id);
    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 {
            $url = 'rs_intro.php';
        }
    }
    return $url;
}
示例#3
0
/** 
 * Authentication
 */
require "auth-interviewer.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 (is_voip_enabled($operator_id)) {
            $call_id = get_call($operator_id);
            if ($call_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 "<p>" . T_("Beginning recording...") . "</p>";
            } else {
                print "<p>" . T_("Not on a call, so not beginning a recording") . "</p>";
            }
        } else {
            print "<p>" . T_("Begin the manual recording now...") . "</p>";
        }
    } else {
        if (isset($_GET['stop'])) {
            $newtext = T_("Start REC");
示例#4
0
/**
 * End the current call
 * Store the time and outcome in the database
 *
 * @param int $operator_id The operator
 * @param int $outcome_id The outcome to the call
 * @param int $state The end state of the call 5 default
 * @return bool True if database execution succeeded
 *
 * @todo Implement session destruction here
 *
 */
function end_call($operator_id, $outcome_id, $state = 5)
{
    global $db;
    $db->StartTrans();
    $o = false;
    $ca = get_call($operator_id);
    if ($ca) {
        $c = get_call_attempt($operator_id, false);
        if ($c) {
            $a = is_on_appointment($c);
            //if we were on an appointment, complete it with this call
            if ($a) {
                $sql = "UPDATE appointment\r\n\t\t\t\t\tSET completed_call_id = '{$ca}'\r\n\t\t\t\t\tWHERE appointment_id = '{$a}'";
                $db->Execute($sql);
            }
        }
        $sql = "UPDATE `call`\r\n\t\t\tSET end = CONVERT_TZ(NOW(),'System','UTC'), outcome_id = '{$outcome_id}', state = '{$state}'\r\n\t\t\tWHERE call_id = '{$ca}'";
        $db->Execute($sql);
    }
    //if ($db->HasFailedTrans()) { print "FAILED in end_call"; exit; }
    if ($db->CompleteTrans()) {
        return $o;
    }
    return false;
}