link_us::get_template_acp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
*
4
* @package Board3 Portal v2.1
5
* @copyright (c) 2013 Board3 Group ( www.board3.de )
6
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
*
8
*/
9
10
namespace board3\portal\modules;
11
12
/**
13
* @package Link Us
14
*/
15
class link_us extends module_base
16
{
17
	/**
18
	* Allowed columns: Just sum up your options (Exp: left + right = 10)
19
	* top		1
20
	* left		2
21
	* center	4
22
	* right		8
23
	* bottom	16
24
	*/
25
	public $columns = 10;
26
27
	/**
28
	* Default modulename
29
	*/
30
	public $name = 'LINK_US';
31
32
	/**
33
	* Default module-image:
34
	* file must be in "{T_THEME_PATH}/images/portal/"
35
	*/
36
	public $image_src = 'portal_link_us.png';
37
38
	/**
39
	* module-language file
40
	* file must be in "language/{$user->lang}/mods/portal/"
41
	*/
42
	public $language = 'portal_link_us_module';
43
44
	/** @var \phpbb\config\config */
45
	protected $config;
46
47
	/** @var \phpbb\template */
48
	protected $template;
49
50
	/** @var \phpbb\user */
51
	protected $user;
52
53
	/**
54
	* Construct a link us object
55
	*
56
	* @param \phpbb\config\config $config phpBB config
57
	* @param \phpbb\template $template phpBB template
58
	* @param \phpbb\user $user phpBB user object
59
	*/
60 13
	public function __construct($config, $template, $user)
61
	{
62 13
		$this->config = $config;
63 13
		$this->template = $template;
64 13
		$this->user = $user;
65 13
	}
66
67
	/**
68
	* {@inheritdoc}
69
	*/
70
	public function get_template_side($module_id)
71
	{
72
		//doing the easy way ;)
73
		$u_link = generate_board_url();
74
75
		// Assign specific vars
76
		$this->template->assign_vars(array(
77
			'LINK_US_TXT'		=> sprintf($this->user->lang['LINK_US_TXT'], $this->config['sitename']),
78
			'U_LINK_US'			=> '&lt;a&nbsp;href=&quot;' . $u_link . '&quot;&nbsp;' . (($this->config['site_desc']) ? 'title=&quot;' . $this->config['site_desc'] . '&quot;' : '' ) . '&gt;' . (($this->config['sitename']) ? $this->config['sitename'] : $u_link ) . '&lt;/a&gt;',
79
		));
80
81
		return 'link_us_side.html';
82
	}
83
84
	/**
85
	* {@inheritdoc}
86
	*/
87
	public function get_template_acp($module_id)
88
	{
89
		return array(
90
			'title'	=> 'LINK_US',
91
			'vars'	=> array(),
92
		);
93
	}
94
}
95