Passed
Push — master ( 31fdb3...e945a6 )
by John
01:52
created

template_form_below()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
/**
4
 * @package Ultimate Menu mod
5
 * @version 1.0.3
6
 * @author John Rayes <[email protected]>
7
 * @copyright Copyright (c) 2014, John Rayes
8
 * @license http://opensource.org/licenses/MIT MIT
9
 */
10
11
function template_form_above()
12
{
13
	global $context, $scripturl;
14
15
	echo '
16
		<form action="', $scripturl, '?action=admin;area=umen;sa=savebutton" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden">
17
			<div class="cat_bar">
18
				<h3 class="catbg">
19
					', $context['page_title'], '
20
				</h3>
21
			</div>
22
			<span class="upperframe"><span></span></span>
23
				<div class="roundframe">';
24
}
25
26
function template_errors_above()
27
{
28
	global $context, $txt;
29
30
	if (!empty($context['post_error']))
31
	{
32
		echo '
33
					<div class="errorbox" id="errors">
34
						<strong>', $txt[$context['error_title']], '</strong>
35
						<ul>';
36
37
		foreach ($context['post_error'] as $error)
38
			echo '
39
							<li>', $txt[$error], '</li>';
40
41
		echo '
42
						</ul>
43
					</div>';
44
	}
45
}
46
47
function template_errors_below()
48
{
49
}
50
51
function template_main()
52
{
53
	global $context, $txt, $scripturl;
54
55
	echo '
56
					<dl class="settings">
57
						<dt>
58
							<strong>', $txt['um_menu_button_name'], ':</strong>
59
						</dt>
60
						<dd>
61
							<input type="text" name="name" id="bnbox" value="', $context['button_data']['name'], '" tabindex="1" class="input_text" style="width: 100%;" />
62
						</dd>
63
						<dt>
64
							<strong>', $txt['um_menu_button_position'], ':</strong>
65
						</dt>
66
						<dd>
67
							<select name="position" size="10" style="width: 22%;" onchange="this.form.position.disabled = this.options[this.selectedIndex].value == \'\';">';
68
69
	foreach (['after', 'child_of', 'before'] as $v)
70
		printf('
71
								<option value="%s"%s>%s...</option>',
72
			$v,
73
			$context['button_data']['position'] ==  $v ? ' selected="selected"' : '',
74
			$txt['um_menu_' . $v]);
75
76
	echo '
77
							</select>
78
							<select name="parent" size="10" style="width: 75%;">';
79
80
	foreach ($context['button_names'] as $idx => $title)
81
		printf('
82
								<option value="%s"%s>%s...</option>',
83
			$idx,
84
			$context['button_data']['position'] ==  $idx ? ' selected="selected"' : '',
85
			empty($title[0]) ? $title[1] : str_repeat('&emsp;', $title[0]) . $title[1]
86
		);
87
88
	echo '
89
							</select>
90
						</dd>
91
						<dt>
92
							<strong>', $txt['um_menu_button_type'], ':</strong>
93
						</dt>
94
						<dd>
95
							<input type="radio" class="input_check" name="type" value="forum"', $context['button_data']['type'] == 'forum' ? ' checked="checked"' : '', '/>', $txt['um_menu_forum'], '<br />
96
							<input type="radio" class="input_check" name="type" value="external"', $context['button_data']['type'] == 'external' ? ' checked="checked"' : '', '/>', $txt['um_menu_external'], '
97
						</dd>
98
						<dt>
99
							<strong>', $txt['um_menu_link_type'], ':</strong>
100
						</dt>
101
						<dd>
102
							<input type="radio" class="input_check" name="target" value="_self"', $context['button_data']['target'] == '_self' ? ' checked="checked"' : '', '/>', $txt['um_menu_same_window'], '<br />
103
							<input type="radio" class="input_check" name="target" value="_blank"', $context['button_data']['target'] == '_blank' ? ' checked="checked"' : '', '/>', $txt['um_menu_new_tab'], '
104
						</dd>
105
						<dt>
106
							<strong>', $txt['um_menu_button_link'], ':</strong><br />
107
						</dt>
108
						<dd>
109
							<input type="text" name="link" value="', $context['button_data']['link'], '" tabindex="1" class="input_text" style="width: 100%;" />
110
							<span class="smalltext">', $txt['um_menu_button_link_desc'], '</span>
111
						</dd>
112
						<dt>
113
							<strong>', $txt['um_menu_button_perms'], ':</strong>
114
						</dt>
115
						<dd>
116
							<fieldset id="group_perms">
117
								<legend><a href="#" onclick="this.parentNode.parentNode.style.display = \'none\';document.getElementById(\'group_perms_groups_link\').style.display = \'block\'; return false;">', $txt['avatar_select_permission'], '</a></legend>';
118
119
	foreach ($context['button_data']['permissions'] as $id => $permission)
120
	{
121
		echo '
122
								<label>
123
									<input type="checkbox" class="input_check" name="permissions[]" value="', $id, '"', $permission['checked'] ? ' checked="checked"' : '', ' />
124
									<span';
125
126
		if  ($permission['is_post_group'])
127
			echo ' title="' . $txt['mboards_groups_post_group'] . '"';
128
129
		echo '>', $permission['name'], '</span>
130
								</label>
131
								<br>';
132
	}
133
134
	echo '
135
								<input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'permissions[]\');" id="check_group_all"', $context['all_groups_checked'] ? ' checked="checked"' : '', ' />
136
								<label for="check_group_all"><em>', $txt['check_all'], '</em></label><br />
137
							</fieldset>
138
							<a href="#" onclick="document.getElementById(\'group_perms\').style.display = \'block\'; this.style.display = \'none\'; return false;" id="group_perms_groups_link" style="display: none;">[ ', $txt['avatar_select_permission'], ' ]</a>
139
							<script type="text/javascript"><!-- // --><![CDATA[
140
								document.getElementById("group_perms").style.display = "none";
141
								document.getElementById("group_perms_groups_link").style.display = "";
142
							// ]]></script>
143
						</dd>
144
						<dt>
145
							<strong>', $txt['um_menu_button_status'], ':</strong>
146
						</dt>
147
						<dd>
148
							<input type="radio" class="input_check" name="status" value="active"', $context['button_data']['status'] == 'active' ? ' checked="checked"' : '', ' />', $txt['um_menu_button_active'], ' <br />
149
							<input type="radio" class="input_check" name="status" value="inactive"', $context['button_data']['status'] == 'inactive' ? ' checked="checked"' : '', ' />', $txt['um_menu_button_inactive'], '
150
						</dd>
151
					</dl>';
152
}
153
154
function template_form_below()
155
{
156
	global $context, $txt;
157
158
	echo '
159
					<input name="in" value="', $context['button_data']['id'], '" type="hidden" />
160
					<div class="righttext padding">
161
						<input name="submit" value="', $txt['admin_manage_menu_submit'], '" class="button_submit" type="submit" />
162
					</div>
163
				</div>
164
			</form>
165
			<span class="lowerframe"><span></span></span>
166
			<br class="clear" />';
167
}