本文整理汇总了PHP中Floxim\Floxim\System\Fx::user方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::user方法的具体用法?PHP Fx::user怎么用?PHP Fx::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floxim\Floxim\System\Fx
的用法示例。
在下文中一共展示了Fx::user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: panelHtml
public static function panelHtml()
{
$data = array('main_menu' => self::getMainMenu(), 'more_menu' => self::getMoreMenu(), 'modes' => array("view" => array("name" => fx::alang("mode_view"), "key" => "view"), "edit" => array("name" => fx::alang("mode_edit"), "key" => "edit")), 'profile' => array('logout' => array('name' => fx::alang('Sign out', 'system'), 'href' => fx::user()->getLogoutUrl())), 'is_front' => $_SERVER['REQUEST_URI'] !== fx::config('path.admin'));
$res = fx::template('@admin:panel')->render($data);
return $res;
}
示例2: isAvailableForUser
/**
* Check if infoblock's scope.visibility allows the current user to see this block
* @return bool Is the block available
*/
public function isAvailableForUser()
{
$c_user = fx::user();
$ib_visibility = isset($this['scope']['visibility']) ? $this['scope']['visibility'] : null;
if (!$ib_visibility || $ib_visibility === 'all') {
return true;
}
if ($ib_visibility === 'nobody') {
return false;
}
if ($ib_visibility === 'admin' && !$c_user->isAdmin()) {
return false;
}
if ($ib_visibility === 'user' && $c_user->isGuest()) {
return false;
}
if ($ib_visibility === 'guest' && !$c_user->isGuest()) {
return false;
}
return true;
}
示例3: doFormCreate
public function doFormCreate()
{
$this->onFormReady(function ($e) {
unset($e['form']['fields']['is_published']);
unset($e['form']['fields']['avatar']);
unset($e['form']['fields']['is_admin']);
$e['form']['fields']['email']['required'] = true;
$e['form']['fields']['name']['required'] = true;
});
if ($this->getParam('force_login') && fx::user()->isGuest()) {
$this->onFormCompleted(function ($e) {
$form = $e['form'];
$user = $e['entity'];
$user->login($form->email, $form->password, true);
});
}
return parent::doFormCreate();
}