Example #1
0
<?php

session_start();
if (isset($_SESSION['registrado'])) {
    require_once "clases/AccesoDatos.php";
    require_once "clases/cd.php";
    $arrayDeCds = votacion::TraerTodoLosCds();
    echo "<h2> Bienvenido: " . $_SESSION['registrado'] . "</h2>";
    ?>
<table class="table"  style=" background-color: beige;">
	<thead>
		<tr>
			<th>Editar</th><th>Borrar</th><th>Provincia</th><th>Sexo</th><th>Presidente</th><th>Dni</th><th>Localidad</th><th>Domicilio</th>
		</tr>
	</thead>
	<tbody>

		<?php 
    foreach ($arrayDeCds as $cd) {
        echo "<tr>\n\t\t\t<td><a onclick='EditarCD({$cd->id})' class='btn btn-warning'> <span class='glyphicon glyphicon-pencil'>&nbsp;</span>Editar</a></td>\n\t\t\t<td><a onclick='BorrarCD({$cd->id})' class='btn btn-danger'>   <span class='glyphicon glyphicon-trash'>&nbsp;</span>  Borrar</a></td>\n\t\t\t<td><a onclick=" . '"VerEnMapa(' . "'{$cd->provincia}','{$cd->domicilio}','{$cd->localidad}',{$cd->id})" . '"' . " class='btn btn-danger'>   <span class='glyphicon glyphicon-trash'>&nbsp;</span>  Ver en mapa</a></td>\n\t\t\t<td>{$cd->provincia}</td>\n\t\t\t<td>{$cd->sexo}</td>\n\t\t\t<td>{$cd->presidente}</td>\n\t\t\t<td>{$cd->dni}</td>\n\t\t\t<td>{$cd->localidad}</td>\n\t\t\t<td>{$cd->domicilio}</td>\n\t\t</tr>   ";
    }
    ?>
	</tbody>
</table>

<?php 
} else {
    echo "<h4 class='widgettitle'>No estas registrado</h4>";
}
Example #2
0
     include "partes/formLogin.php";
     break;
 case 'MostrarFormAlta':
     include "partes/formCd.php";
     break;
 case 'VerEnMapa':
     include "partes/formMapaGoogle.php";
     break;
 case 'BorrarCD':
     $cd = new votacion();
     $cd->id = $_POST['id'];
     $cantidad = $cd->BorrarCd();
     echo $cantidad;
     break;
 case 'Guardar':
     $votacion = new votacion();
     session_start();
     if (!isset($_POST['id'])) {
         $votacion->id = $_POST['id'];
         $votacion->provincia = $_POST['provincia'];
         $votacion->dni = $_SESSION['editar'];
         $votacion->sexo = $_POST['sexo'];
         $votacion->presidente = $_POST['presidente'];
         $votacion->domicilio = $_POST['domicilio'];
         $votacion->localidad = $_POST['localidad'];
         $contador = $votacion->insertar();
     } else {
         $votacion->provincia = $_POST['provincia'];
         $votacion->dni = $_SESSION['registrado'];
         $votacion->sexo = $_POST['sexo'];
         $votacion->presidente = $_POST['presidente'];