Classes

File phpboost/member/extended-fields/field/MemberUserPMToMailExtendedField.class.php

File phpboost/member/extended-fields/field/MemberUserPMToMailExtendedField.class.php

 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 
<?php
/**
 * @package     PHPBoost
 * @subpackage  Member\extended-fields\field
 * @copyright   &copy; 2005-2019 PHPBoost
 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
 * @author      Julien BRISWALTER <j1.seth@phpboost.com>
 * @version     PHPBoost 5.2 - last update: 2016 02 11
 * @since       PHPBoost 4.1 - 2015 09 19
*/

class MemberUserPMToMailExtendedField extends AbstractMemberExtendedField
{
    public function __construct()
    {
        parent::__construct();
        $this->set_disable_fields_configuration(array('field_required', 'regex', 'possible_values', 'default_value'));
        $this->set_name(LangLoader::get_message('type.user_pmtomail','admin-user-common'));
        $this->field_used_once = true;
        $this->field_used_phpboost_config = true;
    }

    public function display_field_create(MemberExtendedField $member_extended_field)
    {
        $fieldset = $member_extended_field->get_fieldset();

        $fieldset->add_field(new FormFieldCheckbox($member_extended_field->get_field_name(), $member_extended_field->get_name(), false,
            array('description' => $member_extended_field->get_description(), 'required' => (bool)$member_extended_field->get_required())
        ));
    }

    public function display_field_update(MemberExtendedField $member_extended_field)
    {
        $fieldset = $member_extended_field->get_fieldset();

        $fieldset->add_field(new FormFieldCheckbox($member_extended_field->get_field_name(), $member_extended_field->get_name(), $member_extended_field->get_value(),
            array('description' => $member_extended_field->get_description(), 'required' => (bool)$member_extended_field->get_required())
        ));
    }

    public function display_field_profile(MemberExtendedField $member_extended_field)
    {
        //The field is not displayed in the member profile
        return false;
    }

    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 '';
    }
}
?>
Annonces