encrypt($jsoninfo); $jsStartup[] = sprintf('window.open("%s", "popupWindow", "width=1450, height=950, resizable=NO,scrollbars=YES");', $url); } else { $jsStartup[] = "alert('Não foi possível conenctar ao Simples Chat! Verifique as informações antes de conectar.');"; } } $smarty->assign("options", getQueue($chatApi)); $smarty->assign("jsonApp", json_encode( [ 'matricula' => GetMatricula(), 'server_api' => $_SESSION['prm_chat_api'], 'server_ws' => $_SESSION['prm_sk_host_chat'], 'supervisor' => IsSupervisor($dbcon) ] )); GetTemplate($smarty, 'simpleschat/connect.tpl'); function getQueue($chatApi) { $response = json_decode(request("{$chatApi}/integracao/media/api/agente/listarFilas")); $option = null; foreach ($response->data as $v) { $option .= ""; } return $option; } function loginQueue($chatApi, $dac) { $json = ['id_fila' => $dac, "matricula" => GetMatricula()]; $response = json_decode(request("{$chatApi}/integracao/media/api/agente/entrar", $json)); if ($response->status == 'success' || strpos($response->message, 'autenticado') !== false) { return true; } return false; } function request($url, $post = []) { $curl = "curl -s -k "; if ($post) { $curl .= sprintf(" -X POST -d '%s' ", json_encode($post)); } $curl .= $url; $response = shell_exec($curl); return $response; }