|
|
<?php |
|
|
$acao = isset($_GET['acao']) ? trim($_GET['acao']) : 'select'; |
|
|
$id = isset($_GET['id']) ? trim($_GET['id']) : 0; |
|
|
$filtro = isset($_GET["numRamal"]) ? trim($_GET["numRamal"]) : ''; |
|
|
$filtroNovo = !isset($_GET["pgn"]) ? '' : sprintf("&numRamal%s&pgn=%s&bloco=%s&pg=%s", $_GET["numRamal"], $_GET["pgn"], $_GET["bloco"], $_GET["pg"]); |
|
|
$recontaPag = ($acao == 'inseri') || ($acao == "deleta") || isset($_GET['pesquisa']); |
|
|
$org_id = GetOrganizacao(); |
|
|
|
|
|
if ($acao == "deleta") { |
|
|
$query = "SELECT * FROM pbx_ura order by id asc"; |
|
|
$result = pg_query($dbcon, $query); |
|
|
$z == 0; |
|
|
while ($dados = pg_fetch_array($result)) { |
|
|
$nome = $dados['id'] . '-' . $dados['nome']; |
|
|
} |
|
|
|
|
|
$query = "delete from pbx_ura where id='$id'"; |
|
|
pg_query($dbcon, $query); |
|
|
$query = "delete from pbx_ura_destino where id_ura='$id'"; |
|
|
pg_query($dbcon, $query); |
|
|
$query = "delete from pbx_grupo_ura_ramal where id_ura = '$id'"; |
|
|
pg_query($dbcon, $query); |
|
|
Ajusta_tabelas('ura', $nome, $dbcon); |
|
|
} |
|
|
|
|
|
$janW = '500'; |
|
|
$janH = '400'; |
|
|
|
|
|
$compl = ''; |
|
|
if (isset($_GET['pesquisa']) && $_GET['pesquisa']) { |
|
|
$compl = PreparaLike($filtro, true); |
|
|
$compl = sprintf("and (a.nome ilike %s or a.teste ilike %s)", $compl, $compl); |
|
|
} |
|
|
$compl .= " and a.org_id = {$org_id} "; |
|
|
$query = "SELECT id, nome, |
|
|
case when(exists(select * from pbx_grupo_ura_ramal where id_ura = a.id))then 'S' else 'N' end as permite_ligacao, |
|
|
tempo_espera, som_ura, teste, opcao, acao, timeout_digito, ura_desc |
|
|
FROM pbx_ura a WHERE 1=1 $compl |
|
|
ORDER BY id ASC"; |
|
|
|
|
|
$params = "&pbxRequest=1&numRamal=$filtro" . (isset($_GET['pesquisa']) ? '&pesquisa=1' : ''); |
|
|
$links = PaginaDados($idProg, $query, $params, $regPagina, $offSet, $pagMostra, true); |
|
|
$query .= " limit $regPagina offset $offSet"; |
|
|
$result = pg_query($dbcon, $query); |
|
|
|
|
|
?> |
|
|
|
|
|
<table width="99%" align="center" border="0" cellpadding="2" cellspacing="0" class="filtro"> |
|
|
<tr> |
|
|
<td colspan="2">Palavra Chave</td> |
|
|
</tr> |
|
|
<tr> |
|
|
<td align="left" nowrap="nowrap"> |
|
|
<input name="numRamal" type="text" id="numRamal" value="<?= $_GET["numRamal"]; ?>" onkeyup="ConsultaRamal('index.php?idProg=10031&pbxRequest=1', event);" size="20"> |
|
|
<input name="locaRamal" type="button" id="locaRamal" value="Localizar" onClick="ConsultaRamal('index.php?idProg=10031&pbxRequest=1&pesquisa=1', 0);"> |
|
|
</td> |
|
|
<td align="right" nowrap="nowrap"> |
|
|
<a href="#" onClick="abre_janela('705', '237', 'index.php?idProg=11031&pbxRequest=1&acao=inseri<?= $filtroNovo; ?>');"> |
|
|
<img src="images/novo.gif" width="20" height="20" border="0" align="absmiddle"> |
|
|
NOVA URA |
|
|
</a> |
|
|
</td> |
|
|
</tr> |
|
|
<tr> |
|
|
<td colspan="2"> |
|
|
<table width="100%" class="grid" border="0" cellspacing="0" cellpadding="2"> |
|
|
<tr> |
|
|
<th align="center">Id</th> |
|
|
<th align="left">Nome</th> |
|
|
<th align="left">N<EFBFBD>mero</th> |
|
|
<th align="left">Tempo de Espera </th> |
|
|
<th align="center"> Permite Ligação</th> |
|
|
<th align="center"> <span title="N<EFBFBD>mero de Depnd<EFBFBD>ncias">Dep</span></th> |
|
|
<th align="center">A<EFBFBD><EFBFBD>es</th> |
|
|
</tr> |
|
|
<?php |
|
|
$z = 0; |
|
|
while ($dados = pg_fetch_array($result)) { |
|
|
$uraAtiva = $dados['opcao'] == 'uraativa'; |
|
|
$nomeUra = $dados['id'] . "-" . $dados['nome']; |
|
|
$totaldep = GetTotalDependencias('ura', $nomeUra); |
|
|
$opcao = 'ura'; |
|
|
$acao = $nomeUra; |
|
|
$recursoTipo = 'URA'; |
|
|
$nomeRecurso = $dados['nome']; |
|
|
$dep = GetLinkDependenciaRecurso($opcao, $acao, $recursoTipo, $nomeRecurso, $totaldep); |
|
|
?> |
|
|
<tr class="grid"> |
|
|
<td width="50" align="center"><?= $dados['id']; ?></td> |
|
|
<td><a href="#" style="color: #000;" onClick="abre_janela(<?= $uraAtiva ? '600' : '705'; ?>,<?= $uraAtiva ? '300' : '237'; ?>, 'index.php?idProg=<?= $uraAtiva ? "12031" : "11031"; ?>&pbxRequest=1&acao=edita&id=<?= $dados['id']; ?><?= $params; ?>');"><?= $dados['nome']; ?></a></td> |
|
|
<td width="120"><?= $dados['teste']; ?></td> |
|
|
<td width="120"><?= $uraAtiva ? '-' : $dados['tempo_espera']; ?></td> |
|
|
<td width="120" align="center"> <?= ($dados['permite_ligacao'] == 'S') ? 'SIM' : 'NAO'; ?></td> |
|
|
<td width="30" align="center"><?= $dep; ?></td> |
|
|
<td width="40"> |
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
|
<tr> |
|
|
<td style="border:0" width="33%"> |
|
|
<div align="center"> |
|
|
<a href="#" onClick="abre_janela(<?= $uraAtiva ? '600' : '705'; ?>,<?= $uraAtiva ? '300' : '237'; ?>, 'index.php?idProg=<?= $uraAtiva ? "12031" : "11031"; ?>&pbxRequest=1&acao=edita&id=<?= $dados['id']; ?><?= $params; ?>');"><img src="images/edit.gif" alt="EDITAR A URA:<?= $dados['nome']; ?>" width="16" height="16" border="0"> |
|
|
</a> |
|
|
</div> |
|
|
</td> |
|
|
<?php if (!$totaldep) { ?> |
|
|
<td style="border:0" width="33%"> |
|
|
<div align="center"> |
|
|
<a href="#" onClick="excluir('<?= $dados['id']; ?>', '<?= $dados['nome']; ?>', 'DESEJA REALMENTE EXLUIR A URA:<?= $dados['nome']; ?>', 'index.php?idProg=10031&pbxRequest=1&acao=deleta&id=<?= $dados['id']; ?>&uraativa=<?= $uraAtiva ? "1" : "0"; ?><?= $params; ?>', 'URA:');"> |
|
|
<img src="images/delete.gif" alt="APAGAR A URA:<?= $dados['nome']; ?>" width="16" height="16" border="0"> |
|
|
</a> |
|
|
</div> |
|
|
</td> |
|
|
<?php } else { ?> |
|
|
<td style="border:0" width="33%"> |
|
|
<div align="center"> |
|
|
<img src="images/delete.gif" title="Este registro possui depend<EFBFBD>ncias n<EFBFBD>o pode ser apagado!" alt="Este registro n<EFBFBD>o pode ser apagado!" width="16" height="16" border="0"> |
|
|
</div> |
|
|
</td> |
|
|
<?php } ?> |
|
|
</tr> |
|
|
</table> |
|
|
</td> |
|
|
</tr> |
|
|
<?php $z++; ?> |
|
|
<?php } ?> |
|
|
<?php if ($z == 0) { ?> |
|
|
<tr align="center" valign="middle" bordercolor="#999999" class="labels"> |
|
|
<td colspan="8"> |
|
|
<div align="center" class="info"><img src="images/shutdown.gif" width="24" height="24" border="0" align="absmiddle" /> N<EFBFBD>o foram encontrados registros </div> |
|
|
</td> |
|
|
</tr> |
|
|
<?php } ?> |
|
|
<tr> |
|
|
<th align="center" colspan="8"> |
|
|
<table width="100%" class="grid" border="0" cellspacing="0" cellpadding="2"> |
|
|
<tr> |
|
|
<th align="center" style="width: 90%; border:0;"><?= $links; ?></th> |
|
|
<th align="right" style="width: 10%; border:0;"><?= sprintf("%s/%s", $pagMostra, $totalReg); ?></th> |
|
|
</tr> |
|
|
</table> |
|
|
</th> |
|
|
</tr> |
|
|
</table> |
|
|
</td> |
|
|
</tr> |
|
|
</table>
|