• R/O
  • SSH
  • HTTPS

zolm: Commit


Commit MetaInfo

Revisión78 (tree)
Tiempo2015-11-03 02:02:34
Autorderekwildstar

Log Message

Novas páginas para o gerenciador

Cambiar Resumen

Diferencia incremental

--- trunk/SERVIDOR/adm/clientes.inc.php (revision 77)
+++ trunk/SERVIDOR/adm/clientes.inc.php (revision 78)
@@ -37,6 +37,8 @@
3737 if ($aClientId != null) {
3838 $sql .= " and bi_clientes_id = $aClientId";
3939 }
40+
41+ $sql .= " order by bi_clientes_id";
4042
4143 $dataSet = $connection->query($sql);
4244
--- trunk/SERVIDOR/adm/inserirCliente.inc.php (nonexistent)
+++ trunk/SERVIDOR/adm/inserirCliente.inc.php (revision 78)
@@ -0,0 +1,17 @@
1+<?php
2+require_once(dirname(__FILE__) . "/../../jdcr/php/gen/BasePage.php");
3+require_once(dirname(__FILE__) . "/../../jdcr/php/dbu/PDOEx.inc.php");
4+require_once(dirname(__FILE__) . "/../php/tipos.inc.php");
5+
6+class InserirCliente extends BasePage {
7+ function __construct() {
8+ parent::__construct("");
9+
10+ $this->setTemplateDir("../tpl/");
11+ $this->setCompileDir("../tpl/com/");
12+ $this->setConfigDir("../tpl/cfg/");
13+ $this->setCacheDir("../tpl/cac/");
14+ $this->setCaching(false);
15+ }
16+}
17+?>
--- trunk/SERVIDOR/adm/inserirCliente.php (nonexistent)
+++ trunk/SERVIDOR/adm/inserirCliente.php (revision 78)
@@ -0,0 +1,7 @@
1+<?php
2+require(dirname(__FILE__) . "/../php/checksession.inc.php");
3+require(dirname(__FILE__) . "/inserirCliente.inc.php");
4+
5+$page = new InserirCliente();
6+$page->show();
7+?>
\ No newline at end of file
--- trunk/SERVIDOR/adm/manterCliente.php (revision 77)
+++ trunk/SERVIDOR/adm/manterCliente.php (revision 78)
@@ -3,16 +3,30 @@
33 require(dirname(__FILE__) . "/../php/checksession.inc.php");
44 require(dirname(__FILE__) . "/../php/config.inc.php");
55
6-$acao = isset($_POST["i"]) && $_POST["i"] == "1"?"i":
7- isset($_POST["e"]) && $_POST["e"] == "1"?"e":
8- isset($_POST["a"]) && $_POST["a"] == "1"?"a":null;
9-
6+$acao = null;
107
8+if (isset($_POST["i"]) && $_POST["i"] == "1") {
9+ $acao = "i";
10+} else if (isset($_POST["e"]) && $_POST["e"] == "1") {
11+ $acao = "e";
12+} else if (isset($_POST["a"]) && $_POST["a"] == "1") {
13+ $acao = "a";
14+}
15+
1116 function insert() {
1217 $connection = new PDOEx(dbConfig()->getDsn(), dbConfig()->getUserName(), dbConfig()->getPassword());
1318
19+ // validação e ajuste de dados
20+ if (!isset($_POST["senha"])) {
21+ trigger_error("zolm/manterCliente/insert: A senha não foi definida",E_USER_ERROR);
22+ }
23+
24+ $cpfCnpj = str_replace(array(".", "-", "/"),"",$_POST["cpfCnpj"]);
25+
26+ $senha = md5($_POST["senha"]);
27+
1428 $sql = <<<EOS
15-insert into clientes (va_nome
29+insert into CLIENTES (va_nome
1630 ,va_email
1731 ,ch_cpfcnpj
1832 ,ch_senha
@@ -20,14 +34,14 @@
2034 ,ch_chavepublica)
2135 values ('{$_POST["nome"]}'
2236 ,'{$_POST["email"]}'
23- ,'{$_POST["cpfCnpj"]}'
24- ,'{$_POST["senha"]}'
37+ ,'$cpfCnpj'
38+ ,'$senha'
2539 ,'{$_POST["chavePrivada"]}'
2640 ,'{$_POST["chavePublica"]}');
2741 EOS;
28- echo($sql);
42+// echo($sql);
2943
30- //$dataSet = $connection->exec($sql);
44+ $dataSet = $connection->exec($sql);
3145 }
3246
3347 function update() {
@@ -60,12 +74,26 @@
6074 $dataSet = $connection->exec($sql);
6175 }
6276
77+function delete() {
78+ $connection = new PDOEx(dbConfig()->getDsn(), dbConfig()->getUserName(), dbConfig()->getPassword());
6379
80+ $sql = <<<EOS
81+delete from CLIENTES
82+ where bi_clientes_id = {$_POST["id"]}
83+EOS;
84+
85+ //echo($sql);
86+ $dataSet = $connection->exec($sql);
87+}
88+
6489 switch ($acao) {
6590 case "i":
6691 insert();
92+ header("Location: /zolm/adm/clientes.php");
6793 break;
6894 case "e";
95+ delete();
96+ header("Location: /zolm/adm/clientes.php");
6997 break;
7098 case "a";
7199 update();
--- trunk/SERVIDOR/admin.php (revision 77)
+++ trunk/SERVIDOR/admin.php (revision 78)
@@ -10,7 +10,7 @@
1010 } else if (isset($_POST["clientes/listar"])) {
1111 header("Location: /zolm/adm/clientes.php");
1212 } else if (isset($_POST["clientes/novo"])) {
13- header("Location: /zolm/adm/novoCliente.php");
13+ header("Location: /zolm/adm/inserirCliente.php");
1414 } else if (isset($_POST["sistemas/listar"])) {
1515 header("Location: /zolm/adm/sistemas.php");
1616 } else if (isset($_POST["sistemas/novo"])) {
@@ -21,8 +21,6 @@
2121
2222 if ($acao[0] == "clientes/editar") {
2323 header("Location: /zolm/adm/editarCliente.php?id=" . $acao[1]);
24- } else if ($acao[0] == "clientes/remover") {
25- header("Location: /zolm/adm/removerCliente.php?id=" . $acao[1]);
2624 } else if ($acao[0] == "sistemas/editar") {
2725 header("Location: /zolm/adm/editarSistema.php?id=" . $acao[1]);
2826 } else if ($acao[0] == "sistemas/remover") {
Show on old repository browser