PABX da Simples IP
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.
 
 
 
 
 
 

205 lines
12 KiB

<?php
//include dos arquivos padrões do sistema
$acao = isset($_REQUEST['acao']) ? trim($_REQUEST['acao']) : 'select';
$id = isset($_REQUEST['id']) ? trim($_REQUEST['id']) : 0;
$filtro = isset($_REQUEST["numRamal"]) ? trim($_REQUEST["numRamal"]) : '';
$filtroNovo = !isset($_REQUEST["pgn"]) ? '' : sprintf("&numRamal%s&pgn=%s&bloco=%s&pg=%s&status=%s", $_REQUEST["numRamal"], $_REQUEST["pgn"], $_REQUEST["bloco"], $_REQUEST["pg"], $_REQUEST["status"]);
$recontaPag = ($acao == 'inseri') || ($acao == "deleta") || isset($_REQUEST['pesquisa']);
$org_id = GetOrganizacao();
$status = isset($_REQUEST["status"]) ? trim($_REQUEST["status"]) : 'A';
if ($acao == "deleta") {
$query = "SELECT numero, nome FROM pbx_queues_grupos WHERE id=$id";
$result = pg_query($dbcon, $query);
if ($dados = pg_fetch_array($result)) {
$numero = $dados['numero'];
$nomeFila = $dados['nome'];
}
//Remove o dac da interface de supervisao
$query = "UPDATE pbx_queues_grupos set status='I', opcao = null, acao = null, context = null where id='$id'";
pg_query($dbcon, $query);
$query = "DELETE FROM pbx_supervisor_dacs WHERE trim(dac) = trim((select nome from pbx_dacs where id = '$id'))";
pg_query($dbcon, $query);
$query = "DELETE FROM pbx_fila_audios WHERE id = '$id' ";
pg_query($dbcon, $query);
$query = "DELETE FROM pbx_queues_membros WHERE id_fila = '$id'";
pg_query($dbcon, $query);
$query = "DELETE FROM pbx_prioridades_atendimento WHERE dac = '$nomeFila'";
pg_query($dbcon, $query);
// //gera arquivos e executa o reload dos dados no asterisk
// gera_arquivos($dbcon, 'QUEUES_GRUPOS');
Ajusta_tabelas('filas', $numero, $dbcon);
}
?>
<table width="99%" align="center" border="0" cellpadding="2" cellspacing="0" class="filtro">
<tr>
<td>
<table align="left" border="0" cellpadding="2" cellspacing="0">
<tr>
<td>Palavra Chave</td>
<td>Filtro Status</td>
</tr>
<tr>
<td align="left" nowrap="nowrap">
<input name="numRamal" type="text" id="numRamal" value="<?php echo $_REQUEST["numRamal"]; ?>" size="20"> <?php //onkeyup="ConsultaRamal('index.php?idProg=10002&pbxRequest=1', event);"
?>
</td>
<td align="left" nowrap="nowrap">
<div class="geral" nowrap="nowrap">
<input name="status" class="clean" type="radio" value="A" <?= $status == "A" ? 'checked' : ''; ?>>Ativa
<input name="status" class="clean" type="radio" value="I" <?= $status == "I" ? 'checked' : ''; ?>>Desativada
<input name="status" class="clean" type="radio" value="T" <?= $status == "T" ? 'checked' : ''; ?>>Todos
</div>
</td>
<td>
<input name="locaRamal" type="submit" id="locaRamal" value="Localizar">
</td>
</tr>
</table>
</td>
<td align="right" nowrap="nowrap">
<a href="#" onclick="NovaJanela('index.php?idProg=11002&pbxRequest=1&acao=inseri<?= $filtroNovo; ?>&status=<?= $status ?>', 'CadFila', '780', '560.', 'resizable=YES,scrollbars=YES');"><img src="admin/images/novo.gif" width="20" height="20" border="0" align="absmiddle">NOVA FILA </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úmero </th>
<th align="left"> Estrat&eacute;gia </th>
<th align="left"> Timeout Fila </th>
<th align="center"> <span title="Número de Depndências">Dep</span></th>
<th align="center"> Status </th>
<th align="center">Ações</th>
</tr>
<?php
$strategia['ringall'] = 'Simultaneo - Chama todos os agentes disponíveis';
$strategia['leastrecent'] = 'Tempo Livre - Chama o agente que está a mais tempo sem receber ligações';
$strategia['fewestcalls'] = 'Numero de Ligações - Chama o agente com o menor numero de ligações atendidas';
$strategia['random'] = 'Randomico - Chama os agentes de forma aleatoria';
$strategia['rrordered'] = 'Sequencial - Chama o agente respeitando a ordem cadastrada (Membros Estáticos)';
$acessoAudio = VerificaPerfilAcesso($dbcon, GetIdProgFromNomeArq('audio.php'));
$compl = '';
if (IsPostBack() || (!empty($filtro))) {
$compl = PreparaLike($filtro, true);
$compl = sprintf("and (a.nome ilike %s or a.numero ilike %s) ", $compl, $compl);
}
$statuSql = "";
if ($status == 'A') {
$statuSql = " and status = 'A'";
} else if ($status == 'I') {
$statuSql = " and status = 'I'";
}
$compl .= " and org_id = {$org_id} ";
$query = "SELECT id, nome, numero, strategy, timeout2, status FROM pbx_queues_grupos a where 1=1 $statuSql $compl order by id asc";
$params = "&pbxRequest=1&numRamal=$filtro&status=$status";
$links = PaginaDados($idProg, $query, $params, $regPagina, $offSet, $pagMostra, true);
$query .= " limit $regPagina offset $offSet";
//if(IsAdmin()){ echo $query;}
$result = pg_query($dbcon, $query);
$z = 0;
while ($dados = pg_fetch_array($result)) {
$tamOper = $acessoAudio ? 80 : 60;
$totaldep = GetTotalDependencias('filas', $dados['numero']);
$opcao = 'filas';
$acao = $dados['numero'];
$recursoTipo = 'Fila';
$nomeRecurso = $dados['nome'];
$dep = GetLinkDependenciaRecurso($opcao, $acao, $recursoTipo, $nomeRecurso, $totaldep);
?>
<tr>
<td width="50" align="center"><?php echo $dados['id']; ?></td>
<td>
<a href="#" style="color: #000" onclick="abre_janela('780', '560', 'index.php?idProg=11002&pbxRequest=1&acao=edita&id=<?php echo $dados['id']; ?><?= $params; ?>');">
<?= GravaNomeOrganizacao($dados['nome']); ?>
</a>
</td>
<td width="120"><?php echo $dados['numero']; ?></td>
<td width="250"><?php echo $strategia[$dados['strategy']]; ?></td>
<td width="80"><?php echo $dados['timeout2']; ?></td>
<td width="30" align="center"><?php echo $dep; ?></td>
<td align="center" width="30">
<div align="center">
<?php echo GetStatusModulo($dados['status']); ?>
</div>
</td>
<td width="<?= $tamOper; ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="2" style="border:0;">
<tr style="border:0;">
<td style="border:0;">
<div align="center"><a href="#" title="Editar Fila: <?php echo $dados['nome']; ?>" onclick="abre_janela('780', '560.', 'index.php?idProg=11002&pbxRequest=1&acao=edita&id=<?php echo $dados['id']; ?><?= $params; ?>');"><img src="admin/images/edit.gif" alt="EDITAR A FILA:<?php echo $dados['nome']; ?>" width="16" height="16" border="0"></a></div>
</td>
<?php if (!$totaldep) { ?>
<?php if ($dados['status'] == 'A') { ?>
<td style="border:0;">
<div align="center"><a href="#" title="DESATIVAR Fila: <?php echo $dados['nome']; ?>" onclick="excluir('<?php echo $dados['id']; ?>', '<?php echo $dados['nome']; ?>', 'DESEJA REALMENTE DESATIVAR A FILA:<?php echo $dados['nome']; ?>', 'index.php?idProg=10002&pbxRequest=1&acao=deleta&id=<?php echo $dados['id']; ?><?= $params; ?>', 'FILAS:');"><img src="admin/images/delete.gif" title="DESATIVAR A FILA:<?php echo $dados['nome']; ?>" width="16" height="16" border="0"></a></div>
</td>
<?php } else { ?>
<td style="border:0;"><img src="imgSite/fecha16.png" title="FILA INATIVA: <?php echo $dados['nome']; ?>" width="16" height="16" border="0"></td>
<?php
}
} else {
?>
<td style="border:0" width="33%">
<div align="center"><img src="images/delete.gif" title="Este registro possui dependências não pode ser desativado!" alt="Este registro não pode ser desativado!" width="16" height="16" border="0"></div>
</td>
<?php } ?>
<td style="border:0;" align="center">
<div align="center"><a href="#" title="Grupos da Fila: <?php echo $dados['nome']; ?>" onclick="NovaJanela('index.php?idProg=10006&pbxRequest=1&id=<?php echo $dados['id']; ?>&nome=<?php echo $dados['nome']; ?>', 'QeuesGrupos', '680', '250', 'resizable=NO,scrollbars=NO');"><img src="admin/images/usuarios.gif" alt="Configura acesso a Fila:<?php echo $dados['nome']; ?>" width="16" height="16" border="0"></a></div>
</td>
<?php if ($acessoAudio) { ?>
<td style="border:0;" align="center">
<div align="center"><a href="#" title="Áudios da Fila: <?php echo $dados['nome']; ?>" onclick="NovaJanela('index.php?idProg=10051&pbxRequest=1&id=<?php echo $dados['id']; ?>&nome=<?php echo $dados['nome']; ?>', 'QeuesAudios', '680', '250', 'resizable=NO,scrollbars=NO');"><img src="admin/images/sound22.png" alt="Configura acesso a Fila:<?php echo $dados['nome']; ?>" width="16" height="16" border="0"></a></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ã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>
<div id="campos" style="display:none" align="center">
<iframe src="" frameborder="0" scrolling="no" name="geral" id="geral" align="middle"></iframe>
</div>
</body>
</html>