Update 0.0.5

Update 0.0.5
This commit is contained in:
dmzx
2015-03-18 07:46:45 +01:00
parent ab8103a8bb
commit 8da5abba52
12 changed files with 1223 additions and 1076 deletions

View File

@@ -13,9 +13,12 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class listener implements EventSubscriberInterface
{
/** @var \dmzx\mchat\core\render_helper */
protected $render_helper;
protected $config;
/** @var \phpbb\template\template */
protected $template;
protected $user;
@@ -29,8 +32,9 @@ class listener implements EventSubscriberInterface
/** @var \phpbb\controller\helper */
protected $controller_helper;
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $controller_helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, $root_path, $php_ext, $auth)
public function __construct(\dmzx\mchat\core\render_helper $render_helper, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $controller_helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, $root_path, $php_ext, $auth)
{
$this->render_helper = $render_helper;
$this->config = $config;
$this->template = $template;
$this->controller_helper = $controller_helper;
@@ -44,8 +48,9 @@ class listener implements EventSubscriberInterface
static public function getSubscribedEvents()
{
return array(
'core.user_setup' => 'load_language_on_setup',
'core.page_header' => 'add_page_header_link',
'core.user_setup' => 'load_language_on_setup',
'core.page_header' => 'add_page_header_link',
'core.index_modify_page_title' => 'display_mchat_on_index',
);
}
@@ -72,4 +77,23 @@ class listener implements EventSubscriberInterface
'U_MCHAT' => $this->controller_helper->route('dmzx_mchat_controller'),
));
}
/**
* Check if mchat should be displayed on index.
*
* @param object $event The event object
* @return null
* @access public
*/
public function display_mchat_on_index($event)
{
$mchat_on_index = $this->config['mchat_on_index'];
if ($mchat_on_index)
{
$this->template->assign_var('S_MCHAT_ON_INDEX', true);
$this->render_helper->render_data_for_page(true);
}
}
}