[ticket/289] Move store_selected_forums to modules_helper

This commit is contained in:
Marc Alexander
2014-07-24 19:18:25 +02:00
parent 2c279b71df
commit d41bd0eab9
12 changed files with 64 additions and 106 deletions

View File

@@ -23,17 +23,25 @@ class modules_helper
*/
protected $config;
/**
* phpBB request
* @var \phpbb\request\request
*/
protected $request;
/**
* Constructor
* NOTE: The parameters of this method must match in order and type with
* the dependencies defined in the services.yml file for this service.
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\config\config $config phpBB config
* @param \phpbb\request\request $request phpBB request
*/
public function __construct($auth, $config)
public function __construct($auth, $config, $request)
{
$this->auth = $auth;
$this->config = $config;
$this->request = $request;
}
/**
@@ -111,4 +119,21 @@ class modules_helper
return $this->generate_select_box($key, $select_ary, $selected_options);
}
/**
* Store selected forums
*
* @param string $key Key name
* @param int $module_id Module ID
*
* @return null
* @access public
*/
public function store_selected_forums($key)
{
// Get selected extensions
$values = $this->request->variable($key, array(0 => ''));
$news = implode(',', $values);
$this->config->set($key, $news);
}
}