if ($e->getCantidad() <= $totalGo) {
            $estado = 3;
        }
    } else {
        if ($estado == 2) {
            //Actualizo tambien el primer suplente y lo paso a los titulares
            //Guardo el id, la fecha y el flag Jug/Guest del primer suplente disponible
            $alt = $e->firstALternate();
            //Si hay algun suplente
            if ($alt) {
                if ($alt[2] == 'j') {
                    //Si es un jugador de AEE
                    //Creo un jugador
                    $alternate = new jugador();
                } else {
                    if ($alt[2] == 'g') {
                        //Si es un invitado
                        //Creo un invitado
                        $alternate = new Invitado();
                    }
                }
                //Le asigno el primer suplente
                $alternate->xId($alt[0]);
                $alternate->updateStatusEvent(1, $evento);
            }
        }
    }
    $j = new jugador();
    $j->xId($jugador);
    $j->updateStatusEvent($estado, $evento);
}
Пример #2
0
        array_push($dontGo, $jug);
    }
    //Recorro los que no saben si van
    for ($i = 0; $i < count($aux3); $i++) {
        $j->xId($aux3[$i]);
        $jug = array($j->getId(), $j->getNombre() . " " . $j->getApellido());
        array_push($dontKnow, $jug);
    }
    //Recorro los invitados titulares
    for ($i = 0; $i < count($aux4); $i++) {
        $g = new Invitado();
        $g->xId($aux4[$i]);
        $guest = array($g->getId(), $g->getNombre());
        array_push($go, $guest);
    }
    //Recorro los jugadores Suplentes
    for ($i = 0; $i < count($aux5); $i++) {
        $j->xId($aux5[$i]);
        $jug = array($j->getId(), $j->getNombre() . " " . $j->getApellido());
        array_push($alternates, $jug);
    }
    //Recorro los invitados suplentes
    for ($i = 0; $i < count($aux6); $i++) {
        $g = new Invitado();
        $g->xId($aux6[$i]);
        $guest = array($g->getId(), $g->getNombre());
        array_push($alternates, $guest);
    }
    //Traigo la vista
    include_once "../view/viewEvent.php";
}
Пример #3
0
include_once "../functions.php";
$checkArray = array('nombre', 'idE');
if (checkAllPost($checkArray)) {
    include_once "../classes/invitado.php";
    include_once "../classes/evento.php";
    $db = new Database();
    $nombre = $db->checkInjection($_POST['nombre']);
    $idE = $db->checkInjection($_POST['idE']);
    //Creo un evento
    $e = new Evento();
    $e->xId($idE);
    //Total de personas que asistiran al evento
    $totalGo = $e->numPlayersGo() + $e->numGuestsGo();
    if ($e->getCantidad() <= $totalGo) {
        //Pongo estado 3 que es que ira como suplente del evento porque ya no hay cupo
        $estado = 3;
    } else {
        //Pongo estado 1 que es que asistira al evento
        $estado = 1;
    }
    //Creo un invitado
    $i = new Invitado();
    $i->setEvento($idE);
    $i->setNombre($nombre);
    $i->setAsistencia($estado);
    if ($i->objectToDb()) {
        return 1;
    } else {
        return 0;
    }
}