Classes

File phpboost/member/extended-fields/MemberExtendedField.class.php

File phpboost/member/extended-fields/MemberExtendedField.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:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 
<?php
/**
 * This class represente a member extended field
 * @package     PHPBoost
 * @subpackage  Member\extended-fields
 * @copyright   &copy; 2005-2019 PHPBoost
 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
 * @author      Kevin MASSY <reidlos@phpboost.com>
 * @version     PHPBoost 5.2 - last update: 2016 11 14
 * @since       PHPBoost 3.0 - 2010 09 02
 * @contributor Julien BRISWALTER <j1.seth@phpboost.com>
 * @contributor Arnaud GENET <elenwii@phpboost.com>
 * @contributor mipel <mipel@phpboost.com>
*/

class MemberExtendedField
{
    private $name;
    private $field_name;
    private $description;
    private $field_type;
    private $value;
    private $default_value;
    private $possible_values;
    private $required;
    private $regex;

    private $fieldset;
    private $user_id;

    public function get_name()
    {
        return $this->name;
    }

    public function get_field_name()
    {
        return $this->field_name;
    }

    public function get_field_type()
    {
        return $this->field_type;
    }

    public function get_value()
    {
        return $this->value;
    }

    public function get_description()
    {
        return $this->description;
    }

    public function get_default_value()
    {
        return $this->default_value;
    }

    public function get_possible_values()
    {
        return $this->possible_values;
    }

    public function get_required()
    {
        return $this->required;
    }

    public function get_regex()
    {
        return $this->regex;
    }

    public function get_fieldset()
    {
        return $this->fieldset;
    }

    public function get_user_id()
    {
        return $this->user_id;
    }

    public function set_fieldset(FormFieldset $fieldset)
    {
        $this->fieldset = $fieldset;
    }

    public function set_user_id($user_id)
    {
        $this->user_id = $user_id;
    }

    public function set_properties($properties)
    {
        $this->name = $properties['name'];
        $this->field_name = $properties['field_name'];
        $this->description = $properties['description'];
        $this->field_type = $properties['field_type'];
        $this->value = $properties['value'];
        $this->default_value = $properties['default_value'];
        $this->required = $properties['required'];
        $this->regex = $properties['regex'];

        if (!is_array($properties['possible_values']))
        {
            $fixed_possible_values = preg_replace_callback( '!s:(\d+):"(.*?)";!u', function($match) {
                return ($match[1] == TextHelper::strlen($match[2])) ? $match[0] : 's:' . TextHelper::strlen($match[2]) . ':"' . $match[2] . '";';
            }, $properties['possible_values']);
            $this->possible_values = TextHelper::unserialize($fixed_possible_values);
        }
        else
            $this->possible_values = $properties['possible_values'];
    }

    public function get_instance()
    {
        $field_type = $this->get_field_type();
        if (!empty($field_type))
        {
            $class = (string)$field_type;
            return new $class();
        }
    }
}
?>
Annonces