Esempio n. 1
0
<?php

if (isset($_SESSION['tipoUsuario']) and $_SESSION['tipoUsuario'] == 1) {
    // Administrador
    $mensaje = '';
    $cen = new centro();
    $cen->consultaE('', 'centro');
    if (!isset($_POST['enviar'])) {
        $_POST['enviar'] = '';
    }
    if (!isset($_GET['accion'])) {
        $_GET['accion'] = '';
    }
    //	$nAn=$_SESSION['anno']+1;
    $nP = 0;
    $nI = 0;
    //	$nAn=$cen->annoUltimo()+1;
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        if ($_POST['enviar'] == 'Nuevo') {
            if (!$cen->existeCentro($_POST['centroHacia']) and $_POST['centroHacia'] != '') {
                $cen->nuevo('', $_POST['centroHacia']);
                $mensaje = 'Centro insertado';
            } else {
                $mensaje = 'Ya existe';
            }
        }
        $cen->consultaE('', 'centro');
    }
    if ($_SERVER['REQUEST_METHOD'] == "GET") {
        if ($_GET['accion'] == 'B') {
            //				if(!$cen->referenciaAnno($_GET['anno'])){
Esempio n. 2
0
<?php

if (isset($_SESSION['tipoUsuario']) and $_SESSION['tipoUsuario'] == 1) {
    // Administrador
    $mensaje = '';
    $tp = new centro();
    $tp->consultaE('', 'centro');
    if (!isset($_GET['accion'])) {
        $_GET['accion'] = '';
    }
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        if ($_POST['botonTipPro'] == 'Insertar centro') {
            if (!$tp->existeCentro($_POST['descripcionCentro'])) {
                $tp->nuevo('', $_POST['descripcionCentro']);
            } else {
                $mensaje = 'Centro ya existe';
            }
        }
        if ($_POST['botonCentro'] == 'Modificar tipo de proceso') {
            $tp->actualizar($_POST['codigoCentro'], $_POST['descripcionCentro']);
        }
        $tp->consultaE('', 'descripcion');
    }
    if ($_SERVER['REQUEST_METHOD'] == "GET") {
        if ($_GET['accion'] == 'B') {
            if (!$tp->referenciaCentro($_GET['codigoCentro'])) {
                $tp->borrar($_GET['codigoCentro']);
                $mensaje = 'Centro borrado';
            } else {
                $mensaje = 'El Centro no se puede borrar';
            }