private function save() { $extended_field = new ExtendedField(); $extended_field->set_name(TextHelper::htmlspecialchars($this->form->get_value('name'))); $extended_field->set_field_name(ExtendedField::rewrite_field_name($this->form->get_value('name'))); $extended_field->set_position(PersistenceContext::get_querier()->get_column_value(DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST, 'MAX(position) + 1', '')); $extended_field->set_description(TextHelper::htmlspecialchars($this->form->get_value('description'))); $field_type = $this->form->get_value('field_type')->get_raw_value(); $extended_field->set_field_type($field_type); if (!$this->form->field_is_disabled('possible_values')) { $extended_field->set_possible_values($this->form->get_value('possible_values')); } if (!$this->form->field_is_disabled('default_value')) { $extended_field->set_default_value($this->form->get_value('default_value')); } $extended_field->set_is_required((bool) $this->form->get_value('field_required')); $extended_field->set_display((bool) $this->form->get_value('display')); $regex = 0; if (!$this->form->field_is_disabled('regex_type')) { $regex = is_numeric($this->form->get_value('regex_type', '')->get_raw_value()) ? $this->form->get_value('regex_type', '')->get_raw_value() : $this->form->get_value('regex', ''); } $extended_field->set_regex($regex); $extended_field->set_authorization($this->form->get_value('authorizations')->build_auth_array()); $extended_field->set_is_not_installer(true); ExtendedFieldsService::add($extended_field); return $extended_field; }
private function add_extended_fields() { $lang = LangLoader::get('user-common'); //Sex $extended_field = new ExtendedField(); $extended_field->set_name($lang['extended-field.field.sex']); $extended_field->set_field_name('user_sex'); $extended_field->set_description($lang['extended-field.field.sex-explain']); $extended_field->set_field_type('MemberUserSexExtendedField'); $extended_field->set_is_required(false); $extended_field->set_display(false); $extended_field->set_is_freeze(true); ExtendedFieldsService::add($extended_field); //Mail notofication when receiving PM $extended_field = new ExtendedField(); $extended_field->set_name($lang['extended-field.field.pmtomail']); $extended_field->set_field_name('user_pmtomail'); $extended_field->set_description($lang['extended-field.field.pmtomail-explain']); $extended_field->set_field_type('MemberUserPMToMailExtendedField'); $extended_field->set_is_required(false); $extended_field->set_display(false); $extended_field->set_is_freeze(true); ExtendedFieldsService::add($extended_field); //Date Birth $extended_field = new ExtendedField(); $extended_field->set_name($lang['extended-field.field.date-birth']); $extended_field->set_field_name('user_born'); $extended_field->set_description($lang['extended-field.field.date-birth-explain']); $extended_field->set_field_type('MemberUserBornExtendedField'); $extended_field->set_is_required(false); $extended_field->set_display(false); $extended_field->set_is_freeze(true); ExtendedFieldsService::add($extended_field); //Avatar $extended_field = new ExtendedField(); $extended_field->set_name($lang['extended-field.field.avatar']); $extended_field->set_field_name('user_avatar'); $extended_field->set_description($lang['extended-field.field.avatar-explain']); $extended_field->set_field_type('MemberUserAvatarExtendedField'); $extended_field->set_is_required(false); $extended_field->set_display(true); $extended_field->set_is_freeze(true); ExtendedFieldsService::add($extended_field); }
private function create_member_extended_field() { $lang = LangLoader::get('common', 'forum'); $extended_field = new ExtendedField(); $extended_field->set_name(self::$member_extended_field_last_view_forum_column); $extended_field->set_field_name(self::$member_extended_field_last_view_forum_column); $extended_field->set_field_type('MemberHiddenExtendedField'); $extended_field->set_is_freeze(true); ExtendedFieldsService::add($extended_field); //Website $extended_field = new ExtendedField(); $extended_field->set_name($lang['extended-field.field.website']); $extended_field->set_field_name('user_website'); $extended_field->set_description($lang['extended-field.field.website-explain']); $extended_field->set_field_type('MemberShortTextExtendedField'); $extended_field->set_is_required(false); $extended_field->set_display(false); $extended_field->set_is_freeze(true); $extended_field->set_regex(5); ExtendedFieldsService::add($extended_field); //Skype $extended_field = new ExtendedField(); $extended_field->set_name($lang['extended-field.field.skype']); $extended_field->set_field_name('user_skype'); $extended_field->set_description($lang['extended-field.field.skype-explain']); $extended_field->set_field_type('MemberShortTextExtendedField'); $extended_field->set_is_required(false); $extended_field->set_display(false); $extended_field->set_is_freeze(true); $extended_field->set_regex(4); ExtendedFieldsService::add($extended_field); //Sign $extended_field = new ExtendedField(); $extended_field->set_name($lang['extended-field.field.signing']); $extended_field->set_field_name('user_sign'); $extended_field->set_description($lang['extended-field.field.signing-explain']); $extended_field->set_field_type('MemberLongTextExtendedField'); $extended_field->set_is_required(false); $extended_field->set_display(false); $extended_field->set_is_freeze(true); ExtendedFieldsService::add($extended_field); }
/** * @desc Delete a extended field for field name * @param string $field_name the field name of the extended field */ public static function delete_by_field_name($field_name) { if (!empty($field_name)) { $extended_field = new ExtendedField(); $extended_field->set_field_name($field_name); if (ExtendedFieldsDatabaseService::check_field_exist_by_field_name($extended_field)) { $data = self::data_field($extended_field, self::SORT_BY_FIELD_NAME); $class = $data->get_instance(); if (!$class->get_field_used_phpboost_configuration() || !$data->get_is_freeze()) { ExtendedFieldsDatabaseService::delete_extended_field($data); ExtendedFieldsCache::invalidate(); } } } }
private function create_field_member() { $lang = LangLoader::get('common', 'newsletter'); $extended_field = new ExtendedField(); $extended_field->set_name($lang['extended_fields.newsletter.name']); $extended_field->set_field_name('register_newsletter'); $extended_field->set_description($lang['extended_fields.newsletter.description']); $extended_field->set_field_type('RegisterNewsletterExtendedField'); $extended_field->set_display(true); ExtendedFieldsService::add($extended_field); }