|
|
<?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']); |
|
|
|
|
|
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); |
|
|
////gera arquivos e executa o reload dos dados no asterisk |
|
|
// gera_arquivos($dbcon, 'URA'); //gera arquivos e executa o reload dos dados no asterisk |
|
|
// gera_arquivos($dbcon, 'TESTES'); |
|
|
Ajusta_tabelas('ura', $nome, $dbcon); |
|
|
} |
|
|
?> |
|
|
|
|
|
<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="<? echo $_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<?php echo $filtroNovo; ?>');"><img src="images/novo.gif" width="20" height="20" border="0" align="absmiddle">NOVA URA</a> |
|
|
<!-- <a href="#" onClick="abre_janela('600', '300', 'index.php?idProg=12031&pbxRequest=1&acao=inseri');"><img src="images/novo.gif" width="20" height="20" border="0" align="absmiddle">NOVA URA ATIVA</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 |
|
|
$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); |
|
|
} |
|
|
$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); |
|
|
$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"><? echo $dados['id']; ?></td> |
|
|
<td><a href="#" style="color: #000;" onClick="abre_janela(<?php echo $uraAtiva ? '600' : '705'; ?>,<?php echo $uraAtiva ? '300' : '237'; ?>, 'index.php?idProg=<?php echo $uraAtiva ? "12031" : "11031"; ?>&pbxRequest=1&acao=edita&id=<? echo $dados['id']; ?><? echo $params; ?>');"><? echo $dados['nome']; ?></a></td> |
|
|
<td width="120"><? echo $dados['teste']; ?></td> |
|
|
<td width="120"><? echo $uraAtiva ? '-' : $dados['tempo_espera']; ?></td> |
|
|
<td width="120" align="center"> <? |
|
|
if ($uraAtiva) |
|
|
echo '-'; |
|
|
else if ($dados['permite_ligacao'] == 'S') { |
|
|
echo 'SIM'; |
|
|
} else { |
|
|
echo 'NÃO'; |
|
|
} |
|
|
?></td> |
|
|
|
|
|
<td width="30" align="center"><? echo $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(<?php echo $uraAtiva ? '600' : '705'; ?>,<?php echo $uraAtiva ? '300' : '237'; ?>, 'index.php?idProg=<?php echo $uraAtiva ? "12031" : "11031"; ?>&pbxRequest=1&acao=edita&id=<? echo $dados['id']; ?><? echo $params; ?>');"><img src="images/edit.gif" alt="EDITAR A URA:<? echo $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('<? echo $dados['id']; ?>', '<? echo $dados['nome']; ?>', 'DESEJA REALMENTE EXLUIR A URA:<? echo $dados['nome']; ?>', 'index.php?idProg=10031&pbxRequest=1&acao=deleta&id=<? echo $dados['id']; ?>&uraativa=<?php echo $uraAtiva ? "1" : "0"; ?><? echo $params; ?>', 'URA:');"><img src="images/delete.gif" alt="APAGAR A URA:<? echo $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> |
|
|
<? |
|
|
$z++; |
|
|
} 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> |
|
|
<? |
|
|
} |
|
|
?> |
|
|
|
|
|
<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;"><?php echo $links; ?></th><th align="right" style="width: 10%; border:0;"><?php echo sprintf("%s/%s", $pagMostra, $totalReg); ?></th></tr></table></th> |
|
|
</tr> |
|
|
</table> |
|
|
</td> |
|
|
</tr> |
|
|
</table>
|