From 08e2c07f0b7991d89a562e1a78da9462d830e134 Mon Sep 17 00:00:00 2001 From: PayBas Date: Mon, 31 Mar 2014 13:04:25 +0200 Subject: [ticket/12334] Add PROFILE_FIELD_VALUEID template var PHPBB3-12334 --- phpBB/phpbb/profilefields/manager.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'phpBB') diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index 490db0419a..f075e38ded 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -412,13 +412,14 @@ class manager } $tpl_fields['row'] += array( - 'PROFILE_' . strtoupper($ident) . '_IDENT' => $ident, - 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, - 'PROFILE_' . strtoupper($ident) . '_CONTACT'=> $contact_url, - 'PROFILE_' . strtoupper($ident) . '_DESC' => $field_desc, - 'PROFILE_' . strtoupper($ident) . '_TYPE' => $ident_ary['data']['field_type'], - 'PROFILE_' . strtoupper($ident) . '_NAME' => $this->user->lang($ident_ary['data']['lang_name']), - 'PROFILE_' . strtoupper($ident) . '_EXPLAIN'=> $this->user->lang($ident_ary['data']['lang_explain']), + 'PROFILE_' . strtoupper($ident) . '_IDENT' => $ident, + 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, + 'PROFILE_' . strtoupper($ident) . '_VALUEID' => $ident_ary['value'], + 'PROFILE_' . strtoupper($ident) . '_CONTACT' => $contact_url, + 'PROFILE_' . strtoupper($ident) . '_DESC' => $field_desc, + 'PROFILE_' . strtoupper($ident) . '_TYPE' => $ident_ary['data']['field_type'], + 'PROFILE_' . strtoupper($ident) . '_NAME' => $this->user->lang($ident_ary['data']['lang_name']), + 'PROFILE_' . strtoupper($ident) . '_EXPLAIN' => $this->user->lang($ident_ary['data']['lang_explain']), 'S_PROFILE_' . strtoupper($ident) . '_CONTACT' => $ident_ary['data']['field_is_contact'], 'S_PROFILE_' . strtoupper($ident) => true, @@ -427,6 +428,7 @@ class manager $tpl_fields['blockrow'][] = array( 'PROFILE_FIELD_IDENT' => $ident, 'PROFILE_FIELD_VALUE' => $value, + 'PROFILE_FIELD_VALUEID' => $ident_ary['value'], 'PROFILE_FIELD_CONTACT' => $contact_url, 'PROFILE_FIELD_DESC' => $field_desc, 'PROFILE_FIELD_TYPE' => $ident_ary['data']['field_type'], -- cgit v1.2.1 From 4169fd65f07f67f99e64e7ab962d09c1e10f14dc Mon Sep 17 00:00:00 2001 From: PayBas Date: Sat, 5 Apr 2014 22:32:42 +0200 Subject: [ticket/12334] Added field_novalue fall-back as requested PHPBB3-12334 --- phpBB/phpbb/profilefields/manager.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB') diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index f075e38ded..7602abf9aa 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -389,6 +389,7 @@ class manager { $profile_field = $this->type_collection[$ident_ary['data']['field_type']]; $value = $profile_field->get_profile_value($ident_ary['value'], $ident_ary['data']); + $valueid = (!$ident_ary['value'] && !$ident_ary['data']['field_show_novalue']) ? $ident_ary['data']['field_novalue'] : $ident_ary['value']; if ($value === null) { @@ -414,7 +415,7 @@ class manager $tpl_fields['row'] += array( 'PROFILE_' . strtoupper($ident) . '_IDENT' => $ident, 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, - 'PROFILE_' . strtoupper($ident) . '_VALUEID' => $ident_ary['value'], + 'PROFILE_' . strtoupper($ident) . '_VALUEID' => $valueid, 'PROFILE_' . strtoupper($ident) . '_CONTACT' => $contact_url, 'PROFILE_' . strtoupper($ident) . '_DESC' => $field_desc, 'PROFILE_' . strtoupper($ident) . '_TYPE' => $ident_ary['data']['field_type'], @@ -428,7 +429,7 @@ class manager $tpl_fields['blockrow'][] = array( 'PROFILE_FIELD_IDENT' => $ident, 'PROFILE_FIELD_VALUE' => $value, - 'PROFILE_FIELD_VALUEID' => $ident_ary['value'], + 'PROFILE_FIELD_VALUEID' => $valueid, 'PROFILE_FIELD_CONTACT' => $contact_url, 'PROFILE_FIELD_DESC' => $field_desc, 'PROFILE_FIELD_TYPE' => $ident_ary['data']['field_type'], -- cgit v1.2.1 From 507eca319d2bff9779d662a36b845017b7464e68 Mon Sep 17 00:00:00 2001 From: PayBas Date: Tue, 29 Apr 2014 16:16:19 +0200 Subject: [ticket/12334] Implemented get_profile_valueid method PHPBB3-12334 --- phpBB/phpbb/profilefields/manager.php | 2 +- phpBB/phpbb/profilefields/type/type_bool.php | 18 ++++++++++++++++++ phpBB/phpbb/profilefields/type/type_date.php | 13 +++++++++++++ phpBB/phpbb/profilefields/type/type_dropdown.php | 18 ++++++++++++++++++ phpBB/phpbb/profilefields/type/type_int.php | 12 ++++++++++++ phpBB/phpbb/profilefields/type/type_interface.php | 9 +++++++++ phpBB/phpbb/profilefields/type/type_string_common.php | 13 +++++++++++++ 7 files changed, 84 insertions(+), 1 deletion(-) (limited to 'phpBB') diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index 7602abf9aa..a2b931ce27 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -389,7 +389,7 @@ class manager { $profile_field = $this->type_collection[$ident_ary['data']['field_type']]; $value = $profile_field->get_profile_value($ident_ary['value'], $ident_ary['data']); - $valueid = (!$ident_ary['value'] && !$ident_ary['data']['field_show_novalue']) ? $ident_ary['data']['field_novalue'] : $ident_ary['value']; + $valueid = $profile_field->get_profile_valueid($ident_ary['value'], $ident_ary['data']); if ($value === null) { diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index eb8d3e47d6..64f4f8293f 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -177,6 +177,24 @@ class type_bool extends type_base } } + /** + * {@inheritDoc} + */ + public function get_profile_valueid($field_value, $field_data) + { + if ($field_value == $field_data['field_novalue'] && !$field_data['field_show_novalue']) + { + return null; + } + + if (!$field_value && $field_data['field_show_novalue']) + { + $field_value = $field_data['field_novalue']; + } + + return $field_value; + } + /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index 158eec6a0c..f59d74c33d 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -205,6 +205,19 @@ class type_date extends type_base return $field_value; } + /** + * {@inheritDoc} + */ + public function get_profile_valueid($field_value, $field_data) + { + if (($field_value === '' || $field_value === null) && !$field_data['field_show_novalue']) + { + return null; + } + + return $field_value; + } + /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index 52c9fcf86a..b201c4abbf 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -186,6 +186,24 @@ class type_dropdown extends type_base return $this->lang_helper->get($field_id, $lang_id, $field_value); } + /** + * {@inheritDoc} + */ + public function get_profile_valueid($field_value, $field_data) + { + if ($field_value == $field_data['field_novalue'] && !$field_data['field_show_novalue']) + { + return null; + } + + if (!$field_value && $field_data['field_show_novalue']) + { + $field_value = $field_data['field_novalue']; + } + + return $field_value; + } + /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php index 78f1c7d2c9..8a803293d0 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -151,6 +151,18 @@ class type_int extends type_base return (int) $field_value; } + /** + * {@inheritDoc} + */ + public function get_profile_valueid($field_value, $field_data) + { + if (($field_value === '' || $field_value === null) && !$field_data['field_show_novalue']) + { + return null; + } + return (int) $field_value; + } + /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index 489e916fd5..8fe1bb2be5 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -93,6 +93,15 @@ interface type_interface */ public function get_profile_value($field_value, $field_data); + /** + * Get Profile Value ID for display (the raw, unprocessed user data) + * + * @param mixed $field_value Field value as stored in the database + * @param array $field_data Array with requirements of the field + * @return mixed Field value ID to display + */ + public function get_profile_valueid($field_value, $field_data); + /** * Get Profile Value for display * diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index b48e3c5add..1d26ba5d3a 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -109,6 +109,19 @@ abstract class type_string_common extends type_base return $field_value; } + /** + * {@inheritDoc} + */ + public function get_profile_valueid($field_value, $field_data) + { + if (!$field_value && !$field_data['field_show_novalue']) + { + return null; + } + + return $field_value; + } + /** * {@inheritDoc} */ -- cgit v1.2.1 From 2b451a174bc3cf253dacb3bfb313e9ff3f227de6 Mon Sep 17 00:00:00 2001 From: PayBas Date: Wed, 30 Apr 2014 10:08:21 +0200 Subject: [ticket/12334] Changed from valueid to value_raw PHPBB3-12334 --- phpBB/phpbb/profilefields/manager.php | 20 ++++++++++---------- phpBB/phpbb/profilefields/type/type_bool.php | 2 +- phpBB/phpbb/profilefields/type/type_date.php | 2 +- phpBB/phpbb/profilefields/type/type_dropdown.php | 2 +- phpBB/phpbb/profilefields/type/type_int.php | 2 +- phpBB/phpbb/profilefields/type/type_interface.php | 2 +- .../phpbb/profilefields/type/type_string_common.php | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) (limited to 'phpBB') diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index a2b931ce27..26c11d9e22 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -389,7 +389,7 @@ class manager { $profile_field = $this->type_collection[$ident_ary['data']['field_type']]; $value = $profile_field->get_profile_value($ident_ary['value'], $ident_ary['data']); - $valueid = $profile_field->get_profile_valueid($ident_ary['value'], $ident_ary['data']); + $value_raw = $profile_field->get_profile_value_raw($ident_ary['value'], $ident_ary['data']); if ($value === null) { @@ -415,7 +415,7 @@ class manager $tpl_fields['row'] += array( 'PROFILE_' . strtoupper($ident) . '_IDENT' => $ident, 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, - 'PROFILE_' . strtoupper($ident) . '_VALUEID' => $valueid, + 'PROFILE_' . strtoupper($ident) . '_VALUE_RAW' => $value_raw, 'PROFILE_' . strtoupper($ident) . '_CONTACT' => $contact_url, 'PROFILE_' . strtoupper($ident) . '_DESC' => $field_desc, 'PROFILE_' . strtoupper($ident) . '_TYPE' => $ident_ary['data']['field_type'], @@ -427,14 +427,14 @@ class manager ); $tpl_fields['blockrow'][] = array( - 'PROFILE_FIELD_IDENT' => $ident, - 'PROFILE_FIELD_VALUE' => $value, - 'PROFILE_FIELD_VALUEID' => $valueid, - 'PROFILE_FIELD_CONTACT' => $contact_url, - 'PROFILE_FIELD_DESC' => $field_desc, - 'PROFILE_FIELD_TYPE' => $ident_ary['data']['field_type'], - 'PROFILE_FIELD_NAME' => $this->user->lang($ident_ary['data']['lang_name']), - 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($ident_ary['data']['lang_explain']), + 'PROFILE_FIELD_IDENT' => $ident, + 'PROFILE_FIELD_VALUE' => $value, + 'PROFILE_FIELD_VALUE_RAW' => $value_raw, + 'PROFILE_FIELD_CONTACT' => $contact_url, + 'PROFILE_FIELD_DESC' => $field_desc, + 'PROFILE_FIELD_TYPE' => $ident_ary['data']['field_type'], + 'PROFILE_FIELD_NAME' => $this->user->lang($ident_ary['data']['lang_name']), + 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($ident_ary['data']['lang_explain']), 'S_PROFILE_CONTACT' => $ident_ary['data']['field_is_contact'], 'S_PROFILE_' . strtoupper($ident) => true, diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index 64f4f8293f..c34dd9ce88 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -180,7 +180,7 @@ class type_bool extends type_base /** * {@inheritDoc} */ - public function get_profile_valueid($field_value, $field_data) + public function get_profile_value_raw($field_value, $field_data) { if ($field_value == $field_data['field_novalue'] && !$field_data['field_show_novalue']) { diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index f59d74c33d..90ac9a6703 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -208,7 +208,7 @@ class type_date extends type_base /** * {@inheritDoc} */ - public function get_profile_valueid($field_value, $field_data) + public function get_profile_value_raw($field_value, $field_data) { if (($field_value === '' || $field_value === null) && !$field_data['field_show_novalue']) { diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index b201c4abbf..f70693e294 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -189,7 +189,7 @@ class type_dropdown extends type_base /** * {@inheritDoc} */ - public function get_profile_valueid($field_value, $field_data) + public function get_profile_value_raw($field_value, $field_data) { if ($field_value == $field_data['field_novalue'] && !$field_data['field_show_novalue']) { diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php index 8a803293d0..dd08df94c1 100644 --- a/phpBB/phpbb/profilefields/type/type_int.php +++ b/phpBB/phpbb/profilefields/type/type_int.php @@ -154,7 +154,7 @@ class type_int extends type_base /** * {@inheritDoc} */ - public function get_profile_valueid($field_value, $field_data) + public function get_profile_value_raw($field_value, $field_data) { if (($field_value === '' || $field_value === null) && !$field_data['field_show_novalue']) { diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index 8fe1bb2be5..2dd13fa480 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -100,7 +100,7 @@ interface type_interface * @param array $field_data Array with requirements of the field * @return mixed Field value ID to display */ - public function get_profile_valueid($field_value, $field_data); + public function get_profile_value_raw($field_value, $field_data); /** * Get Profile Value for display diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index 1d26ba5d3a..c2b951b6c9 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -112,7 +112,7 @@ abstract class type_string_common extends type_base /** * {@inheritDoc} */ - public function get_profile_valueid($field_value, $field_data) + public function get_profile_value_raw($field_value, $field_data) { if (!$field_value && !$field_data['field_show_novalue']) { -- cgit v1.2.1