mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
[ticket/11201] Add database column type to type class
PHPBB3-11201
This commit is contained in:
parent
1dbc2d6218
commit
8e86e56120
@ -26,6 +26,7 @@ services:
|
||||
class: \phpbb\profilefields\type\type_bool
|
||||
arguments:
|
||||
- @profilefields.lang_helper
|
||||
- @profilefields
|
||||
- @request
|
||||
- @template
|
||||
- @user
|
||||
@ -46,6 +47,7 @@ services:
|
||||
class: \phpbb\profilefields\type\type_dropdown
|
||||
arguments:
|
||||
- @profilefields.lang_helper
|
||||
- @profilefields
|
||||
- @request
|
||||
- @template
|
||||
- @user
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
@ -232,4 +232,12 @@ class type_date implements type_interface
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_database_column_type()
|
||||
{
|
||||
return 'VCHAR:10';
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user