本文整理汇总了PHP中HTMLForm::has_field方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::has_field方法的具体用法?PHP HTMLForm::has_field怎么用?PHP HTMLForm::has_field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::has_field方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
private function save()
{
$has_error = false;
$registration_pass = $this->user_accounts_config->get_member_accounts_validation_method() == UserAccountsConfig::MAIL_USER_ACCOUNTS_VALIDATION ? KeyGenerator::generate_key(15) : '';
$user_aprobation = $this->user_accounts_config->get_member_accounts_validation_method() == UserAccountsConfig::AUTOMATIC_USER_ACCOUNTS_VALIDATION;
$user = new User();
$user->set_display_name($this->form->get_value('display_name'));
$user->set_level(User::MEMBER_LEVEL);
$user->set_email($this->form->get_value('email'));
$user->set_show_email(!$this->form->get_value('user_hide_mail'));
$user->set_locale($this->form->get_value('lang')->get_raw_value());
$user->set_editor($this->form->get_value('text-editor')->get_raw_value());
$user->set_timezone($this->form->get_value('timezone')->get_raw_value());
if ($this->form->has_field('theme')) {
$user->set_theme($this->form->get_value('theme')->get_raw_value());
}
$login = $this->form->get_value('email');
if ($this->form->get_value('custom_login')) {
$login = $this->form->get_value('login');
}
$auth_method = new PHPBoostAuthenticationMethod($login, $this->form->get_value('password'));
$auth_method->set_association_parameters($user_aprobation, $registration_pass);
try {
$user_id = UserService::create($user, $auth_method, $this->member_extended_fields_service);
} catch (MemberExtendedFieldErrorsMessageException $e) {
$has_error = true;
$this->tpl->put('MSG', MessageHelper::display($e->getMessage(), MessageHelper::NOTICE));
}
if (!$has_error) {
UserRegistrationService::send_email_confirmation($user_id, $user->get_email(), $this->form->get_value('display_name'), $login, $this->form->get_value('password'), $registration_pass);
$this->confirm_registration($user_id);
}
}
示例2: get_data
public function get_data(HTMLForm $form, MemberExtendedField $member_extended_field)
{
$field_name = $member_extended_field->get_field_name();
if ($form->has_field($field_name)) {
return $form->get_value($field_name)->format(Date::FORMAT_TIMESTAMP);
}
return '';
}
示例3: get_data
public function get_data(HTMLForm $form, MemberExtendedField $member_extended_field)
{
$field_name = $member_extended_field->get_field_name();
if ($form->has_field($field_name)) {
return (int) $form->get_value($field_name);
}
return '';
}
示例4: get_value
public function get_value(HTMLForm $form, ContactField $field)
{
$field_name = $field->get_field_name();
if ($form->has_field($field_name)) {
return $form->get_value($field_name)->format(Date::FORMAT_TIMESTAMP);
}
return '';
}
示例5: get_data
public function get_data(HTMLForm $form, MemberExtendedField $member_extended_field)
{
$field_name = $member_extended_field->get_field_name();
$array = array();
if ($form->has_field($field_name)) {
foreach ($form->get_value($field_name) as $field => $value) {
$array[] = $value->get_label();
}
}
return $this->serialise_value($array);
}
示例6: get_value
public function get_value(HTMLForm $form, ContactField $field)
{
$field_name = $field->get_field_name();
if ($form->has_field($field_name)) {
$value = $form->get_value($field_name);
if (!empty($value)) {
return $value->get_label();
}
}
return '';
}
示例7: get_value
public function get_value(HTMLForm $form, ContactField $field)
{
$field_name = $field->get_field_name();
$array = array();
if ($form->has_field($field_name)) {
foreach ($form->get_value($field_name) as $field => $value) {
$array[] = $value->get_label();
}
}
return $this->serialise_value($array);
}
示例8: get_data
public function get_data(HTMLForm $form, MemberExtendedField $member_extended_field)
{
$field_name = $member_extended_field->get_field_name();
if ($form->has_field($field_name)) {
$value = $form->get_value($field_name);
if (!empty($value)) {
return $value->get_label();
}
}
return '';
}
示例9: save
private function save()
{
$message = $this->get_message();
if ($this->form->has_field('pseudo')) {
$message->set_login($this->form->get_value('pseudo'));
}
$message->set_contents($this->form->get_value('contents'));
if ($message->get_id() === null) {
$id_message = GuestbookService::add($message);
} else {
$id_message = $message->get_id();
GuestbookService::update($message);
}
GuestbookMessagesCache::invalidate();
return $id_message;
}
示例10: save
private function save()
{
$message = $this->get_message();
if ($this->form->has_field('pseudo')) {
$message->set_login($this->form->get_value('pseudo'));
}
$message->set_contents($this->form->get_value('contents'));
if ($message->get_id() === null) {
$message->set_creation_date(new Date());
$id_message = ShoutboxService::add($message);
} else {
$id_message = $message->get_id();
ShoutboxService::update($message);
}
return $id_message;
}
示例11: save
private function save(HTTPRequestCustom $request)
{
$has_error = false;
$user_id = $this->user->get_id();
if ($this->form->get_value('delete_account')) {
UserService::delete_by_id($user_id);
} else {
$approbation = $this->internal_auth_infos['approved'];
if (AppContext::get_current_user()->is_admin()) {
$old_approbation = $approbation;
$approbation = $this->form->get_value('approbation');
$groups = array();
foreach ($this->form->get_value('groups') as $field => $option) {
$groups[] = $option->get_raw_value();
}
GroupsService::edit_member($user_id, $groups);
$this->user->set_groups($groups);
$this->user->set_level($this->form->get_value('rank')->get_raw_value());
}
if ($this->form->has_field('theme')) {
$this->user->set_theme($this->form->get_value('theme')->get_raw_value());
}
$this->user->set_locale($this->form->get_value('lang')->get_raw_value());
$this->user->set_display_name($this->form->get_value('display_name'));
$this->user->set_email($this->form->get_value('email'));
$this->user->set_locale($this->form->get_value('lang')->get_raw_value());
$this->user->set_editor($this->form->get_value('text-editor')->get_raw_value());
$this->user->set_show_email(!$this->form->get_value('user_hide_mail'));
$this->user->set_timezone($this->form->get_value('timezone')->get_raw_value());
try {
UserService::update($this->user, $this->member_extended_fields_service);
} catch (MemberExtendedFieldErrorsMessageException $e) {
$has_error = true;
$this->tpl->put('MSG', MessageHelper::display($e->getMessage(), MessageHelper::NOTICE));
}
$login = $this->form->get_value('email');
if ($this->form->get_value('custom_login', false)) {
$login = $this->form->get_value('login');
}
$password = $this->form->get_value('password');
if ($this->internal_auth_infos === null && !empty($password)) {
$authentication_method = new PHPBoostAuthenticationMethod($login, $password);
AuthenticationService::associate($authentication_method, $user_id);
} elseif (!empty($password)) {
$old_password = $this->form->get_value('old_password');
if (!empty($old_password)) {
$old_password_hashed = KeyGenerator::string_hash($old_password);
if ($old_password_hashed == $this->internal_auth_infos['password']) {
PHPBoostAuthenticationMethod::update_auth_infos($user_id, $login, $approbation, KeyGenerator::string_hash($password));
$has_error = false;
} else {
$has_error = true;
$this->tpl->put('MSG', MessageHelper::display($this->lang['profile.edit.password.error'], MessageHelper::NOTICE));
}
}
} else {
PHPBoostAuthenticationMethod::update_auth_infos($user_id, $login, $approbation);
}
if (AppContext::get_current_user()->is_admin()) {
if ($old_approbation != $approbation && $old_approbation == 0) {
//Recherche de l'alerte correspondante
$matching_alerts = AdministratorAlertService::find_by_criteria($user_id, 'member_account_to_approbate');
//L'alerte a été trouvée
if (count($matching_alerts) == 1) {
$alert = $matching_alerts[0];
$alert->set_status(AdministratorAlert::ADMIN_ALERT_STATUS_PROCESSED);
AdministratorAlertService::save_alert($alert);
$site_name = GeneralConfig::load()->get_site_name();
$subject = StringVars::replace_vars($this->user_lang['registration.subject-mail'], array('site_name' => $site_name));
$content = StringVars::replace_vars($this->user_lang['registration.email.mail-administrator-validation'], array('pseudo' => $this->user->get_display_name(), 'site_name' => $site_name, 'signature' => MailServiceConfig::load()->get_mail_signature()));
AppContext::get_mail_service()->send_from_properties($this->user->get_email(), $subject, $content);
}
}
$user_warning = $this->form->get_value('user_warning')->get_raw_value();
if (!empty($user_warning) && $user_warning != $this->user->get_warning_percentage()) {
MemberSanctionManager::caution($user_id, $user_warning, MemberSanctionManager::SEND_MP, str_replace('%level%', $user_warning, LangLoader::get_message('user_warning_level_changed', 'main')));
} elseif (empty($user_warning)) {
MemberSanctionManager::cancel_caution($user_id);
}
$user_readonly = $this->form->get_value('user_readonly')->get_raw_value();
if (!empty($user_readonly) && $user_readonly != $this->user->get_delay_readonly()) {
MemberSanctionManager::remove_write_permissions($user_id, time() + $user_readonly, MemberSanctionManager::SEND_MP, str_replace('%date%', $this->form->get_value('user_readonly')->get_label(), LangLoader::get_message('user_readonly_changed', 'main')));
} elseif (empty($user_readonly)) {
MemberSanctionManager::restore_write_permissions($user_id);
}
$user_ban = $this->form->get_value('user_ban')->get_raw_value();
if (!empty($user_ban) && $user_ban != $this->user->get_delay_banned()) {
MemberSanctionManager::banish($user_id, time() + $user_ban, MemberSanctionManager::SEND_MAIL);
} elseif ($user_ban != $this->user->get_delay_banned()) {
MemberSanctionManager::cancel_banishment($user_id);
}
}
SessionData::recheck_cached_data_from_user_id($user_id);
}
if (!$has_error) {
AppContext::get_response()->redirect($request->get_url_referrer() ? $request->get_url_referrer() : UserUrlBuilder::edit_profile($user_id), $this->lang['user.message.success.edit']);
}
}