aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/profilefields/manager.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-02-02 16:05:01 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-02-02 16:13:04 +0100
commitcacd43bfbd547d711bfdd4c424adfef9d20528e7 (patch)
tree3163e60787cceac8501f97a57e2e0adcc0fe65dc /phpBB/phpbb/profilefields/manager.php
parent7bcbdfc1b15e0d014a22c76bb1eab6ccbc3d6dc7 (diff)
downloadforums-cacd43bfbd547d711bfdd4c424adfef9d20528e7.tar
forums-cacd43bfbd547d711bfdd4c424adfef9d20528e7.tar.gz
forums-cacd43bfbd547d711bfdd4c424adfef9d20528e7.tar.bz2
forums-cacd43bfbd547d711bfdd4c424adfef9d20528e7.tar.xz
forums-cacd43bfbd547d711bfdd4c424adfef9d20528e7.zip
[ticket/11201] Remove dependency from types on the manager
PHPBB3-11201
Diffstat (limited to 'phpBB/phpbb/profilefields/manager.php')
-rw-r--r--phpBB/phpbb/profilefields/manager.php53
1 files changed, 10 insertions, 43 deletions
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index 9f64e1dcf7..7564c920c9 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -40,6 +40,12 @@ class manager
protected $template;
/**
+ * Service Collection object
+ * @var \phpbb\di\service_collection
+ */
+ protected $type_collection;
+
+ /**
* User object
* @var \phpbb\user
*/
@@ -60,17 +66,19 @@ class manager
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\request\request $request Request object
* @param \phpbb\template\template $template Template object
+ * @param \phpbb\di\service_collection $type_collection
* @param \phpbb\user $user User object
* @param string $fields_table
* @param string $fields_language_table
* @param string $fields_data_table
*/
- public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver $db, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, $fields_table, $fields_language_table, $fields_data_table)
+ public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver $db, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\di\service_collection $type_collection, \phpbb\user $user, $fields_table, $fields_language_table, $fields_data_table)
{
$this->auth = $auth;
$this->db = $db;
$this->request = $request;
$this->template = $template;
+ $this->type_collection = $type_collection;
$this->user = $user;
$this->fields_table = $fields_table;
@@ -79,20 +87,6 @@ class manager
}
/**
- * Setter for the type collection
- *
- * We need to set the type collection later,
- * in order to avoid a circular dependency
- *
- * @param \phpbb\di\service_collection $type_collection
- * @return null
- */
- public function set_type_collection(\phpbb\di\service_collection $type_collection)
- {
- $this->type_collection = $type_collection;
- }
-
- /**
* Assign editable fields to template, mode can be profile (for profile change) or register (for registration)
* Called by ucp_profile and ucp_register
*/
@@ -131,8 +125,8 @@ class manager
while ($row = $this->db->sql_fetchrow($result))
{
// Return templated field
- $tpl_snippet = $this->process_field_row('change', $row);
$profile_field = $this->type_collection[$row['field_type']];
+ $tpl_snippet = $profile_field->process_field_row('change', $row);
$this->template->assign_block_vars('profile_fields', array(
'LANG_NAME' => $this->user->lang($row['lang_name']),
@@ -352,33 +346,6 @@ class manager
}
/**
- * Return Templated value/field. Possible values for $mode are:
- * change == user is able to set/enter profile values; preview == just show the value
- */
- public function process_field_row($mode, $profile_row)
- {
- $preview_options = ($mode == 'preview') ? $this->vars['lang_options'] : false;
-
- // set template filename
- $this->template->set_filenames(array(
- 'cp_body' => 'custom_profile_fields.html',
- ));
-
- // empty previously filled blockvars
- foreach ($this->type_collection as $field_key => $field_type)
- {
- $this->template->destroy_block_vars($field_type->get_name_short());
- }
-
- // Assign template variables
- $profile_field = $this->type_collection[$profile_row['field_type']];
- $profile_field->generate_field($profile_row, $preview_options);
-
- // Return templated data
- return $this->template->assign_display('cp_body');
- }
-
- /**
* Build Array for user insertion into custom profile fields table
*/
public function build_insert_sql_array($cp_data)