[feature/module_services] Move link_us to module services
This commit is contained in:
@@ -158,6 +158,15 @@ services:
|
||||
tags:
|
||||
- { name: board3.module }
|
||||
|
||||
board3.module.link_us:
|
||||
class: \board3\portal\modules\link_us
|
||||
arguments:
|
||||
- @config
|
||||
- @template
|
||||
- @user
|
||||
tags:
|
||||
- { name: board3.module }
|
||||
|
||||
board3.module.links:
|
||||
class: \board3\portal\modules\links
|
||||
arguments:
|
||||
|
||||
@@ -391,7 +391,7 @@ class v210_beta1 extends \phpbb\db\migration\migration
|
||||
'module_status' => 1,
|
||||
),
|
||||
array(
|
||||
'module_classname' => 'link_us',
|
||||
'module_classname' => '\board3\portal\modules\link_us',
|
||||
'module_column' => 1,
|
||||
'module_order' => 9,
|
||||
'module_name' => 'LINK_US',
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal v2 - Link us
|
||||
* @package Board3 Portal v2.1
|
||||
* @copyright (c) Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
namespace board3\portal\modules;
|
||||
|
||||
/**
|
||||
* @package Clock
|
||||
* @package Link Us
|
||||
*/
|
||||
class portal_link_us_module extends \board3\portal\modules\module_base
|
||||
class link_us extends module_base
|
||||
{
|
||||
/**
|
||||
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||
@@ -47,22 +41,52 @@ class portal_link_us_module extends \board3\portal\modules\module_base
|
||||
*/
|
||||
public $language = 'portal_link_us_module';
|
||||
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
protected $template;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Construct a link us object
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($config, $template, $user)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function get_template_side($module_id)
|
||||
{
|
||||
global $config, $template, $user;
|
||||
|
||||
//doing the easy way ;)
|
||||
$u_link = generate_board_url();
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'LINK_US_TXT' => sprintf($user->lang['LINK_US_TXT'], $config['sitename']),
|
||||
'U_LINK_US' => '<a href="' . $u_link . '" ' . (($config['site_desc']) ? 'title="' . $config['site_desc'] . '"' : '' ) . '>' . (($config['sitename']) ? $config['sitename'] : $u_link ) . '</a>',
|
||||
$this->template->assign_vars(array(
|
||||
'LINK_US_TXT' => sprintf($this->user->lang['LINK_US_TXT'], $this->config['sitename']),
|
||||
'U_LINK_US' => '<a href="' . $u_link . '" ' . (($this->config['site_desc']) ? 'title="' . $this->config['site_desc'] . '"' : '' ) . '>' . (($this->config['sitename']) ? $this->config['sitename'] : $u_link ) . '</a>',
|
||||
));
|
||||
|
||||
return 'link_us_side.html';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function get_template_acp($module_id)
|
||||
{
|
||||
return array(
|
||||
@@ -70,17 +94,4 @@ class portal_link_us_module extends \board3\portal\modules\module_base
|
||||
'vars' => array(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* API functions
|
||||
*/
|
||||
public function install($module_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall($module_id, $db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user