Completed
Push — develop ( 660ae6...f77be0 )
by Daniel
08:50
created

options::get_all()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.4285
cc 2
eloc 6
nc 2
nop 6
crap 2
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\sitemaker\services\forum;
11
12
class options
13
{
14
	/**
15
	 * Constructor
16
	 *
17
	 * @param string		$phpbb_root_path	Path to the phpbb includes directory.
18
	 * @param string		$php_ext			php file extension
19
	 */
20 11
	public function __construct($phpbb_root_path, $php_ext)
21
	{
22
		// @codeCoverageIgnoreStart
23
		if (!function_exists('make_forum_select'))
24
		{
25
			include($phpbb_root_path . 'includes/functions_admin.' . $php_ext);
26
		}
27
		// @codeCoverageIgnoreEnd
28 11
	}
29
30
	/**
31
	 * @param bool $select_id
32
	 * @param bool $ignore_id
33
	 * @param bool $ignore_acl
34
	 * @param bool $ignore_nonpost
35
	 * @param bool $ignore_emptycat
36
	 * @param bool $only_acl_post
37
	 * @return array
38
	 */
39 2
	public function get_all($select_id = false, $ignore_id = false, $ignore_acl = true, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false)
40
	{
41 2
		$forumlist = make_forum_select($select_id, $ignore_id, $ignore_acl, $ignore_nonpost, $ignore_emptycat, $only_acl_post, true);
42
43 2
		$forum_options = array('' => 'ALL_FORUMS');
44 2
		foreach ($forumlist as $row)
45
		{
46 1
			$forum_options[$row['forum_id']] = $row['padding'] . $row['forum_name'];
47 2
		}
48
49 2
		return $forum_options;
50
	}
51
52
	/**
53
	 * Get array of topic types.
54
	 * This is used primarily by blocks config and the values are translated automatically
55
	 *
56
	 * @return array
57
	 */
58 2
	public function get_topic_types()
59
	{
60
		return array(
61 2
			POST_NORMAL     => 'POST_NORMAL',
62 2
			POST_STICKY     => 'POST_STICKY',
63 2
			POST_ANNOUNCE   => 'POST_ANNOUNCEMENT',
64 2
			POST_GLOBAL     => 'POST_GLOBAL',
65 2
		);
66
	}
67
}
68