本文整理汇总了PHP中Gems_Loader::getUserLoader方法的典型用法代码示例。如果您正苦于以下问题:PHP Gems_Loader::getUserLoader方法的具体用法?PHP Gems_Loader::getUserLoader怎么用?PHP Gems_Loader::getUserLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gems_Loader
的用法示例。
在下文中一共展示了Gems_Loader::getUserLoader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterRegistry
public function afterRegistry()
{
$this->user = $this->loader->getUserLoader()->getUserByStaffId($this->staffId);
parent::afterRegistry();
$this->user = $this->loader->getUserLoader()->getUserByStaffId($this->staffId);
$mailFields = $this->user->getMailFields();
$this->addMailFields($mailFields);
$this->addTo($this->user->getEmailAddress(), $this->user->getFullName());
$this->setLanguage($this->user->getLocale());
}
示例2: getCurrentOrganizationId
/**
* Returns the organization id that should currently be used for this form.
*
* @return int Returns the current organization id, if any
*/
public function getCurrentOrganizationId()
{
$userLoader = $this->loader->getUserLoader();
// Url determines organization first.
if ($orgId = $userLoader->getOrganizationIdByUrl()) {
$this->_organizationFromUrl = true;
$userLoader->getCurrentUser()->setCurrentOrganization($orgId);
return $orgId;
}
$request = $this->getRequest();
if ($request->isPost() && ($orgId = $request->getParam($this->organizationFieldName))) {
return $orgId;
}
return $userLoader->getCurrentUser()->getCurrentOrganizationId();
}
示例3: translateRowValues
/**
* Add organization id and gul_user_class when needed
*
* @param mixed $row array or \Traversable row
* @param scalar $key
* @return mixed Row array or false when errors occurred
*/
public function translateRowValues($row, $key)
{
$row = parent::translateRowValues($row, $key);
if (!$row) {
return false;
}
if (!isset($row['gsf_id_organization'])) {
$row['gsf_id_organization'] = $this->_organization->getId();
if (!isset($row['gul_user_class'])) {
$row['gul_user_class'] = $this->_organization->get('gor_user_class');
}
} elseif (!isset($row['gul_user_class'])) {
$row['gul_user_class'] = $this->loader->getUserLoader()->getOrganization($row['gsf_id_organization'])->get('gor_user_class');
}
return $row;
}
示例4: 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);
}
}
示例5: save
/**
* Save a single model item.
*
* Makes sure the password is saved too using the userclass
*
* @param array $newValues The values to store for a single model item.
* @param array $filter If the filter contains old key values these are used
* to decide on update versus insert.
* @param array $saveTables Optional array containing the table names to save,
* otherwise the tables set to save at model level will be saved.
* @return array The values as they are after saving (they may change).
*/
public function save(array $newValues, array $filter = null, array $saveTables = null)
{
//First perform a save
$savedValues = parent::save($newValues, $filter, $saveTables);
//Now check if we need to save config values
if (isset($newValues['gor_user_class']) && !empty($newValues['gor_user_class'])) {
$definition = $this->loader->getUserLoader()->getUserDefinition($newValues['gor_user_class']);
if ($definition instanceof \Gems_User_UserDefinitionConfigurableInterface && $definition->hasConfig()) {
$savedValues = $definition->saveConfig($savedValues, $newValues);
if ($definition->getConfigChanged() > 0 && $this->getChanged() < 1) {
$this->setChanged(1);
}
}
}
return $savedValues;
}
示例6: save
/**
* Save a single model item.
*
* Makes sure the password is saved too using the userclass
*
* @param array $newValues The values to store for a single model item.
* @param array $filter If the filter contains old key values these are used
* to decide on update versus insert.
* @param array $saveTables Optional array containing the table names to save,
* otherwise the tables set to save at model level will be saved.
* @return array The values as they are after saving (they may change).
*/
public function save(array $newValues, array $filter = null, array $saveTables = null)
{
//First perform a save
$savedValues = parent::save($newValues, $filter, $saveTables);
//Now check if we need to set the password
if (isset($newValues['fld_password']) && !empty($newValues['fld_password'])) {
if ($this->getChanged() < 1) {
$this->setChanged(1);
}
//Now load the userclass and save the password use the $savedValues as for a new
//user we might not have the id in the $newValues
$user = $this->loader->getUserLoader()->getUserByStaffId($savedValues['gsf_id_user']);
if ($user->canSetPassword()) {
$user->setPassword($newValues['fld_password']);
}
}
return $savedValues;
}