Completed
Pull Request — master (#3325)
by Emanuele
11:19
created

Drafts_Admin_Module   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 3
ccs 0
cts 25
cp 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A hooks() 0 5 1
A addMenu() 0 12 1
A addSearch() 0 5 1
1
<?php
2
3
/**
4
 * This file contains several functions for retrieving and manipulating calendar events, birthdays and holidays.
5
 *
6
 * @name      ElkArte Forum
7
 * @copyright ElkArte Forum contributors
8
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
9
 *
10
 * This file contains code covered by:
11
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
12
 * license:  	BSD, See included LICENSE.TXT for terms and conditions.
13
 *
14
 * @version 1.1
15
 *
16
 */
17
18
/**
19
 * Class Drafts_Admin_Module
20
 *
21
 * Events and functions for post based drafts
22
 */
23
class Drafts_Admin_Module extends ElkArte\sources\modules\Abstract_Module
24
{
25
	/**
26
	 * {@inheritdoc}
27
	 */
28
	public static function hooks(\Event_Manager $eventsManager)
29
	{
30
		return array(
31
			array('addMenu', array('Drafts_Admin_Module', 'addMenu'), array()),
32
			array('addSearch', array('Drafts_Admin_Module', 'addSearch'), array()),
33
		);
34
	}
35
36
	/**
37
	 * Used to add the Drafts entry to the admin menu.
38
	 *
39
	 * @param mixed[] $admin_areas The admin menu array
40
	 */
41
	public function addMenu(&$admin_areas)
42
	{
43
		global $txt, $context;
44
45
		$admin_areas['layout']['areas']['managedrafts'] = array(
46
			'label' => $txt['manage_drafts'],
47
			'controller' => 'ManageDraftsModule_Controller',
48
			'function' => 'action_index',
49
			'icon' => 'transparent.png',
50
			'class' => 'admin_img_logs',
51
			'permission' => array('admin_forum'),
52
			'enabled' => in_array('dr', $context['admin_features']),
53
		);
54
	}
55
56
	/**
57
	 * Used to add the Drafts entry to the admin search.
58
	 *
59
	 * @param string[] $language_files
60
	 * @param string[] $include_files
61
	 * @param mixed[] $settings_search
62
	 */
63
	public function addSearch(&$language_files, &$include_files, &$settings_search)
64
	{
65
		$language_files[] = 'Drafts';
66
		$include_files[] = 'ManageDraftsModule.controller';
67
		$settings_search[] = array('settings_search', 'area=managedrafts', 'ManageDraftsModule_Controller');
68
	}
69
}
70