Пример #1
0
function callOut_HTML($sDirLocalPlantillas)
{
    $smarty = new Smarty();
    $response = array();
    global $arrConf;
    $oMainConsole = new getInfoMainConsole();
    $oMainConsole->callcenter_db_connect($arrConf['cadena_dsn']);
    $sThemeDir = "modules/agent_console/themes/default";
    $sAgent = $_SESSION['callcenter']['extension'];
    $number = getParameter('number');
    //var_dump($number);
    $agentid = $oMainConsole->getAgentId($sAgent);
    if (trim($number) !== '') {
        $mobileHistory = $oMainConsole->getCallMobileHistoryArray($number, 10);
        $callHistory = $oMainConsole->getCallHistoryArray(50, $sAgent);
        $externalNote = $oMainConsole->getExternalNote($number);
        $customerInfo = $oMainConsole->getCustomerInfo($number);
        if (is_null($customerInfo)) {
            $customerInfo['lastname'] = '(không biết)';
            $customerInfo['firstname'] = '';
        }
        $callid = $infoLlamada['call_id'];
        $delivery = $oMainConsole->getDelivery($number, false);
        $response['event'] = "agentlinked";
        $response['txt_estado_agente_inicial'] = "Kết nối cuộc gọi ra ngoài";
        $response['class_estado_agente_inicial'] = "elastix-callcenter-class-estado-activo";
    } else {
        $mobileHistory = null;
        $callHistory = $oMainConsole->getCallHistoryArray(50, $sAgent);
        $customerInfo = null;
        $externalNote = null;
        $callid = null;
        $delivery = null;
        $response['event'] = "agentunlinked";
        $response['txt_estado_agente_inicial'] = "Không có cuộc gọi";
        $response['class_estado_agente_inicial'] = "elastix-callcenter-class-estado-ocioso";
    }
    //close mysql
    $oMainConsole->callcenter_db_disconnect();
    // phpuploader
    $uploader = new PhpUploader();
    $uploader->MultipleFilesUpload = true;
    $uploader->InsertText = "Chọn vé đính kèm (Dung lượng < 10M)";
    $uploader->MaxSizeKB = 10240;
    $uploader->Name = "myuploader";
    $uploader->AllowedFileExtensions = "*.jpg,*.png,*.gif,*.bmp,*.pdf,*.xls,*.doc,*.xlsx,*.docx";
    //$uploader->UploadUrl="/modules/agent_console/upload.php";
    $html_uploader = $uploader->Render();
    // end of phpuploader
    $smarty->assign(array('MOBILE_HISTORY' => $mobileHistory, 'CALL_HISTORY' => $callHistory, 'CUSTOMER_NUMBER' => $number, 'THEME_PATH' => $sThemeDir, 'AGENTLINKED' => '0', 'CUSTOMER_INFO' => $customerInfo, 'CALL_ID' => $callid, 'AGENT_ID' => $agentid, 'CALL_DELIVERY' => $delivery, 'UPLOADER' => $html_uploader, 'OUTGOING' => 'yes', 'EXTERNAL_NOTE' => $externalNote));
    $html = $smarty->fetch("{$sDirLocalPlantillas}/hnh_agent_console.tpl");
    //process json data and return
    $response['callid'] = null;
    $response['calltype'] = "outgoing";
    $response['campaign_id'] = 3;
    $response['cronometro'] = "00:00:00";
    $response['llamada_informacion'] = $html;
    $response['timer_seconds'] = null;
    $response['txt_contacto_telefono'] = $number;
    $response['url'] = null;
    $response['urlopentype'] = null;
    $object[] = $response;
    $json = new Services_JSON();
    Header('Content-Type: application/json');
    return $json->encode($object);
}