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.
66 lines
1.7 KiB
66 lines
1.7 KiB
<?php |
|
|
|
$tpLayout = 1; |
|
$idFull = isset($_GET['idFull']) ? $_GET['idFull'] : 0; |
|
|
|
try { |
|
if ($idFull) { |
|
$query = GetQuery($idFull); |
|
$result = pg_query($query); |
|
$dados = pg_fetch_assoc($result); |
|
|
|
$json = json_decode($dados['dados'], true); |
|
$arrayRes = GetMontageArray($json); |
|
$row = GetMontageTable($arrayRes); |
|
|
|
$smarty->assign('row', $row); |
|
$smarty->assign('msg', $msg); |
|
GetTemplate($smarty, 'auditoria/logFullDetalhes.tpl'); |
|
} else { |
|
throw new Exception(); |
|
} |
|
} catch (Exception $ex) { |
|
$msg = $ex->getMessage("Não foi encontrado os logs com as características."); |
|
} |
|
|
|
function GetQuery($idFull) { |
|
$query = sprintf("SELECT full_log AS dados |
|
FROM pbx_audita_full a |
|
WHERE full_id = %s", $idFull); |
|
return $query; |
|
} |
|
|
|
function GetMontageTable($tableRow) { |
|
foreach ($tableRow as $key => $value) { |
|
$rowTable .= "<tr>"; |
|
$rowTable .= sprintf("<th>%s</th>", $key); |
|
if (!is_array($value)) { |
|
unset($tableRow["$value"]); |
|
$rowTable .= sprintf("<td>%s</td>", $value); |
|
} else { |
|
$rowTable .= "<td>" . GerarArray($value) . "</td>"; |
|
} |
|
$rowTable .= "</tr>"; |
|
} |
|
return $rowTable; |
|
} |
|
|
|
function GerarArray($arrayRes) { |
|
foreach ($arrayRes as $value) { |
|
$rowTable .= $value . " | "; |
|
} |
|
return $rowTable; |
|
} |
|
|
|
function GetMontageArray($json) { |
|
if ($json['request']) { |
|
$json = $json['request']; |
|
} |
|
foreach ($json as $key => $value) { |
|
$arrayJ["$key"] = $value; |
|
if (is_array($value)) { |
|
GetMontageArray($value); |
|
} |
|
} |
|
return $arrayJ; |
|
}
|
|
|