public static function dispatch(&$request) { session_start(); if (isset($request["page"])) { switch ($request["page"]) { case "login": $controller = new BaseController(); $controller->handle_input($request); break; case "cliente": $controller = new ClienteController(); if (isset($_SESSION[BaseController::role]) && $_SESSION[BaseController::role] != User::Cliente) { self::write403(); } $controller->handle_input($request); break; case "admin": $controller = new AdminController(); if (isset($_SESSION[BaseController::role]) && $_SESSION[BaseController::role] != User::Admin) { self::write403(); } $controller->handle_input($request); break; default: self::write404(); break; } } else { self::write404(); } // include 'php/view/master.php'; }
public static function dispatch(&$request) { session_start(); //inizio sessione if (isset($request["page"])) { switch ($request["page"]) { case "login": // la pagina di login e' accessibile a tutti, // la facciamo gestire al BaseController $controller = new BaseController(); $controller->handleInput($request); break; //cliente //cliente case 'cliente': // la pagina degli cliente e' accessibile solo al cliente // il controllo viene fatto dal controller apposito $controller = new ClienteController(); if (isset($_SESSION[BaseController::role]) && $_SESSION[BaseController::role] != User::Cliente) { self::write403(); } $controller->handleInput($request); break; //admin // docente //admin // docente case 'admin': // la pagina dell'admin e' accessibile solo all'admin // il controllo viene fatto dal controller apposito $controller = new AdminController(); if (isset($_SESSION[BaseController::role]) && $_SESSION[BaseController::role] != User::Admin) { self::write403(); } $controller->handleInput($request); break; default: self::write404(); break; } } else { self::write404(); } }
<?php require_once "Cliente.php"; require_once "ClienteController.php"; $cliente = new ClienteController(); $ordem = filter_input(INPUT_GET, 'ordem', FILTER_DEFAULT); if (!isset($ordem)) { $ordem = 'asc'; } require_once 'header.php'; ?> <div class="page-header"> <h1>Clientes</h1> </div> <?php $action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT); if ($action) { switch ($action) { case 'cliente/inexistente': echo '<div class="alert alert-warning" role="alert">Cliente inexistente!</div>'; break; } } ?> [<a href="index.php?ordem=<?php echo $ordem == 'asc' ? 'desc' : 'asc'; ?> ">Adicionar ordem <?php
<?php $PAGELEVEL = CLIENTE_EXCEL; $AUTH_redirectTo = $NOAU; pageClearence($PAGELEVEL, $AUTH_redirectTo); $path = '../'; $busca = ""; $criterio = ""; $clienteController = new ClienteController($path); require_once 'pagn.php'; $colname_idempresa = base64_decode($_SESSION['idempresa']); $busca['idempresa'] = $colname_idempresa; $criterio = ""; if (isset($_GET['busca']) && $_GET['busca'] !== "") { $busca['criterio'] = $_GET['busca']; $criterio = 'busqueda'; } else { $criterio = 'allId'; } $busca['maxRows_clientes'] = 20; $busca['pageNum_clientes'] = 0; if (isset($_GET['pageNum_clientes'])) { $busca['pageNum_clientes'] = $_GET['pageNum_clientes']; } $busca['startRow_clientes'] = $busca['pageNum_clientes'] * $busca['maxRows_clientes']; // Para exportar $row_cliente = $clienteController->execute($criterio, $busca); $row_cliente['cantidad']; $nm = "clientes"; if (isset($_GET['totalRows_clientes'])) { $totalRows_clientes = $_GET['totalRows_clientes'];
<?php require_once "Cliente.php"; require_once "ClienteController.php"; $cliente = new ClienteController(); $id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT); $obj = $cliente->buscaCliente($id); if (!$obj) { header("Location:index.php?action=cliente/inexistente"); } require_once 'header.php'; ?> <div class="page-header"> <h1><?php echo $obj->getNome(); ?> </h1> </div> <table class="table table-striped table-condensed"> <tr> <td>CPF</td> <td><?php echo $obj->getCpf(); ?> </td> </tr> <tr> <td>Endereço</td> <td><?php
<?php require_once '../Connections/face5.php'; require_once "../../Controller/ClienteController.php"; $clienteController = new ClienteController("../../"); session_start(); $PAGELEVEL = EMISION_MNL; $AUTH_redirectTo = $MENU; pageClearence($PAGELEVEL, $AUTH_redirectTo); $colname_idempresa = base64_decode($_SESSION['idempresa']); $q = strtolower($_GET["q"]); if (!$q) { return; } $resultadoClientes = $clienteController->execute("buscaPorNombre", array("nombre_like" => $q, "idempresa" => $colname_idempresa)); foreach ($resultadoClientes['respuesta'] as $cliente) { $cid = $cliente['cliente_id']; $cname = $cliente['nombre']; echo "{$cname}|{$cid}\n"; }
<?php $PAGELEVEL = CLIENTE_EDITAR; $AUTH_redirectTo = $NOAU; pageClearence($PAGELEVEL, $AUTH_redirectTo); $path = '../'; $clienteController = new ClienteController($path); $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if (isset($_POST["MM_update"]) && $_POST["MM_update"] == "form1") { $data = $_POST; $clienteController->execute('updateCliente', $data); $updateGoTo = "contenido.php?pr=clnt"; header(sprintf("Location: %s", $updateGoTo)); } $colname_idempresa = base64_decode($_SESSION['idempresa']); $colname_cliente = "0"; if (isset($_GET['c'])) { $colname_cliente = $_GET['c']; } $data['idcliente'] = $colname_cliente; $data['idempresa'] = $colname_idempresa; $cliente = $clienteController->execute('empresaCliente', $data); $row_cliente = $cliente['respuesta']; ?> <script type="text/javascript"> <!-- $().ready(function() { $("#form1").validate({
<?php $PAGELEVEL = CLIENTE_ADD; $AUTH_redirectTo = $NOAU; pageClearence($PAGELEVEL, $AUTH_redirectTo); $path = '../'; if (isset($_POST["MM_insert"]) && $_POST["MM_insert"] == "form1") { $data = $_POST; $data['idempresa'] = base64_decode($_SESSION['idempresa']); $clienteController = new ClienteController($path); $clienteController->execute('insert', $data); $insertGoTo = "contenido.php?pr=clnt"; header(sprintf("Location: %s", $insertGoTo)); } ?> <script type="text/javascript"> <!-- $().ready(function() { $("#form1").validate({ rules: { rfc: { required: true, minlength: 12 }, c_postal: { required: true, digits: true, minlength: 5, maxlength: 5 } },