clock::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
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 Clock
14
*/
15
class clock 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 = 'CLOCK';
31
32
	/**
33
	* Default module-image:
34
	* file must be in "{T_THEME_PATH}/images/portal/"
35
	*/
36
	public $image_src = 'portal_clock.png';
37
38
	/**
39
	* module-language file
40
	* file must be in "language/{$user->lang}/mods/portal/"
41
	*/
42
	public $language = 'portal_clock_module';
43
44
	/** @var \phpbb\config\config */
45
	protected $config;
46
47
	/** @var \phpbb\template\template */
48
	protected $template;
49
50
	/**
51
	 * Constructor for clock module
52
	 *
53
	 * @param \phpbb\config\config $config phpBB config
54
	 * @param \phpbb\template\template $template phpBB template
55
	 */
56 49
	public function __construct($config, $template)
57
	{
58 49
		$this->config = $config;
59 49
		$this->template = $template;
60 49
	}
61
62
	/**
63
	* {@inheritdoc}
64
	*/
65 4
	public function get_template_side($module_id)
66
	{
67 4
		if (isset($this->config['board3_clock_src_' . $module_id]) && !empty($this->config['board3_clock_src_' . $module_id]))
68 4
		{
69 1
			$this->template->assign_var('B3P_CLOCK_SRC', $this->config['board3_clock_src_' . $module_id]);
70 1
		}
71 4
		return 'clock_side.html';
72
	}
73
74
	/**
75
	* {@inheritdoc}
76
	*/
77 1 View Code Duplication
	public function get_template_acp($module_id)
78
	{
79
		return array(
80 1
			'title'	=> 'ACP_PORTAL_CLOCK_SETTINGS',
81
			'vars'	=> array(
82 1
				'legend1'	=> 'ACP_PORTAL_CLOCK_SETTINGS',
83 1
				'board3_clock_src_' . $module_id	=> array('lang' => 'ACP_PORTAL_CLOCK_SRC', 'validate' => 'string', 'type' => 'text:50:200', 'explain' => true, 'submit_type' => 'custom', 'submit' => 'check_file_src'),
84 1
			),
85 1
		);
86
	}
87
88
	/**
89
	 * {@inheritdoc}
90
	 */
91 1
	public function install($module_id)
92
	{
93 1
		$this->config->set('board3_clock_src_' . $module_id, '');
94 1
		return true;
95
	}
96
97
	/**
98
	 * {@inheritdoc}
99
	 */
100 1
	public function uninstall($module_id, $db)
101
	{
102 1
		$this->config->delete('board3_clock_src_' . $module_id);
103 1
		return true;
104
	}
105
}
106