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.
45 lines
1.6 KiB
45 lines
1.6 KiB
<?php |
|
|
|
$cmpId = isset($_GET["cmp_id"]) ? $_GET["cmp_id"] : '0'; |
|
$msg = 'Consulta realizada com sucesso!'; |
|
$msgErro = ''; |
|
$tpLayout = 1; |
|
$patLog = "/var/log/asterisk/complemento_ampanha.log"; |
|
|
|
try { |
|
|
|
$query = sprintf("select cmp_dados from pbx_campanha_complemento where cmp_id = %s", QuotedStr($cmpId)); |
|
if (!$result = pg_query($query)) { |
|
$msgErro = sprintf("Cmd: %s\n MsgSys: %s\n", $query, pg_last_error()); |
|
GeraExcept("Ocorreu um erro ao consultar os dados!"); |
|
} |
|
|
|
if (!pg_num_rows($result)) { |
|
$msgErro = sprintf("Cmd: %s\n", $query); |
|
GeraExcept("Não foram encontrados detalhes para o registro informado!"); |
|
} |
|
|
|
$linhas = ''; |
|
$dados = pg_fetch_assoc($result); |
|
$dados = json_decode($dados['cmp_dados'], true); |
|
foreach ($dados as $key => $value) { |
|
$linhas .= sprintf("<p style=\"font-size: 12px; color: #000; margin: 5px;\"><strong>%s: </strong>%s</p>\n", $key, $value); |
|
} |
|
} catch (Exception $ex) { |
|
$msg = $ex->getMessage(); |
|
$log = sprintf("Data: %s User: %s MsgUser: %s \n %s", date("Y:m:d H:i:s"), GetLogin(), $msg, $msgErro); |
|
WriteLog($log, $patLog); |
|
} |
|
|
|
$smarty->assign("linhas", $linhas); |
|
$smarty->assign("msg", $msg); |
|
$smarty->display('callcenter/agente/ComplementoCampanha.tpl'); |
|
|
|
/* |
|
$linhas .= sprintf('<tr> |
|
<th align="left">%s</th> |
|
</tr> |
|
<tr> |
|
<td style="margin-top: 3px; padding: 2px;">%s</td> |
|
</tr>', $key, $value); |
|
*/ |