示例#1
0
 public function init()
 {
     $user = Registry::getUser();
     if (!$user->id) {
         Url::redirect(Url::site("login"));
     }
 }
示例#2
0
 public function init()
 {
     $user = Registry::getUser();
     if (!$user->id) {
         Url::redirect(Url::site("login"));
     } elseif (!preg_match('/admin/', $user->username)) {
         Registry::addMessage("Sólo los administradores pueden gestionar la parrilla", "error");
         Url::redirect(Url::site("zG2sH0A7hwdnLNUUQaoU25cm"));
     }
 }
示例#3
0
 /**
  * Logout action
  */
 public function doLogout()
 {
     $user = Registry::getUser();
     if ($user->id) {
         //Logout
         $user->logout();
     }
     //Redirect to index
     Url::redirect();
 }
示例#4
0
 /**
  * Acciones previas a la creación.
  * @return void
  */
 public function preInsert($data = array())
 {
     $user = Registry::getUser();
     $this->userId = $user->id;
     $this->dateInsert = date("Y-m-d H:i:s");
     //Entrada
     $entrada = new Entrada($this->entradaId);
     //Order forced?
     if ($data["order"]) {
         $this->order = $data["order"];
     }
     //Default starting Hour
     $hora = $data["hora"] ? $data["hora"] : "07:00";
     //Tiene ED?
     if ($entrada->entradaIdEd && !$data["force"]) {
         $evento = new Evento();
         $evento->insert(array("fecha" => $data["fecha"], "hora" => $data["hora"], "entradaId" => $entrada->entradaIdEd, "order" => $data["order"], "force" => $data["force"]));
         //Avanzamos una posición
         if ($data["order"]) {
             $this->order++;
         }
     }
     //Movemos los posteriores
     if ($data["order"]) {
         $replaceEvent = self::getPreviousEvent($data["fecha"], $this->order);
         if ($replaceEvent->id) {
             self::moveElements($data["fecha"], $this->order, 1);
         }
     }
     //Datos entrada
     $this->tipo = $entrada->tipoId;
     $this->houseNumber = $entrada->houseNumber;
     $this->titulo = $entrada->nombre;
     $this->duracion = $entrada->duracion;
     $this->tcIn = $entrada->tcIn;
     $this->segmento = $entrada->segmento;
     $mosca = new Mosca($entrada->moscaId);
     $this->logo = $mosca->codigo;
     //Fechas / Orden
     //Si se ha mandado un orden, buscamos el evento anterior
     $order = $this->order ? $this->order - 1 : null;
     $previousEvent = self::getPreviousEvent($data["fecha"], $order);
     //Existe un evento anterior?
     if ($previousEvent->id) {
         //Si no hemos mandado orden, le asignamos el siguiente al evento anterior
         if (!$this->order) {
             $this->order = $previousEvent->order + 1;
         }
         //Inicio
         $this->fechaInicio = $previousEvent->fechaFin;
         //Fin
         $this->calcFechaFin();
         //Destruct hora
         $hora = null;
     } else {
         //Orden
         $this->order = 1;
         //Inicio
         $this->fechaInicio = $data["fecha"] . " " . $hora . ":00:00";
         //Fin
         $this->calcFechaFin();
     }
     if ($data["order"]) {
         self::actualizarFechas($data["fecha"], $hora);
     }
 }
示例#5
0
<?php

defined('_EXE') or die('Restricted access');
?>

<?php 
$currentUser = Registry::getUser();
?>

<?php 
//Toolbar
if ($user->id) {
    $subtitle = "Editar usuario";
    $title = "Guardar";
} else {
    $subtitle = "Nuevo usuario";
    $title = "Crear";
}
Toolbar::addTitle("Usuarios", "glyphicon-user", $subtitle);
if ($user->id) {
    //Delete button
    Toolbar::addButton(array("title" => "Eliminar", "app" => "users", "action" => "delete", "class" => "danger", "spanClass" => "remove", "confirmation" => "¿Deseas realmente eliminar este usuario?", "noAjax" => true));
}
//Cancel button
Toolbar::addButton(array("title" => "Cancelar", "link" => Url::site("users"), "class" => "primary", "spanClass" => "chevron-left"));
//Save button
Toolbar::addButton(array("title" => $title, "app" => "users", "action" => "save", "class" => "success", "spanClass" => "ok"));
Toolbar::render();
?>

<form method="post" name="mainForm" id="mainForm" action="<?php 
示例#6
0
<?php

defined('_EXE') or die('Restricted access');
?>

<div class="row">
    <div class="col-xs-offset-3 col-xs-6">
        <div class="well">
            <fieldset>
                <legend>
                    Login
                </legend>
                <?php 
$user = Registry::getUser();
?>
                <?php 
if (!$user->id) {
    ?>
                    <form class="form-horizontal ajax" role="form" method="post">
                        <!-- Username -->
                        <div class="form-group">
                            <label for="login" class="col-sm-4 control-label">
                                Email
                            </label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="login" name="login">
                            </div>
                        </div>
                        <!-- Password -->
                        <div class="form-group">
                            <label for="password" class="col-sm-4 control-label">