<?php
$acao = $_GET['acao'];
$acao2 = $_GET['acao2'];
$id = $_GET['id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "cs" lang = "cs" >
< head >
< title > Simples IP< / title >
< meta http-equiv = "Content-Type" content = "text/html; charset=iso-8859-1" / >
< link href = "admin/css/forms.css" rel = "stylesheet" type = "text/css" >
< link rel = "stylesheet" href = "admin/css/validationEngine.jquery.css" type = "text/css" media = "screen" title = "no title" charset = "ISO-8859-1" / >
< script type = "text/javascript" src = "admin/js/jquery-1.4.js" > < / script >
< script type = "text/javascript" src = "admin/js/jquery.blockUI.js?v2.29" > < / script >
< script src = "admin/js/jquery.validationEngine.js" type = "text/javascript" > < / script >
< script src = "admin/js/jquery.validationEngine-en.js" type = "text/javascript" > < / script >
< script src = "admin/js/pbxAjax.js" type = "text/javascript" > < / script >
< script >
<!--
$(document).ready(function () {
$("#form1").validationEngine({
sucess: function () {
document.form1.submit();
},
failure: function () {}
})
});
function MM_openBrWindow(theURL, winName, features) { //v2.0
window.open(theURL, winName, features);
}
//-->//-->
< / script >
< style type = "text/css" >
<!--
.style1 {font-size: xx-small}
.style3 {font-size: xx-small; color: #EAEAEA; }
.style5 {font-size: 10}
.style6 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style7 {font-size: 10; font-family: Verdana, Arial, Helvetica, sans-serif; }
body {
background-color: #EAEAEA;
}
-->
< / style >
< / head >
< body >
< div id = "alerta" style = "display:none;width:300;height:auto" >
< br >
< 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 = "mens2" type = "button" value = "mens2" style = "border: none;font-family: Arial, Helvetica, sans-serif;font-size: 14px;color: #990000;background-color: #FFFFFF;" id = "mens2" >
< / 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 colspan = "2" align = "center" bordercolor = "#FFFFFF" bgcolor = "#FFFFFF" style = "border-color:#FFFFFF" >
< div align = "center" >
< button id = "volta" class = "botoes" > Voltar< / button >
< / div >
< / td >
< / tr >
< / table > < / td >
< / tr >
< / table >
< / div >
<?php
if ($acao == "deleta") {
$id = $_GET["id"] ?? "0";
//REALIZA BACKUP BO BANCO
//backup($dbcon,'pbx_digivoice_grupos_','D',$id,'delete','GRUPO DIGIVOICE');
$query = "delete from pbx_digivoice_grupos_ where id='$id'";
pg_query($dbcon, $query); //gera arquivos e executa o reload dos dados no asterisk
gera_arquivos($dbcon, 'DIGIVOICE');
?>
<?php
}
if ($_GET["salva"] == "sim") {
$acao2 = $_GET["acao2"];
$id = trim($_POST["id"]);
$numero = (trim($_POST["numero"]));
$portas = trim($_POST["portas"]);
if ($acao2 == 'inseri') {
$query = "INSERT INTO pbx_digivoice_grupos_(numero,portas)
VALUES ('$numero','$portas')";
pg_query($dbcon, $query);
}
if ($acao2 == "edita") {
//REALIZA BACKUP BO BANCO
//backup($dbcon,'pbx_digivoice_grupos_','U',$id,'update','GRUPO DIGIVOICE');
$query = "UPDATE pbx_digivoice_grupos_
SET numero='$numero',portas='$portas'
WHERE id=$id";
pg_query($dbcon, $query);
}
?>
< script >
//window.parent.location.reload();
< / script >
<?php
//gera arquivos e executa o reload dos dados no asterisk
gera_arquivos($dbcon, 'DIGIVOICE');
}
?>
< table width = "436" border = "1" align = "center" cellpadding = "0" cellspacing = "0" bordercolor = "#EAEAEA" id = "view" >
< tr class = "cabecalho" >
< td colspan = "4" > < div align = "center" > CADASTRO DE gRUPOS DIGIVOICE< / div > < / td >
< / tr >
< tr >
< td colspan = "4" > < table width = "100%" border = "0" cellspacing = "0" cellpadding = "0" >
< tr >
< td width = "25%" background = "img/button03.gif" > < div align = "center" > < a href = "index.php?idProg=11041&pbxRequest=1&acao2=inseri" class = "dados" > < img src = "images/novo.gif" width = "20" height = "20" border = "0" align = "absmiddle" > NOVO GRUPO < / a > < / div > < / td >
< / tr >
< / table > < / td >
< / tr >
<?php
if (trim($acao2) < > '') {
if ($acao2 == 'edita') {
$query3 = "SELECT * FROM pbx_digivoice_grupos_ where id=$id";
$result3 = pg_query($dbcon, $query3);
while ($dados3 = pg_fetch_array($result3)) {
$id = $dados3['id'];
$numero = trim($dados3['numero']);
$portas = trim($dados3['portas']);
}
}
$query3 = "SELECT numero FROM pbx_digivoice_grupos_ order by numero desc limit 1";
$result3 = pg_query($dbcon, $query3);
while ($dados3 = pg_fetch_array($result3)) {
$proximo_numero = $dados3['numero'] + 1;
}
?>
< tr >
< td colspan = "4" >< form action = "index.php?idProg=11041&pbxRequest=1&acao2= <?php echo $acao2 ; ?> &salva=sim&" method = "post" name = "form1" target = "_self" id = "form1" >
< table width = "100%" border = "0" cellspacing = "0" cellpadding = "0" >
< tr class = "labels" >
< td width = "12%" class = "dados" > < fieldset >
< legend class = "labels" > < span class = "style5" > Grupo:< / span > < / legend >
< input name = "numero" type = "text" class = "validate[required,custom[onlyNumber],length[0,100]] caixas" id = "numero2" size = "10" maxlength = "10" value = " <?php
if ($acao2 == 'edita') {
echo $numero;
} else {
echo $proximo_numero;
}
?>"/>
< / fieldset > < / td >
< td class = "dados" > < fieldset >
< legend class = "labels" > < span class = "style5" > Porta:< / span > < / legend >
< input name = "portas" type = "text" class = "validate[required,length[0,100]] caixas" id = "portas" size = "20" maxlength = "20" value = " <?php
if ($acao2 == 'edita') {
echo $portas;
}
?>"/>
< / fieldset > < / td >
< / tr >
< tr >
< td colspan = "2" > < div align = "center" >
< input name = "Submit2" type = "submit" class = "labels" value = "Salvar" / >
< input name = "id" type = "hidden" id = "acao4" value = " <?php echo $id ; ?> " /></ div ></ td >
< / tr >
< / table >
< / form > < / td >
< / tr >
<?php } ?>
< tr bordercolor = "#EAEAEA" class = "cabecalho" background = "img/button03.gif" >
< td width = "59" class = "dados" >
< div align = "center" > Id< / div > < / td >
< td width = "114" class = "dados" > Grupo < / td >
< td width = "129" class = "dados" > Porta:< / td >
< td width = "124" background = "img/button03.gif" > < div align = "center" class = "dados" > < span class = "style11" > Aç ã o< / div > < / td >
< / tr >
<?php
$janW = '500';
$janH = '400';
$query = "SELECT * FROM pbx_digivoice_grupos_ order by numero asc";
$result = pg_query($dbcon, $query);
$z == 0;
while ($dados = pg_fetch_array($result)) {
?>
< tr bordercolor = "#EAEAEA" class = "dadosResult" >
< td >< div align = "center" class = "style5 style6" > <?php echo $dados [ 'id' ]; ?> </ div ></ td >
< td >< span class = "style7" > <?php echo $dados [ 'numero' ]; ?> </ span ></ td >
< td >< span class = "style7" > <?php echo $dados [ 'portas' ] ?> </ span ></ td >
< td > < table width = "100%" border = "0" cellspacing = "0" cellpadding = "0" >
< tr >
< td width = "33%" class = "style7" >< div align = "center" >< a href = "index.php?idProg=11041&pbxRequest=1&acao2=edita&id= <?php echo $dados [ 'id' ]; ?> " >< img src = "images/edit.gif" alt = "EDITAR A URA: <?php echo $dados [ 'nome' ]; ?> " width = "22" height = "22" border = "0" ></ a ></ div ></ td >
< td width = "33%" class = "style7" >< div align = "center" >< a href = "#" onclick = "excluir(' <?php echo $dados [ 'id' ]; ?> ', ' <?php echo $dados [ 'numero' ]; ?> ', 'DESEJA EXLUIR O GRUPO: <?php echo $dados [ 'numero' ]; ?> ', 'index.php?idProg=11041&pbxRequest=1&acao=deleta&id= <?php echo $dados [ 'id' ]; ?> ', 'GRUPOS');" >< img src = "images/delete.gif" alt = "APAGAR A OPÇÃO DE URA: <?php echo $dados [ 'numero' ]; ?> " name = "delete" width = "22" height = "22" border = "0" ></ a ></ div ></ td >
< / tr >
< / table > < / td >
< / tr >
<?php
$z++;
} if ($z == 0) {
?>
< tr align = "center" valign = "middle" bordercolor = "#EAEAEA" bgcolor = "#FFFFFF" class = "labels" >
< td colspan = "4" > < div align = "center" > < span class = "info" > < img src = "images/shutdown.gif" width = "24" height = "24" border = "0" align = "absmiddle" / > < / span > Nã o foram encontrados registros < / div > < / td >
< / tr >
<?php } ?>
< tr align = "center" valign = "middle" bordercolor = "#EAEAEA" bgcolor = "#FFFFFF" class = "labels" >
< td colspan = "4" >
< input name = "Button" type = "button" class = "labels" value = "Fechar" onclick = "fecha_popup();" / > < / td >
< / tr >
< / table >
< div id = "mensagem" style = "display:none;" >
< 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 >