diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-01-15 15:34:17 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-01-15 16:36:50 +0100 |
commit | 8e86e56120279a0522b2b05e627edde1b8a11d80 (patch) | |
tree | 71e3f74361bde30e4b33177756ba7c36035bc7d3 /phpBB/phpbb/profilefields | |
parent | 1dbc2d621861249a40633012fe33af02c097e69b (diff) | |
download | forums-8e86e56120279a0522b2b05e627edde1b8a11d80.tar forums-8e86e56120279a0522b2b05e627edde1b8a11d80.tar.gz forums-8e86e56120279a0522b2b05e627edde1b8a11d80.tar.bz2 forums-8e86e56120279a0522b2b05e627edde1b8a11d80.tar.xz forums-8e86e56120279a0522b2b05e627edde1b8a11d80.zip |
[ticket/11201] Add database column type to type class
PHPBB3-11201
Diffstat (limited to 'phpBB/phpbb/profilefields')
-rw-r--r-- | phpBB/phpbb/profilefields/profilefields.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_bool.php | 11 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_date.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_dropdown.php | 11 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_int.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_interface.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_string.php | 9 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_text.php | 8 |
8 files changed, 60 insertions, 4 deletions
diff --git a/phpBB/phpbb/profilefields/profilefields.php b/phpBB/phpbb/profilefields/profilefields.php index 38b8600b7b..a580ca2937 100644 --- a/phpBB/phpbb/profilefields/profilefields.php +++ b/phpBB/phpbb/profilefields/profilefields.php @@ -339,7 +339,7 @@ class profilefields * Return Templated value/field. Possible values for $mode are: * change == user is able to set/enter profile values; preview == just show the value */ - protected function process_field_row($mode, $profile_row) + public function process_field_row($mode, $profile_row) { $preview_options = ($mode == 'preview') ? $this->vars['lang_options'] : false; diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index f32f4a7513..6abac8c7bf 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -14,9 +14,10 @@ class type_bool implements type_interface /** * */ - public function __construct(\phpbb\profilefields\lang_helper $lang_helper, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) + public function __construct(\phpbb\profilefields\lang_helper $lang_helper, \phpbb\profilefields\profilefields $profilefields, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { $this->lang_helper = $lang_helper; + $this->profilefields = $profilefields; $this->request = $request; $this->template = $template; $this->user = $user; @@ -184,4 +185,12 @@ class type_bool implements type_interface { return ($field_data['field_length'] == '1') ? '' : 'pf_' . $field_data['field_ident']; } + + /** + * {@inheritDoc} + */ + public function get_database_column_type() + { + return 'TINT:2'; + } } diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index fda09c05e2..1fcbf2ea3e 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -232,4 +232,12 @@ class type_date implements type_interface { return ''; } + + /** + * {@inheritDoc} + */ + public function get_database_column_type() + { + return 'VCHAR:10'; + } } diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index a3217f004c..e2b0dc646c 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -14,9 +14,10 @@ class type_dropdown implements type_interface /** * */ - public function __construct(\phpbb\profilefields\lang_helper $lang_helper, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) + public function __construct(\phpbb\profilefields\lang_helper $lang_helper, \phpbb\profilefields\profilefields $profilefields, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user) { $this->lang_helper = $lang_helper; + $this->profilefields = $profilefields; $this->request = $request; $this->template = $template; $this->user = $user; @@ -182,4 +183,12 @@ class type_dropdown implements type_interface { return 'pf_' . $field_data['field_ident']; } + + /** + * {@inheritDoc} + */ + public function get_database_column_type() + { + return 'UINT'; + } } diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php index 13e39039c3..202005008f 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -158,4 +158,12 @@ class type_int implements type_interface { return 'pf_' . $field_data['field_ident']; } + + /** + * {@inheritDoc} + */ + public function get_database_column_type() + { + return 'BINT'; + } } diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index 5b662205b3..917b95f653 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -90,4 +90,11 @@ interface type_interface * @return string ident of the field */ public function get_field_ident($field_data); + + /** + * Get the column type for the database + * + * @return string Returns the database column type + */ + public function get_database_column_type(); } diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index 57edd14d62..a9d9fddfb0 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -78,7 +78,14 @@ class type_string extends type_string_common implements type_interface $default_value = $profile_row['lang_default_value']; $profile_row['field_value'] = ($this->request->is_set($field_ident)) ? $this->request->variable($field_ident, $default_value, true) : ((!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false) ? $default_value : $this->user->profile_fields[$field_ident]); - $this->template->assign_block_vars('string', array_change_key_case($profile_row, CASE_UPPER)); } + + /** + * {@inheritDoc} + */ + public function get_database_column_type() + { + return 'VCHAR'; + } } diff --git a/phpBB/phpbb/profilefields/type/type_text.php b/phpBB/phpbb/profilefields/type/type_text.php index da1bb32859..58cc2d2741 100644 --- a/phpBB/phpbb/profilefields/type/type_text.php +++ b/phpBB/phpbb/profilefields/type/type_text.php @@ -84,4 +84,12 @@ class type_text extends type_string_common implements type_interface $this->template->assign_block_vars('text', array_change_key_case($profile_row, CASE_UPPER)); } + + /** + * {@inheritDoc} + */ + public function get_database_column_type() + { + return 'MTEXT'; + } } |