本文整理汇总了PHP中Gems_Loader::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Gems_Loader::getUser方法的具体用法?PHP Gems_Loader::getUser怎么用?PHP Gems_Loader::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gems_Loader
的用法示例。
在下文中一共展示了Gems_Loader::getUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
/**
* Hook that allows actions when data was saved
*
* When not rerouted, the form will be populated afterwards
*
* @param int $changed The number of changed rows (0 or 1 usually, but can be more)
*/
protected function afterSave($changed)
{
if ($changed) {
$this->accesslog->logChange($this->request, null, $this->formData);
// Reload the current user data
$user = $this->currentUser;
$currentOrg = $user->getCurrentOrganizationId();
$this->loader->getUserLoader()->unsetCurrentUser();
$user = $this->loader->getUser($user->getLoginName(), $user->getBaseOrganizationId())->setAsCurrentUser();
$user->setCurrentOrganization($currentOrg);
// In case locale has changed, set it in a cookie
\Gems_Cookies::setLocale($this->formData['gsf_iso_lang'], $this->basepath);
$this->addMessage($this->_('Saved your setup data', $this->formData['gsf_iso_lang']));
} else {
$this->addMessage($this->_('No changes to save!'));
}
if ($this->cacheTags && $this->cache instanceof \Zend_Cache_Core) {
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, (array) $this->cacheTags);
}
}
示例2: isValid
/**
* Validate the form
*
* As it is better for translation utilities to set the labels etc. translated,
* the MUtil default is to disable translation.
*
* However, this also disables the translation of validation messages, which we
* cannot set translated. The MUtil form is extended so it can make this switch.
*
* @param array $data
* @param boolean $disableTranslateValidators Extra switch
* @return boolean
*/
public function isValid($data, $disableTranslateValidators = null)
{
$this->_user = $this->loader->getUser(isset($data[$this->usernameFieldName]) ? $data[$this->usernameFieldName] : null, isset($data[$this->organizationFieldName]) ? $data[$this->organizationFieldName] : '');
return parent::isValid($data, $disableTranslateValidators);
}