forumlist::get_template_center()   B
last analyzed

Complexity

Conditions 6
Paths 2

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 0
Metric Value
cc 6
eloc 12
nc 2
nop 1
dl 0
loc 19
ccs 0
cts 17
cp 0
crap 42
rs 8.8571
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 Forumlist
14
*/
15
class forumlist 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 = 21;
26
27
	/**
28
	* Default modulename
29
	*/
30
	public $name = 'PORTAL_FORUMLIST';
31
32
	/**
33
	* Default module-image:
34
	* file must be in "{T_THEME_PATH}/images/portal/"
35
	*/
36
	public $image_src = '';
37
38
	/**
39
	* module-language file
40
	* file must be in "language/{$user->lang}/mods/portal/"
41
	*/
42
	public $language = 'portal_forumlist_module';
43
44
	/**
45
	* custom acp template
46
	* file must be in "adm/style/portal/"
47
	*/
48
	public $custom_acp_tpl = '';
49
50
	/** @var \phpbb\auth\auth */
51
	protected $auth;
52
53
	/** @var \phpbb\config\config */
54
	protected $config;
55
56
	/** @var \phpbb\template */
57
	protected $template;
58
59
	/** @var string PHP file extension */
60
	protected $php_ext;
61
62
	/** @var string phpBB root path */
63
	protected $phpbb_root_path;
64
65
	/** @var \phpbb\user */
66
	protected $user;
67
68
	/**
69
	* Construct a forumlist object
70
	*
71
	* @param \phpbb\auth\auth $auth phpBB auth service
72
	* @param \phpbb\config\config $config phpBB config
73
	* @param \phpbb\template $template phpBB template
74
	* @param string $phpEx php file extension
75
	* @param string $phpbb_root_path phpBB root path
76
	* @param \phpbb\user $user phpBB user object
77
	*/
78
	public function __construct($auth, $config, $template, $phpbb_root_path, $phpEx, $user)
79
	{
80
		$this->auth = $auth;
81
		$this->config = $config;
82
		$this->template = $template;
83
		$this->php_ext = $phpEx;
84
		$this->phpbb_root_path = $phpbb_root_path;
85
		$this->user = $user;
86
	}
87
88
	/**
89
	* {@inheritdoc}
90
	*/
91
	public function get_template_center($module_id)
92
	{
93
		if (!function_exists('display_forums'))
94
		{
95
			include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
96
		}
97
		\display_forums('', $this->config['load_moderators'], false);
98
99
		$this->template->assign_vars(array(
100
			'FORUM_IMG'			=> $this->user->img('forum_read', 'NO_NEW_POSTS'),
101
			'FORUM_NEW_IMG'			=> $this->user->img('forum_unread', 'NEW_POSTS'),
102
			'FORUM_LOCKED_IMG'		=> $this->user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
103
			'FORUM_NEW_LOCKED_IMG'		=> $this->user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
104
			'U_MARK_FORUMS'			=> ($this->user->data['is_registered'] || $this->config['load_anon_lastread']) ? append_sid("{$this->phpbb_root_path}index.{$this->php_ext}", 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '',
105
			'U_MCP'				=> ($this->auth->acl_get('m_') || $this->auth->acl_getf_global('m_')) ? append_sid("{$this->phpbb_root_path}mcp.{$this->php_ext}", 'i=main&amp;mode=front', true, $this->user->session_id) : '',
106
		));
107
108
		return 'forumlist.html';
109
	}
110
111
	/**
112
	* {@inheritdoc}
113
	*/
114
	public function get_template_acp($module_id)
115
	{
116
		return array(
117
			'title'	=> 'PORTAL_FORUMLIST',
118
			'vars'	=> array(),
119
		);
120
	}
121
}
122