Ejemplo n.º 1
0
                                        <td>
                                                <textarea name="texto" id="texto" cols="40" rows="4"></textarea>
                                        </td>
                                </tr>
                                <tr>
                                        <td>Imagen:</td>
                                        <td>
                                                <input type="file" name="imagen" size="25"/>
                                        </td>
                                </tr>
                                <tr>
                                        <td>Tipo:</td>
                                        <td>
                                                <select name="tipo">
<?php 
foreach (UIFacade::enum_values('tipo de contenido') as $v) {
    ?>
                                                        <option value="<?php 
    echo $v;
    ?>
"><?php 
    echo mb_ucfirst($v, 'utf-8');
    ?>
</option>
<?php 
}
?>
                                                </select>
                                        </td>
                                </tr>
                                <tr>
Ejemplo n.º 2
0
    <p><input name="nombre completo" type="text"/></p>
    <p>Nombre corto:</p>
    <p><input name="nombre corto" type="text"/></p>
    <p>Siglas:</p>
    <p><input name="siglas" type="text"/></p>
    <p>Año de fundación:</p>
    <p><?php 
$y = date('Y');
echo select_opts('año de fundación', range($y, $y - 150), $y, '%d');
?>
</p>
    <p>Ciudad:</p>
    <p><input name="ciudad" type="text"/></p>
    <p>Estado:</p>
    <p><input name="estado" type="text"/></p>
    <p>Estadio principal:</p>
    <p><?php 
echo select_objs('estadio principal', UIFacade::retrieveAll('Estadio'), 'id', 'nombre');
?>
</p>
    <p>Logo:</p>
    <p><input name="imagen" type="file"/></p>
    <p>Precio: </p>
    <p><input name="precio" type="text"/></p>

    <input type="hidden" name="goto" value="equipos"/>
    <button type="submit" name="action" value="equipo_insert">Agregar</button>
  </form>
</div>
<?php 
require 'include/post.html';
Ejemplo n.º 3
0
}
?>
<div id="search">
  <form method="get" action="index">
    <p>
      <input type="text" name="q" value="<?php 
echo $q;
?>
"/>
      <button type="submit">Buscar</button>
    </p>
  </form>
</div>
<div id="else">
<?php 
foreach (UIFacade::contenidos('noticia', $q) as $c) {
    $id = $c->get('id');
    $tags = $c->get('tags');
    $img = $c->get('URL de imagen');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/contenido/' . $img;
    }
    ?>
  <div>

