예제 #1
0
                <!--class="active" selecciona una celda o fila
                success, danger, warning le da color
                -->
                <tr class="success">
                    <th>Nombre del aviso</th>
                    <th>Descripción</th>
                    <th>Fecha</th>
                    <th>Hora</th>
                    <th>Categoría</th>
                    <th>Usuario</th>
                    <th></th>
                </tr>
                <?php 
//for
include '../DataAccess/AvisosDATA.php';
$avisoData = new AvisoData();
$array = $avisoData->getAvisos();
foreach ($array as $value) {
    echo '<tr>';
    echo '<td>' . $value->getNombreAviso() . '</td>';
    echo '<td>' . $value->getDescripcion() . '</td>';
    echo '<td>' . $value->getFecha() . '</td>';
    echo '<td>' . $value->getHora() . '</td>';
    echo '<td>' . $value->getCategoria() . '</td>';
    echo '<td>' . $value->getUser() . '</td>';
    echo '<td><a href="../AppNode/Avisos.php?modo=eliminarAviso&id=' . $value->getId() . '">Eliminar</a></td>';
    echo '</tr>';
}
?>

            </table>
예제 #2
0
if (!isset($_SESSION['usuario'])) {
    session_start();
    session_destroy();
    header('location: ../index.php?error=4');
}
//para determinar la accion
$modo = isset($_GET['modo']) ? $_GET['modo'] : 'default';
switch ($modo) {
    case 'registroAviso':
        if (empty($_POST['nombreAviso']) or empty($_POST['descripcionAviso']) or empty($_POST['categoriaAviso']) or empty($_POST['fechaAviso'])) {
            //redirecciona junto con un valor de error por urldescripcionAviso    or empty($_POST['categoriaAviso']) or empty($_POST['nombreAviso']) or empty($_POST['fechaAviso']) or empty($_POST['horaAviso']) or empty($_POST['descripcionAviso'])
            header('location: ../Vistas/agregarAviso.php?error=1');
        } else {
            $registroAviso = new AvisoData();
            $result = $registroAviso->agregarAviso($_SESSION['usuario'], $_POST['nombreAviso'], $_POST['descripcionAviso'], $_POST['categoriaAviso'], $_POST['fechaAviso'], $_POST['horaAviso']);
            header('location: ../Vistas/agregarAviso.php?result=' . $result . '');
        }
        break;
    case 'eliminarAviso':
        $eliminarAviso = new AvisoData();
        $result = $eliminarAviso->eliminarAviso($_GET['id']);
        header('location: ../Vistas/gestionarAvisos.php?result=' . $result . '');
        break;
    case 'eliminarAvisosViejos':
        $eliminarAviso = new AvisoData();
        $result = $eliminarAviso->eliminarAvisosViejos();
        header('location: ../Vistas/gestionarAvisos.php?result=' . $result . '');
        break;
    default:
        break;
}