本文整理汇总了PHP中Model\User::isLogged方法的典型用法代码示例。如果您正苦于以下问题:PHP User::isLogged方法的具体用法?PHP User::isLogged怎么用?PHP User::isLogged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model\User
的用法示例。
在下文中一共展示了User::isLogged方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionActivation
/**
* Activate user account.
*
* @access public
* @return View
* @since 1.0.0
* @version 1.1.0, 2015-02-12
*/
public function actionActivation()
{
// if user is logged, redirect to main page
if (UserModel::isLogged()) {
Route::factory('home')->redirectTo();
}
// set page title
$this->setTitle(__('Activate your new account'));
// get code from URL
$sCode = Router::getParam('code');
$bActivated = FALSE;
// get activation code from DB
$oResult = DB::query("SELECT c FROM \\Model\\User\\ActivationCode c WHERE c.code = :code")->param('code', $sCode)->single();
/* @var $oResult ActivationCodeModel */
// activate user
if ($oResult instanceof ActivationCodeModel) {
// Set user as activated
$bActivated = TRUE;
$oUser = $oResult->getUser();
$oUser->setActivation(TRUE);
DB::flush();
// Remove activation code from DB
DB::remove($oResult);
DB::flush();
}
// view
return View::factory("user/frontend/register/activation")->bind('bActivated', $bActivated);
}
示例2: __construct
/**
* Controller constructor.
*
* @access public
* @since 1.0.0, 2015-02-17
* @version 2.1.0-dev
*/
public function __construct()
{
parent::__construct();
// fill up breadcrumbs title and other
$this->addBreadCrumb(__('Password recovery'), Route::factory('password_recovery')->url());
$this->addToTitle(' - ' . __('Password recovery'));
// check if particular user is logged
if (User::isLogged()) {
$sRedirectURL = Route::factory('home')->url();
$sRedirectMsg = __('Cannot use password recovery system while being logged in!');
Session::flash($sRedirectURL, $sRedirectMsg, 'warning');
}
}
示例3: __construct
/**
* Constructor.
*
* @access public
* @since 1.0.0-alpha
* @version 1.0.0-alpha
*/
public function __construct()
{
# initialize theme
Theme::initBackend();
# call parent
parent::__construct();
if ($this->sModel !== NULL) {
$this->setModel(new $this->sModel());
}
if (!User::isLogged() || !\UserPermissions::hasPerm(static::PERM_ADMIN_ACCESS)) {
Route::factory('home')->redirectTo();
}
// set body classes
$this->addBodyClass('skin-red');
// add main breadcrumbs and title
$this->alterBreadcrumbsTitleMain();
// reset JavaScripts and CSS
$this->resetCss();
$this->resetJs();
// add CSS and JavaScript files
$this->addCss('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&subset=latin,latin-ext');
$this->addCss('https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
$this->addCss('https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css');
$this->addCssByTheme('/bootstrap/css/bootstrap.min.css');
$this->addCssByTheme('/css/backend.css');
$this->addJsByTheme('/plugins/jQuery/jQuery-2.1.4.min.js');
$this->addJsByTheme('/plugins/jQueryUI/jquery-ui.min.js');
$this->addJsByTheme('/bootstrap/js/bootstrap.min.js');
$this->addJsByTheme('/js/backend.js');
$this->addJsByTheme('/js/jquery.mjs.nestedSortable.js');
$this->addJsByTheme('/js/app.min.js');
$this->addJsByTheme('/js/backend_after_theme_load.js');
# add viewport
$this->addMetaTagRegular('viewport', 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no');
// generate menu
$menuView = $this->generateMenu();
$this->oViewBody->bind('menu', $menuView);
}
示例4: __
use Plethora\Route;
$loginLink = Helper\Link::factory();
$loginLink->getAttributes()->addToAttribute('class', 'btn btn-primary btn-lg');
?>
<div class="jumbotron">
<p style="font-size: 70px;"><?php
echo __('Hello!');
?>
</p>
<p><?php
echo __('Welcome on your new website!');
?>
</p>
<?php
if (\Model\User::isLogged()) {
?>
<p><?php
echo __('You are logged! Go and see whats in your management panel ;).');
?>
</p>
<p>
<?php
$backend = Helper\Link::factory();
$backend->getAttributes()->addToAttribute('class', 'btn btn-danger btn-lg');
echo $backend->code(__('go to management panel'), Route::factory('backend')->url());
?>
<?php
echo $loginLink->code(__('logout'), Route::factory('logout')->url());
?>
</p>
示例5: __construct
/**
* Constructor.
*
* @access public
* @since 1.0.0-alpha
* @version 1.0.0-alpha
*/
public function __construct()
{
// initialize theme
Theme::initBackend();
parent::__construct();
if ($this->sModel !== NULL) {
$this->setModel(new $this->sModel());
}
if (!User::isLogged() || !\UserPermissions::hasPerm(static::PERM_ADMIN_ACCESS)) {
Route::factory('home')->redirectTo();
}
//
// // add main breadcrumbs and title
// $this->alterBreadcrumbsTitleMain();
//
// // add CSS and JavaScript files
// $this->addCss('/themes/_common/packages/bootstrap/css/bootstrap.min.css');
// $this->addCss('/themes/_common/packages/bootstrap/css/bootstrap-sticky-footer-navbar.css');
// $this->addJs('/themes/_common/js/jquery-2.1.3.min.js');
// $this->addJs('/themes/_common/js/jquery-ui.min.js');
// $this->addJs('/themes/_common/packages/bootstrap/js/bootstrap.min.js');
// $this->addJs('/themes/_common/js/global/framework.js');
//
// $this->addCssByTheme('/css/backend.css');
// $this->addJsByTheme('/js/jquery.mjs.nestedSortable.js');
// $this->addJsByTheme('/js/backend.js');
}
示例6: actionChangePassword
/**
* ACTION - Change user password.
*
* @access public
* @return View
* @since 1.3.0, 2015-01-27
* @version 1.0.2-dev, 2015-03-02
*/
public function actionChangePassword()
{
if (!Model\User::isLogged()) {
Router::relocateToRoute('home');
}
// get user
$oUser = Model\User::getLoggedUser();
/* create form instance */
$oModelFormConfig = ModelFormConfig::factory()->setFieldsRestriction(['password'])->setMessage(__('Password changed successfully.'));
$oModelForm = $oUser->form('user_profile', $oModelFormConfig);
$oForm = $oModelForm->generate();
// add local actions
Router\LocalActions::addLocalAction(__('View profile'), 'user_password_change', 'user_profile')->setParameters(['id' => $oUser->getId()]);
Router\LocalActions::addLocalAction(__('Edit profile'), 'user_password_change', 'user_profile_edit');
// return profile modification form
return View::factory('base/form')->bind('oForm', $oForm);
}