<?php
//include dos arquivos padr<EFBFBD> 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']);
$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" > <?php //onClick="ConsultaRamal('index.php?idProg=10002&pbxRequest=1&pesquisa=1', 0);" ?>
< / 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<EFBFBD> mero < / th >
< th align = "left" > Estraté gia < / th >
< th align = "left" > Timeout Fila < / th >
< th align = "center" > < span title = "N<EFBFBD> mero de Depnd<EFBFBD> ncias" > Dep< / span > < / th >
< th align = "center" > Status < / th >
< th align = "center" > A<EFBFBD> <EFBFBD> es< / th >
< / tr >
<?php
$strategia['ringall'] = 'Simultaneo - Chama todos os agentes dispon<EFBFBD> veis';
$strategia['leastrecent'] = 'Tempo Livre - Chama o agente que est<EFBFBD> a mais tempo sem receber liga<EFBFBD> <EFBFBD> es';
$strategia['fewestcalls'] = 'Numero de Liga<EFBFBD> <EFBFBD> es - Chama o agente com o menor numero de liga<EFBFBD> <EFBFBD> es atendidas';
$strategia['random'] = 'Randomico - Chama os agentes de forma aleatoria';
$strategia['rrordered'] = 'Sequencial - Chama o agente respeitando a ordem cadastrada (Membros Est<EFBFBD> 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'";
}
$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 ; ?> ');" > <?php echo $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<EFBFBD> ncias n<EFBFBD> o pode ser desativado!" alt = "Este registro n<EFBFBD> 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 = "<EFBFBD> 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++;
} 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 >
< div id = "campos" style = "display:none" align = "center" >
< iframe src = "" frameborder = "0" scrolling = "no" name = "geral" id = "geral" align = "middle" > < / iframe >
< / div >
< div id = "mensagem" style = "display:none;width:300;height:auto" >
< table width = "100%" border = "0" cellpadding = "0" cellspacing = "0" >
< tr bordercolor = "#FFFFFF" bgcolor = "#FFFFFF" style = "border-color:#FFFFFF" >
< td width = "5%" align = "center" style = "border: none;font-family: Arial, Helvetica, sans-serif;font-size: 16px;color: #990000;background-color: #FFFFFF;" >
< / td >
< td width = "95%" align = "center" bgcolor = "#FFFFFF" style = "border: none;font-family: Arial, Helvetica, sans-serif;font-size: 16px;color: #990000;background-color: #FFFFFF;" > < div align = "center" >
< input name = "mens" type = "button" value = "mens" style = "border: none;font-family: Arial, Helvetica, sans-serif;font-size: 14px;color: #990000;background-color: #FFFFFF;" id = "mens" >
< / div >
< / td >
< / tr >
< tr bordercolor = "#FFFFFF" bgcolor = "#FFFFFF" style = "border-color:#FFFFFF" >
< td colspan = "2" align = "center" bordercolor = "#FFFFFF" bgcolor = "#FFFFFF" style = "border-color:#FFFFFF" > < span style = "color: #FFFFFF" > _
< / span >
< / td >
< / tr >
< tr bordercolor = "#FFFFFF" bgcolor = "#FFFFFF" style = "border-color:#FFFFFF" >
< td colspan = "2" bordercolor = "#FFFFFF" bgcolor = "#FFFFFF" style = "border-color:#FFFFFF" >
< table width = "100%" border = "0" cellpadding = "0" cellspacing = "0" bordercolor = "#FFFFFF" style = "border-color:#FFFFFF" >
< tr >
< td width = "50%" align = "center" bordercolor = "#FFFFFF" bgcolor = "#FFFFFF" style = "border-color:#FFFFFF" >
< div align = "center" >
< button id = "todos" class = "botoes" > Sim< / button >
< / div >
< / td >
< td width = "50%" align = "center" bordercolor = "#FFFFFF" bgcolor = "#FFFFFF" style = "border-color:#FFFFFF" >
< div align = "center" > < button id = "cancela" class = "botoes" > Nã o< / button >
< / div >
< / td >
< / tr >
< / table >
< / td >
< / tr >
< / table >
< / div >
< / body >
< / html >