|
|
|
|
<?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<EFBFBD>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);
|
|
|
|
|
*/
|