$displayList = true;
// Solo si esta autenticado puede EDITAR/ELIMINAR/INSERTAR
$eventAccess = ( $user_auth &&
( $user_level <= -1 || ( isset( $idg ) && $user_idg == $idg ) )
);
if ( $eventAccess )
{
//echo "
SI ESTAS AUTENTICADO
";
if ( isset( $del ) )
{
@mysql_query( "DELETE FROM eventos WHERE id=$del", $conexion );
}
if ( isset( $sins ) )
{
displayFORM( "./?dgo=eventos.php&ins=new&idg=$idg", $datos, $conexion );
$displayList = false;
}
if ( isset( $ins ) )
{
$FIELDS = "idg, FAlta, FEvento, HEvento, Lugar, Titulo, Notas";
$FVALUES = "$idg, NOW(), '$db_FEvento', '$db_HEvento', '$db_Lugar', '$db_Titulo', '".urlencode($db_Notas)."'";
@mysql_query( "INSERT INTO eventos ($FIELDS) VALUES ($FVALUES)", $conexion );
}
if ( isset( $smod ) )
{
$res = @mysql_query( "SELECT FEvento, HEvento, Lugar, Titulo, Notas FROM eventos WHERE id = $smod", $conexion );
$datos = @mysql_fetch_array( $res );
displayFORM( "./?dgo=eventos.php&mod=$smod&idg=$idg", $datos, $conexion );
$displayList = false;
}
if ( isset( $mod ) )
{
@mysql_query("UPDATE eventos SET FEvento='$db_FEvento', HEvento='HEvento', Lugar='$db_Lugar', Titulo='$db_Titulo', Notas='".urlencode($db_Notas)."' WHERE id=$mod", $conexion );
}
}
if ( isset( $view ) )
{
$res = @mysql_query( "SELECT FEvento, HEvento, Lugar, Titulo, Notas FROM eventos WHERE id = $view", $conexion );
$datos = @mysql_fetch_array( $res );
displayFORM( "", $datos, $conexion );
$displayList = true;
}
if ( $displayList )
displayListEvnt();
function displayFORM( $ACTION, $datos, $conexion )
{
list( $db_FEvento, $db_HEvento, $db_Lugar, $db_Titulo, $db_Notas ) = $datos;
echo '
Eventos del Grupo
';
echo '';
if ( !empty($ACTION) )
echo '';
echo '';
}
function displayListEvnt( )
{
global $conexion, $idg, $eventAccess;
$res = @mysql_query( "SELECT id, FEvento, HEvento, Titulo FROM eventos WHERE idg=$idg", $conexion );
echo 'Fecha y Hora | Descripción del evento | |
';
echo ' | | |
';
while( $datos=@mysql_fetch_array($res) )
{
list ( $db_id, $db_FEvento, $db_HEvento, $db_Titulo )= $datos;
echo "$db_FEvento $db_HEvento | $db_Titulo | ";
echo "[ - ] |
";
}
echo '
';
if ( $eventAccess )
echo 'Nuevo Evento';
}
?>