本文整理汇总了PHP中UserForm::readInputData方法的典型用法代码示例。如果您正苦于以下问题:PHP UserForm::readInputData方法的具体用法?PHP UserForm::readInputData怎么用?PHP UserForm::readInputData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserForm
的用法示例。
在下文中一共展示了UserForm::readInputData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readInputData
/**
* Assign form data to user-submitted data.
* @see Form::readInputData()
*/
function readInputData()
{
parent::readInputData();
$this->readUserVars(array('authId', 'password', 'password2', 'salutation', 'firstName', 'middleName', 'lastName', 'suffix', 'gender', 'initials', 'signature', 'affiliation', 'email', 'userUrl', 'phone', 'fax', 'mailingAddress', 'country', 'biography', 'keywords', 'interestsTextOnly', 'userLocales', 'generatePassword', 'sendNotify', 'mustChangePassword'));
if ($this->userId == null) {
$this->readUserVars(array('username'));
}
if ($this->getData('userLocales') == null || !is_array($this->getData('userLocales'))) {
$this->setData('userLocales', array());
}
if ($this->getData('username') != null) {
// Usernames must be lowercase
$this->setData('username', strtolower($this->getData('username')));
}
$keywords = $this->getData('keywords');
if ($keywords != null && is_array($keywords['interests'])) {
// The interests are coming in encoded -- Decode them for DB storage
$this->setData('interestsKeywords', array_map('urldecode', $keywords['interests']));
}
}
示例2: readInputData
/**
* Assign form data to user-submitted data.
* @see Form::readInputData()
*/
function readInputData()
{
parent::readInputData();
$this->readUserVars(array('authId', 'password', 'password2', 'salutation', 'firstName', 'middleName', 'lastName', 'suffix', 'gender', 'initials', 'signature', 'affiliation', 'email', 'userUrl', 'phone', 'orcid', 'mailingAddress', 'country', 'biography', 'interests', 'userLocales', 'generatePassword', 'sendNotify', 'mustChangePassword'));
if ($this->userId == null) {
$this->readUserVars(array('username'));
}
if ($this->getData('userLocales') == null || !is_array($this->getData('userLocales'))) {
$this->setData('userLocales', array());
}
if ($this->getData('username') != null) {
// Usernames must be lowercase
$this->setData('username', strtolower($this->getData('username')));
}
}
示例3: updateUser
/**
* Update an existing user
* @param $args array
* @param $request PKPRequest
* @return string Serialized JSON object
*/
function updateUser($args, &$request)
{
// Identify the press
$press =& $request->getPress();
// Identify the user Id
$userId = $request->getUserVar('userId');
if ($userId !== null && !Validation::canAdminister($press->getId(), $userId)) {
// We don't have administrative rights over this user.
$json = new JSON('false', Locale::translate('grid.user.cannotAdminister'));
} else {
// Form handling
import('controllers.grid.users.user.form.UserForm');
$userForm = new UserForm($userId);
$userForm->readInputData();
if ($userForm->validate()) {
$user =& $userForm->execute($args, $request);
// If this is a newly created user, show role management form
if (!$userId) {
import('controllers.grid.users.user.form.UserRoleForm');
$userRoleForm = new UserRoleForm($user->getId());
$userRoleForm->initData($args, $request);
$json = new JSON('false', $userRoleForm->display($args, $request));
} else {
// Successful edit of an existing user
// Prepare the grid row data
$row =& $this->getRowInstance();
$row->setGridId($this->getId());
$row->setId($user->getId());
$row->setData($user);
$row->initialize($request);
$json = new JSON('true', $this->_renderRowInternally($request, $row));
}
} else {
$json = new JSON('false', $userForm->display($args, $request));
}
}
return $json->getString();
}