本文整理汇总了PHP中Pimcore\Model\User::getLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getLanguage方法的具体用法?PHP User::getLanguage怎么用?PHP User::getLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\User
的用法示例。
在下文中一共展示了User::getLanguage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUser
/**
* @param Model\User $user
* @return $this
*/
public function setUser(Model\User $user)
{
$this->user = $user;
\Zend_Registry::set("pimcore_admin_user", $this->user);
$this->setLanguage($this->user->getLanguage());
return $this;
}
示例2: setUser
/**
* @param Model\User $user
* @return $this
*/
public function setUser(Model\User $user)
{
$this->user = $user;
\Zend_Registry::set("pimcore_admin_user", $this->user);
$this->setLanguage($this->user->getLanguage());
// update perspective settings
$requestedPerspective = $this->getParam("perspective");
if ($requestedPerspective) {
if ($requestedPerspective != $user->getActivePerspective()) {
$existingPerspectives = array_keys(Config::getPerspectivesConfig()->toArray());
if (!in_array($requestedPerspective, $existingPerspectives)) {
$requestedPerspective = null;
}
}
}
if (!$requestedPerspective) {
$requestedPerspective = $user->getActivePerspective();
}
//TODO check if perspective is still allowed
if ($requestedPerspective != $user->getActivePerspective()) {
$user->setActivePerspective($requestedPerspective);
$user->save();
}
return $this;
}
示例3: setUser
/**
* @param Model\User $user
* @return $this
*/
public function setUser(Model\User $user)
{
$this->user = $user;
\Zend_Registry::set("pimcore_admin_user", $this->user);
$this->setLanguage($this->user->getLanguage());
// update perspective settings
$requestedPerspective = $this->getParam("perspective");
if ($requestedPerspective) {
if ($requestedPerspective != $user->getActivePerspective()) {
$existingPerspectives = array_keys(Config::getPerspectivesConfig()->toArray());
if (!in_array($requestedPerspective, $existingPerspectives)) {
$requestedPerspective = null;
}
}
}
if (!$requestedPerspective || !$user->isAllowed($requestedPerspective, "perspective")) {
//choose active perspective or a first allowed
$requestedPerspective = $user->isAllowed($user->getActivePerspective(), "perspective") ? $user->getActivePerspective() : $user->getFirstAllowedPerspective();
}
if ($requestedPerspective != $user->getActivePerspective()) {
$user->setActivePerspective($requestedPerspective);
$user->save();
}
return $this;
}