forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
3.0 KiB
78 lines
3.0 KiB
<?php |
|
|
|
$tpl = "supervisorChatAgente.tpl"; |
|
$matricula = $_GET["matricula"]; |
|
$action = $_GET["action"]; |
|
$tpLayout = 1; |
|
$url = $_SESSION['prm_chat_api'] . "/integracao/media/api/agente/"; |
|
|
|
$jsStartup[] = sprintf("localStorage.setItem('chatserverapi', '%s')", $_SESSION['prm_chat_api']); |
|
|
|
try { |
|
$agentes = request($url . 'statusAgente', ['matricula' => $matricula]); |
|
$agente = json_decode($agentes, true); |
|
|
|
if ($agente['data']) { |
|
$pausa = $agente['data']['motivo_pausa'] ? strtoupper($agente['data']['motivo_pausa']) : '-'; |
|
|
|
$smarty->assign('nomeDac', $agente['data']['fila']); |
|
$smarty->assign('nome', $agente['data']['nome']); |
|
$smarty->assign('matricula', $agente['data']['matricula']); |
|
$smarty->assign("status", $agente['data']['status']); |
|
$smarty->assign("countatendimentos", $agente['data']['numero_atendimento']); |
|
$smarty->assign("pausa", strtoupper($agente['data']['motivo_pausa'])); |
|
} |
|
} catch (Exception $ex) { |
|
|
|
} |
|
|
|
GetTemplate($smarty, $tpl); |
|
|
|
function getHorario($duracao) { |
|
$segundos = strtotime($duracao); |
|
$time = time(); |
|
$horario = SecondToStrTime($time - $segundos); |
|
$horario = date('H:i:s', strtotime($horario)); |
|
return $horario; |
|
} |
|
|
|
function SecondsToStrTime($seconds) { |
|
$conv_time = convertSecondsToArrayTime($seconds); |
|
$conv_time['minutes'] = strlen($conv_time['minutes']) == 1 ? '0' . $conv_time['minutes'] : $conv_time['minutes']; |
|
$conv_time['seconds'] = strlen($conv_time['seconds']) == 1 ? '0' . $conv_time['seconds'] : $conv_time['seconds']; |
|
return $conv_time['hours'] . ':' . $conv_time['minutes'] . ':' . $conv_time['seconds']; |
|
} |
|
|
|
function convertSecondsToArrayTime($seconds) { |
|
$conv_time = array(); |
|
$conv_time['days'] = floor($seconds / 86400); |
|
$conv_time['hours'] = floor(($seconds - ($conv_time['days'] * 86400)) / 3600); |
|
$conv_time['minutes'] = floor(($seconds - (($conv_time['days'] * 86400) + ($conv_time['hours'] * 3600))) / 60); |
|
$conv_time['seconds'] = floor(($seconds - (($conv_time['days'] * 86400) + ($conv_time['hours'] * 3600) + ($conv_time['minutes'] * 60)))); |
|
return $conv_time; |
|
} |
|
|
|
|
|
function request($url, $post = []) { |
|
|
|
$ch = curl_init(); |
|
$isPost = $post ? 1 : 0; |
|
|
|
curl_setopt($ch, CURLOPT_URL, $url); |
|
curl_setopt($ch, CURLOPT_POST, $isPost); |
|
|
|
if ($isPost) { |
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post)); |
|
} |
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
|
|
|
$head = curl_exec($ch); |
|
|
|
curl_close($ch); |
|
return $head; |
|
} |
|
|
|
?>
|
|
|