本文整理汇总了PHP中Registry::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::getUser方法的具体用法?PHP Registry::getUser怎么用?PHP Registry::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::getUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$user = Registry::getUser();
if (!$user->id) {
Url::redirect(Url::site("login"));
}
}
示例2: init
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: doLogout
/**
* Logout action
*/
public function doLogout()
{
$user = Registry::getUser();
if ($user->id) {
//Logout
$user->logout();
}
//Redirect to index
Url::redirect();
}
示例4: preInsert
/**
* 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: defined
<?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: defined
<?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">