本文整理汇总了PHP中ezcInputForm::hasInputField方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcInputForm::hasInputField方法的具体用法?PHP ezcInputForm::hasInputField怎么用?PHP ezcInputForm::hasInputField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcInputForm
的用法示例。
在下文中一共展示了ezcInputForm::hasInputField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
if ($form->hasValidData('XMPPUsername') && $form->XMPPUsername != '') {
$UserData->xmpp_username = $form->XMPPUsername;
} else {
$UserData->xmpp_username = '';
}
if ($form->hasValidData('UserInvisible') && $form->UserInvisible == true) {
$UserData->invisible_mode = 1;
} else {
$UserData->invisible_mode = 0;
}
if ($form->hasValidData('JobTitle') && $form->JobTitle != '') {
$UserData->job_title = $form->JobTitle;
} else {
$UserData->job_title = '';
}
if ($form->hasInputField('Password') && (!$form->hasInputField('Password1') || $form->Password != $form->Password1)) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Passwords mismatch');
}
if ($form->hasValidData('DefaultGroup')) {
$UserData->user_groups_id = $form->DefaultGroup;
} else {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/new', 'Please choose a default user group');
}
if ($form->hasValidData('UserDisabled') && $form->UserDisabled == true) {
$UserData->disabled = 1;
} else {
$UserData->disabled = 0;
}
if ($form->hasValidData('HideMyStatus') && $form->HideMyStatus == true) {
$UserData->hide_online = 1;
} else {
示例2: validateAccount
public static function validateAccount(&$userData)
{
$definition = array('Password' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Password1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'validate_email'), 'Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'Surname' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'unsafe_raw'), 'Username' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'JobTitle' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Skype' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'XMPPUsername' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'ChatNickname' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserTimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserInvisible' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'ReceivePermissionRequest' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'));
$form = new ezcInputForm(INPUT_POST, $definition);
$Errors = array();
if (!$form->hasValidData('Username') || $form->Username == '') {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'Please enter a username');
} else {
if ($form->Username != $userData->username) {
$userData->username = $form->Username;
if (erLhcoreClassModelUser::userExists($userData->username) === true) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'User exists');
}
}
}
if ($form->hasValidData('Password') && $form->hasValidData('Password1')) {
$userData->password_temp_1 = $form->Password;
$userData->password_temp_2 = $form->Password1;
}
if ($form->hasInputField('Password') && (!$form->hasInputField('Password1') || $form->Password != $form->Password1)) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'Passwords mismatch');
} else {
if ($form->hasInputField('Password') && $form->hasInputField('Password1') && $form->Password != '' && $form->Password1 != '') {
$userData->setPassword($form->Password);
$userData->password_front = $form->Password;
}
}
if ($form->hasValidData('ChatNickname') && $form->ChatNickname != '') {
$userData->chat_nickname = $form->ChatNickname;
} else {
$userData->chat_nickname = '';
}
if (!$form->hasValidData('Email')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'Wrong email address');
} else {
$userData->email = $form->Email;
}
if (!$form->hasValidData('Name') || $form->Name == '') {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/validator', 'Please enter a name');
} else {
$userData->name = $form->Name;
}
if ($form->hasValidData('Surname') && $form->Surname != '') {
$userData->surname = $form->Surname;
} else {
$userData->surname = '';
}
if ($form->hasValidData('JobTitle') && $form->JobTitle != '') {
$userData->job_title = $form->JobTitle;
} else {
$userData->job_title = '';
}
if ($form->hasValidData('UserTimeZone') && $form->UserTimeZone != '') {
$userData->time_zone = $form->UserTimeZone;
CSCacheAPC::getMem()->setSession('lhc_user_timezone', $userData->time_zone, true);
} else {
CSCacheAPC::getMem()->setSession('lhc_user_timezone', '', true);
$userData->time_zone = '';
}
if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'changevisibility')) {
if ($form->hasValidData('UserInvisible') && $form->UserInvisible == true) {
$userData->invisible_mode = 1;
} else {
$userData->invisible_mode = 0;
}
}
if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'receivepermissionrequest')) {
if ($form->hasValidData('ReceivePermissionRequest') && $form->ReceivePermissionRequest == true) {
$userData->rec_per_req = 1;
} else {
$userData->rec_per_req = 0;
}
}
if (erLhcoreClassUser::instance()->hasAccessTo('lhuser', 'changeskypenick')) {
if ($form->hasValidData('Skype') && $form->Skype != '') {
$userData->skype = $form->Skype;
} else {
$userData->skype = '';
}
}
if ($form->hasValidData('XMPPUsername') && $form->XMPPUsername != '') {
$userData->xmpp_username = $form->XMPPUsername;
} else {
$userData->xmpp_username = '';
}
return $Errors;
}