<?php 
    if (has_auth('admin')) {
        ?>
    <div class="admin-options">
      <form action="controller" method="post">
        <p><input type="hidden" name="id" value="<?php 
Ejemplo n.º 4
0
<?php

require 'include/pre.php';
?>
<h2>Usuarios</h2>
<?php 
if (has_auth('user') && array_key_exists('id', $_GET)) {
    $id = $_GET['id'];
    $u = UIFacade::select('Usuario', array('id' => $id));
    $e = $u->get('dirección de e-mail');
    $img = $u->get('URL del avatar') or $img = 'generico.jpg';
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/usuario/' . $img;
    }
    $ls = UIFacade::usuario_ligas_invitables($id);
    ?>
<img src="<?php 
    echo $img;
    ?>
"/>
<p>Nombre de usuario:   <?php 
    echo $u->get('username');
    ?>
</p>
<p>Nombre completo:     <?php 
    echo $u->get('nombre completo');
    ?>
</p>

<?php 
    if ($u->get('género')) {
Ejemplo n.º 5
0
  <button type="submit">Agregar contenido</button>
</form>
<?php 
}
?>
<div id="search">
  <form method="get" action="reglas">
    <input type="text" name="q" value="<?php 
echo $q;
?>
"/>
    <button type="submit">Buscar</button>
  </form>
</div>
<?php 
foreach (UIFacade::contenidos('regla', $q) as $c) {
    $id = $c->get('id');
    $tags = $c->get('tags');
    $img = $c->get('URL de imagen');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/contenido/' . $img;
    }
    ?>
<div>

<?php 
    if (has_auth('admin')) {
        ?>
  <div class="admin-options">
    <form action="controller" method="post">
      <input type="hidden" name="id" value="<?php 
Ejemplo n.º 6
0
 public static function calendario($search_opt, $search_query)
 {
     $search_opts = array('fecha' => array('juego' => array('inicio')), 'estadio' => array('estadio' => array('nombre')), 'equipo' => array('equipo local' => array('nombre completo', 'siglas', 'ciudad', 'estado'), 'equipo visitante' => array('nombre completo', 'siglas', 'ciudad', 'estado')), 'local' => array('equipo local' => array('nombre completo', 'siglas', 'ciudad', 'estado')), 'visitante' => array('equipo visitante' => array('nombre completo', 'siglas', 'ciudad', 'estado')), 'todos' => array('juego' => array('inicio'), 'estadio' => array('nombre'), 'equipo local' => array('nombre completo', 'siglas', 'ciudad', 'estado'), 'equipo visitante' => array('nombre completo', 'siglas', 'ciudad', 'estado')));
     return array_reduce(self::retrieveAll('Juego'), function ($acc, $j) use($search_opts, $search_opt, $search_query) {
         $new = array('juego' => $j, 'equipo local' => UIFacade::select('Equipo', array('id' => $j->get('equipo local'))), 'equipo visitante' => UIFacade::select('Equipo', array('id' => $j->get('equipo visitante'))), 'estadio' => UIFacade::select('Estadio', array('id' => $j->get('estadio'))));
         if (!array_key_exists($search_opt, $search_opts)) {
             $acc[] = $new;
         } else {
             foreach ($search_opts[$search_opt] as $obj => $fs) {
                 foreach ($fs as $f) {
                     if (stristr($new[$obj]->get($f), $search_query)) {
                         $acc[] = $new;
                         break 2;
                     }
                 }
             }
         }
         return $acc;
     }, array());
 }
Ejemplo n.º 7
0
<?php

require 'include/pre.php';
if (has_auth('user') and array_key_exists('id', $_GET)) {
    $l = UIFacade::select('Liga', array('id' => $_GET['id']));
    if (has_auth('admin') || $l->get('creador') == userdata()->get('id')) {
        $s = ' selected="selected"';
        $p = $l->get('es pública') == 't';
        ?>
<h2>Modificar liga</h2>
<form action="controller" method="post">
  <p>Nombre: <input type="text" name="nombre" value="<?php 
        echo $l->get('nombre');
        ?>
"/></p>
<?php 
        if (has_auth('admin')) {
            ?>
  <p>
    Tipo:
    <select name="es pública">
      <option value="t"<?php 
            if ($p) {
                echo $s;
            }
            ?>
>Pública</option>
      <option value="f"<?php 
            if (!$p) {
                echo $s;
            }
Ejemplo n.º 8
0
    echo $e->get('nombre completo');
    ?>
</p>
  <p><strong>Nombre corto:                   </strong> <?php 
    echo $e->get('nombre corto');
    ?>
</p>
  <p><strong>Siglas:                         </strong> <?php 
    echo $e->get('siglas');
    ?>
</p>
  <p><strong>Año de fundación:               </strong> <?php 
    echo $e->get('año de fundación');
    ?>
</p>
  <p><strong>Ciudad:                         </strong> <?php 
    echo $e->get('ciudad');
    ?>
</p>
  <p><strong>Estado:                         </strong> <?php 
    echo $e->get('estado');
    ?>
</p>
  <p><strong>Estadio principal:              </strong> <?php 
    echo UIFacade::select('Estadio', array('id' => $e->get('estadio principal')))->get('nombre');
    ?>
</p>
</div>
<?php 
}
require 'include/post.html';
Ejemplo n.º 9
0
        $img = 'static/images/equipo/' . $img;
    }
    $Aux['P'] = '<a class="irAP"><img src="' . $img . '"  width="50" height="50" /></a>';
} else {
    $Aux['P'] = '<a class="irAP"><img src="assets/images/Fotos_Roster/EquipoDefault.jpg"  width="50" height="50" /></a>';
}
$i = 0;
$D = '';
foreach ($Jugadores_Roster as $J_R) {
    // MARK
    $img = $J_R->get('URL de la foto');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/jugador/' . $img;
    }
    // FIXME: img url assets static etc
    $Tmp = UIFacade::select('Jugador', array('id' => $J_R->get('jugador')));
    $D .= '
        <div class="a' . $J_R->get('posición') . '">
                <div id="imgjugador">
                <img src="' . $img . '" height="100" width="70" />
                </div>
                <table width="240" align="left">
                        <tr class="impar">
                                <td><p>Nombre:</p></td>
                                <td><p>' . $Tmp->get('nombre completo') . '</p></td>
                        </tr>
                        <tr class="par">
                                <td><p>Posicion:</p></td>
                                <td><p>' . $J_R->get('posición') . '</p></td>
                        </tr>
                        <tr class="impar">
Ejemplo n.º 10
0
<table width="100%" border="0" cellspacing="5" cellpadding="5">
  <tr>
    <th            >Fecha           </th>
    <th colspan="2">Equipo local    </th>
    <th colspan="2">Equipo visitante</th>
    <th            >Estadio         </th>
<?php 
if (has_auth('admin')) {
    ?>
    <th            >                </th>
<?php 
}
?>
  </tr>
<?php 
foreach (UIFacade::calendario($search, $q) as $c) {
    $date = strtotime($c['juego']->get('inicio'));
    $id = $c['juego']->get('id');
    $img_local = $c['equipo local']->get('URL del logo');
    $img_visitante = $c['equipo visitante']->get('URL del logo');
    if ($img_local and !filter_var($img_local, FILTER_VALIDATE_URL)) {
        $img_local = 'static/images/equipo/' . $img_local;
    }
    if ($img_visitante and !filter_var($img_visitante, FILTER_VALIDATE_URL)) {
        $img_visitante = 'static/images/equipo/' . $img_visitante;
    }
    ?>
  <tr>
    <td><?php 
    echo date('d/m/Y', $date);
    ?>
Ejemplo n.º 11
0
function userclass()
{
    global $user_class;
    return $user_class;
}
global $user_data;
function userdata()
{
    global $user_data;
    return $user_data;
}
function has_auth($auth, $userclass = null)
{
    if ($userclass === null) {
        $userclass = userclass();
    }
    return $userclass == $auth or $userclass == 'user' and in_array($auth, array('guest')) or $userclass == 'admin' and in_array($auth, array('guest', 'user'));
    // un admin es también un guest y un user
}
session_start();
$user_class = array_key_exists('user_class', $_SESSION) ? $_SESSION['user_class'] : 'guest';
// FIXME: esto es super inseguro
if (!in_array(userclass(), array('user', 'admin', 'guest'))) {
    die('Invalid session.');
}
require 'include/dbconn/' . userclass() . '.php';
$user_data = null;
if (userclass() != 'guest') {
    $user_data = UIFacade::select('Usuario', array('id' => $_SESSION['user']));
    // FIXME: esto es super inseguro
}
Ejemplo n.º 12
0
<?php

require 'include/pre.php';
if (has_auth('user') and array_key_exists('id', $_GET)) {
    $d = UIFacade::liga_detail($_GET['id']);
    $uid = userdata()->get('id');
    $see = $d['liga']->get('es pública') || has_auth('admin');
    if (!$see) {
        foreach ($d['participantes'] as $p) {
            if ($p->get('id') == $uid) {
                $see = true;
                break;
            }
        }
    }
    if ($see) {
        $own = has_auth('admin') || $d['creador']->get('id') == $uid;
        $c_img = $d['creador']->get('URL del avatar') or $c_img = 'generico.jpg';
        if ($c_img and !filter_var($c_img, FILTER_VALIDATE_URL)) {
            $c_img = 'static/images/usuario/' . $c_img;
        }
        ?>
<h2>Liga <?php 
        echo ($d['liga']->get('es pública') == 't' ? 'pública ' : 'privada ') . $d['liga']->get('nombre');
        ?>
</h2>
<div style="border: 1em">
  <img src="<?php 
        echo $c_img;
        ?>
" style="float: left; clear: both"/>
Ejemplo n.º 13
0
<?php

if (array_key_exists('action', $_POST) and array_key_exists('username', $_POST) and array_key_exists('password', $_POST) and array_key_exists('password2', $_POST) and array_key_exists('nombre_completo', $_POST) and array_key_exists('dirección_de_e-mail', $_POST) and $_POST['action'] == 'register') {
    require 'include/config.php';
    require 'include/dbconn/auth.php';
    require 'include/UIFacade.php';
    session_start();
    $fecha = null;
    if (array_key_exists('year', $_POST) and array_key_exists('month', $_POST) and array_key_exists('day', $_POST)) {
        $fecha = sprintf('%s-%s-%s', $_POST['year'], $_POST['month'], $_POST['day']);
    }
    $password = $_POST['password'];
    if ($password != '' and $password == $_POST['password2'] and $_POST['username'] != '') {
        $u = UIFacade::register($_POST['username'], $_POST['nombre_completo'], $_POST['dirección_de_e-mail'], 'f', $password);
        echo '<pre>';
        if ($u) {
            $_SESSION['user'] = $u->get('id');
            $_SESSION['user_class'] = $u->get('es administrador') == 't' ? 'admin' : 'user';
            if (array_key_exists('URL_del_avatar', $_POST)) {
                $u->set('URL del avatar', $_POST['URL_del_avatar']);
            }
            if (array_key_exists('género', $_POST)) {
                $u->set('género', $_POST['género']);
            }
            if ($fecha) {
                $u->set('fecha de nacimiento', $fecha);
            }
            $u->update();
        } else {
            session_destroy();
        }
Ejemplo n.º 14
0
<?php

if (array_key_exists('action', $_POST) and array_key_exists('username', $_POST) and array_key_exists('password', $_POST) and $_POST['action'] == 'login') {
    require 'include/config.php';
    require 'include/dbconn/auth.php';
    require 'include/UIFacade.php';
    session_start();
    $u = UIFacade::auth($_POST['username'], $_POST['password']);
    if ($u) {
        $_SESSION['user'] = $u->get('id');
        $_SESSION['user_class'] = $u->get('es administrador') == 't' ? 'admin' : 'user';
    } else {
        session_destroy();
    }
}
header('Location: index');
Ejemplo n.º 15
0
<?php

require 'include/pre.php';
?>
<h2>Equipos</h2>
<?php 
if (has_auth('admin')) {
    ?>
<form id="form" action="equipo_insert.php" method="get">
  <button type="submit">Agregar equipo</button>
</form>
<?php 
}
foreach (UIFacade::retrieveAll('Equipo') as $e) {
    $img = $e->get('URL del logo') or $img = 'generico.jpg';
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/equipo/' . $img;
    }
    ?>
<div>
  <img src="<?php 
    echo $img;
    ?>
"/>
  <br/>
  <h3>
    <?php 
    echo $e->get('nombre completo');
    ?>
 (<?php 
    echo $e->get('siglas');
Ejemplo n.º 16
0
    return $r . "</select>";
}
?>
<h2>Nuevo usuario</h2>
<form action="register" method="post">
  <p>Nombre de usuario:  <input type="text"     name="username"           /></p>
  <p>Contraseña:         <input type="password" name="password"           /></p>
  <p>Repetir contraseña: <input type="password" name="password2"          /></p>
  <p>Nombre completo:    <input type="text"     name="nombre completo"    /></p>
  <p>Correo electrónico: <input type="text"     name="dirección de e-mail"/></p>
  <p>URL del avatar:     <input type="text"     name="URL del avatar"     /></p>
  <p>
    Género:
      <select name="género">
<?php 
foreach (UIFacade::enum_values('género') as $v) {
    ?>
        <option value="<?php 
    echo $v;
    ?>
"><?php 
    echo mb_ucfirst($v, 'utf-8');
    ?>
</option>
<?php 
}
?>
      </select>
  </p>
  <p>
    <?php 
Ejemplo n.º 17
0
  <button type="submit">Agregar contenido</button>
</form>
<?php 
}
?>
<div id="search">
  <form method="get" action="reglas">
    <input type="text" name="q" value="<?php 
echo $q;
?>
"/>
    <button type="submit">Buscar</button>
  </form>
</div>
<?php 
foreach (UIFacade::contenidos('información', $q) as $c) {
    $id = $c->get('id');
    $tags = $c->get('tags');
    $img = $c->get('URL de imagen');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/contenido/' . $img;
    }
    ?>
<div>

<?php 
    if (has_auth('admin')) {
        ?>
  <div class="admin-options">
    <form action="controller" method="post">
      <input type="hidden" name="id" value="<?php 
Ejemplo n.º 18
0
<?php

require 'include/pre.php';
if (has_auth('user')) {
    $admin = has_auth('admin');
    $uid = userdata()->get('id');
    ?>
<h2>Ligas</h2>
<p>Ver todas | <a href="ligas_publicas">públicas</a> | <a href="ligas_privadas">privadas</a></p>
<form action="liga_insert">
  <button type="submit">Crear liga</button>
</form>
<?php 
    foreach (UIFacade::ligas() as $l) {
        if (!$admin && $l['liga']->get('es pública') == 'f' && $uid != $l['creador']->get('id') && !in_array($uid, array_map(function ($p) {
            return $p->get('id');
        }, $l['participantes']))) {
            continue;
        }
        $id = $l['liga']->get('id');
        $img = $l['creador']->get('URL de la foto');
        if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
            $img = 'static/images/usuario/' . $img;
        }
        ?>
<div>
  <h3><?php 
        echo $l['liga']->get('nombre');
        ?>
</h3>
  <img class="imagen" src="<?php 
Ejemplo n.º 19
0
<?php

require 'include/pre.php';
?>
<h2>Usuarios</h2>
<?php 
if (has_auth('user')) {
    foreach (UIFacade::retrieveAll('Usuario') as $u) {
        $img = $u->get('URL del avatar') or $img = 'generico.jpg';
        if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
            $img = 'static/images/usuario/' . $img;
        }
        ?>
<div style="border: 1em">
  <form action="usuario_detail" method="get">
    <input type="hidden" name="id" value="<?php 
        echo $u->get('id');
        ?>
"/>
    <img src="<?php 
        echo $img;
        ?>
" style="float: left; clear: both"/>
    <p>Usuario: <?php 
        echo $u->get('username');
        ?>
</p>
    <p>Nombre:  <?php 
        echo $u->get('nombre completo');
        ?>
</p>
Ejemplo n.º 20
0
<?php

require 'include/pre.php';
?>
<h2>Jugadores</h2>
<?php 
if (has_auth('admin')) {
    ?>
<form id="form" action="jugador_insert" method="post">
        <input type="submit" value="Agregar jugador"/>
</form>
<?php 
}
foreach (UIFacade::jugadores() as $j) {
    $img = $j['jugador']->get('URL de la foto');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/jugador/' . $img;
    }
    ?>
        <div>
        <form class="Fila" action="Datos_J.php" method="post">
                <input type="hidden" name="id" value="<?php 
    echo $j['jugador']->get('id');
    ?>
"/>
                <h3><?php 
    echo $j['jugador']->get('nombre completo');
    ?>
</h3>
                <br/>
                <img class="imagen" src="<?php 
Ejemplo n.º 21
0
require 'include/pre.php';
function select_opts($name, $range, $now, $format, $print_empty)
{
    $r = '<select name="' . $name . '">';
    if ($print_empty) {
        $r .= '<option value=""></option>';
    }
    foreach ($range as $i) {
        $r .= sprintf('<option value="' . $format . '"%s>' . $format . '</option>', $i, $i === $now ? ' selected="selected"' : '', $i);
    }
    return $r . "</select>";
}
if (has_auth('admin') && array_key_exists('id', $_GET)) {
    $j = UIFacade::select('Juego', array('id' => $_GET['id']));
    $equipos = UIFacade::retrieveAll('Equipo');
    $estadios = UIFacade::retrieveAll('Estadio');
    ?>
<div id="contenido_interno" style="height: auto">
  <div>
    <form action="controller" method="post">
      <input type="hidden" name="goto" value="calendario"/>
      <table width="100%" border="0" cellspacing="5" cellpadding="5" align="left">
        <tr>
          <th style="border: 2px solid #cccccc">
            Agregar juego
          </th>
        </tr>
        <tr>
          <td style="border: 1px solid #cccccc">
            Introduzca la fecha y hora de inicio:
            <input type="text" name="inicio" value="<?php 
Ejemplo n.º 22
0
function remove_by_pk($entity_class)
{
    UIFacade::remove($entity_class, set_pk($entity_class));
}
Ejemplo n.º 23
0
  <button type="submit">Agregar contenido</button>
</form>
<?php 
}
?>
<div id="search">
  <form method="get" action="reglas">
    <input type="text" name="q" value="<?php 
echo $q;
?>
"/>
    <button type="submit">Buscar</button>
  </form>
</div>
<?php 
foreach (UIFacade::contenidos('pregunta frecuente', $q) as $c) {
    $id = $c->get('id');
    $tags = $c->get('tags');
    $img = $c->get('URL de imagen');
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/contenido/' . $img;
    }
    ?>

<div>

<?php 
    if (has_auth('admin')) {
        ?>
  <div class="admin-options">
    <form action="controller" method="post">
Ejemplo n.º 24
0
<?php

require 'include/pre.php';
?>
<h2>Estadios</h2>
<?php 
if (has_auth('admin')) {
    ?>
<form action="estadio_insert" method="get">
  <button type="submit">Agregar Estadio</button>
</form>
<?php 
}
$show = array('ciudad', 'estado', 'capacidad', 'año de fundación', 'tipo de terreno', 'propietario', 'medida del left field', 'medida del center field', 'medida del right field', 'descripción');
foreach (UIFacade::retrieveAll('Estadio') as $s) {
    $img = $s->get('URL de la foto') or $img = 'generico.jpg';
    if ($img and !filter_var($img, FILTER_VALIDATE_URL)) {
        $img = 'static/images/estadio/' . $img;
    }
    ?>
<div>
  <h3><?php 
    echo $s->get('nombre');
    ?>
</h3>
  <br/>
  <img src="<?php 
    echo $img;
    ?>
"/>
<?php