2012-11-20 18:14:48 -06:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
2014-05-27 20:18:06 +02:00
|
|
|
* This file is part of the phpBB Forum Software package.
|
|
|
|
*
|
|
|
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
|
|
|
*
|
|
|
|
* For full copyright and license information, please see
|
|
|
|
* the docs/CREDITS.txt file.
|
2012-11-20 18:14:48 -06:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
if (!defined('IN_PHPBB'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifications service class
|
|
|
|
*/
|
2013-09-10 14:01:09 +02:00
|
|
|
class phpbb_notification_manager_helper extends \phpbb\notification\manager
|
2012-11-20 18:14:48 -06:00
|
|
|
{
|
|
|
|
public function set_var($name, $value)
|
|
|
|
{
|
|
|
|
$this->$name = $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extra dependencies for get_*_class functions
|
|
|
|
protected $auth = null;
|
|
|
|
protected $config = null;
|
2013-05-03 08:50:27 -05:00
|
|
|
public function setDependencies($auth, $config)
|
2012-11-20 18:14:48 -06:00
|
|
|
{
|
|
|
|
$this->auth = $auth;
|
|
|
|
$this->config = $config;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper to get the notifications item type class and set it up
|
|
|
|
*/
|
|
|
|
public function get_item_type_class($item_type, $data = array())
|
|
|
|
{
|
2014-08-17 14:43:17 +02:00
|
|
|
$item_parts = explode('.', $item_type);
|
|
|
|
$item_type = 'phpbb\notification\type\\' . array_pop($item_parts);
|
2012-11-20 18:14:48 -06:00
|
|
|
|
2013-05-03 08:50:27 -05:00
|
|
|
$item = new $item_type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
|
2012-11-20 18:14:48 -06:00
|
|
|
|
|
|
|
$item->set_notification_manager($this);
|
|
|
|
|
|
|
|
$item->set_initial_data($data);
|
|
|
|
|
|
|
|
return $item;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper to get the notifications method class and set it up
|
|
|
|
*/
|
|
|
|
public function get_method_class($method_name)
|
|
|
|
{
|
2013-09-10 15:31:52 +02:00
|
|
|
$method_name = 'phpbb\notification\method\\' . $method_name;
|
2012-11-20 18:14:48 -06:00
|
|
|
|
2013-05-03 08:50:27 -05:00
|
|
|
$method = new $method_name($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
|
2012-11-20 18:14:48 -06:00
|
|
|
|
|
|
|
$method->set_notification_manager($this);
|
|
|
|
|
|
|
|
return $method;
|
|
|
|
}
|
|
|
|
}
|