diff options
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/includes/acp/acp_profile.php | 30 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_bool.php | 18 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_date.php | 17 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_dropdown.php | 18 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_int.php | 17 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_interface.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_string.php | 22 | ||||
| -rw-r--r-- | phpBB/phpbb/profilefields/type/type_text.php | 22 | 
8 files changed, 126 insertions, 26 deletions
| diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 2d4097d526..6ee051e37b 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -942,7 +942,7 @@ class acp_profile  	*/  	function build_language_options(&$cp, $field_type, $action = 'create')  	{ -		global $user, $config, $db; +		global $user, $config, $db, $phpbb_container;  		$default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][$config['default_lang']]; @@ -959,31 +959,9 @@ class acp_profile  		}  		$db->sql_freeresult($result); -		$options = array(); -		$options['lang_name'] = 'string'; -		if ($cp->vars['lang_explain']) -		{ -			$options['lang_explain'] = 'text'; -		} - -		switch ($field_type) -		{ -			case FIELD_BOOL: -				$options['lang_options'] = 'two_options'; -			break; - -			case FIELD_DROPDOWN: -				$options['lang_options'] = 'optionfield'; -			break; - -			case FIELD_TEXT: -			case FIELD_STRING: -				if (strlen($cp->vars['lang_default_value'])) -				{ -					$options['lang_default_value'] = ($field_type == FIELD_STRING) ? 'string' : 'text'; -				} -			break; -		} +		$type_collection = $phpbb_container->get('profilefields.type_collection'); +		$profile_type = $type_collection['profilefields.type.' . $cp->profile_types[$field_type]]; +		$options = $profile_type->get_language_options($cp->vars);  		$lang_options = array(); diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index 6abac8c7bf..f4e0ac0f86 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -193,4 +193,22 @@ class type_bool implements type_interface  	{  		return 'TINT:2';  	} + +	/** +	* {@inheritDoc} +	*/ +	public function get_language_options($field_data) +	{ +		$options = array( +			'lang_name'		=> 'string', +			'lang_options'	=> 'two_options', +		); + +		if ($field_data['lang_explain']) +		{ +			$options['lang_explain'] = 'text'; +		} + +		return $options; +	}  } diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index 1fcbf2ea3e..d2a10cdd15 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -240,4 +240,21 @@ class type_date implements type_interface  	{  		return 'VCHAR:10';  	} + +	/** +	* {@inheritDoc} +	*/ +	public function get_language_options($field_data) +	{ +		$options = array( +			'lang_name' => 'string', +		); + +		if ($field_data['lang_explain']) +		{ +			$options['lang_explain'] = 'text'; +		} + +		return $options; +	}  } diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index e2b0dc646c..82c128861a 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -191,4 +191,22 @@ class type_dropdown implements type_interface  	{  		return 'UINT';  	} + +	/** +	* {@inheritDoc} +	*/ +	public function get_language_options($field_data) +	{ +		$options = array( +			'lang_name'		=> 'string', +			'lang_options'	=> 'optionfield', +		); + +		if ($field_data['lang_explain']) +		{ +			$options['lang_explain'] = 'text'; +		} + +		return $options; +	}  } diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php index 202005008f..a2e6f8e663 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -166,4 +166,21 @@ class type_int implements type_interface  	{  		return 'BINT';  	} + +	/** +	* {@inheritDoc} +	*/ +	public function get_language_options($field_data) +	{ +		$options = array( +			'lang_name' => 'string', +		); + +		if ($field_data['lang_explain']) +		{ +			$options['lang_explain'] = 'text'; +		} + +		return $options; +	}  } diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index 917b95f653..f6f6355698 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -97,4 +97,12 @@ interface type_interface  	* @return string	Returns the database column type  	*/  	public function get_database_column_type(); + +	/** +	* Get the options we need to display for the language input fields in the ACP +	* +	* @param array	$field_data		Array with data for this field +	* @return array	Returns the language options we need to generate +	*/ +	public function get_language_options($field_data);  } diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index a9d9fddfb0..ee2eb8b760 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -88,4 +88,26 @@ class type_string extends type_string_common implements type_interface  	{  		return 'VCHAR';  	} + +	/** +	* {@inheritDoc} +	*/ +	public function get_language_options($field_data) +	{ +		$options = array( +			'lang_name' => 'string', +		); + +		if ($field_data['lang_explain']) +		{ +			$options['lang_explain'] = 'text'; +		} + +		if (strlen($field_data['lang_default_value'])) +		{ +			$options['lang_default_value'] = 'string'; +		} + +		return $options; +	}  } diff --git a/phpBB/phpbb/profilefields/type/type_text.php b/phpBB/phpbb/profilefields/type/type_text.php index 58cc2d2741..7aea982f6f 100644 --- a/phpBB/phpbb/profilefields/type/type_text.php +++ b/phpBB/phpbb/profilefields/type/type_text.php @@ -92,4 +92,26 @@ class type_text extends type_string_common implements type_interface  	{  		return 'MTEXT';  	} + +	/** +	* {@inheritDoc} +	*/ +	public function get_language_options($field_data) +	{ +		$options = array( +			'lang_name' => 'string', +		); + +		if ($field_data['lang_explain']) +		{ +			$options['lang_explain'] = 'text'; +		} + +		if (strlen($field_data['lang_default_value'])) +		{ +			$options['lang_default_value'] = 'text'; +		} + +		return $options; +	}  } | 
