forked from AR2L/omeka-facets-plugin
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig_form.php
289 lines (280 loc) · 8.87 KB
/
config_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<?php
$view = get_view();
?>
<style type = "text/css">
.boxes, .boxes-left {
vertical-align: middle;
}
.boxes {
text-align: center;
}
.field select {
margin-bottom: 0;
}
</style>
<h2><?php echo __('Use'); ?></h2>
<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('facets_public_hook', __('Public Hooks')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('The hooks you want to use: Omeka\'s default <code>public_items_browse</code> and <code>public_collections_browse</code>, already coded into every page (so no changes are needed), normally showing up at the end of the page; or the plugin\'s own <code>public_facets</code>, that has to be coded into relevant theme pages but can be used wherever deemed right.'); ?>
</p>
<?php echo $view->formRadio('facets_public_hook',
get_option('facets_public_hook'),
null,
array(
'default' => 'public_items_browse & public_collections_browse',
'custom' => 'public_facets',
));
?>
</div>
</div>
<h2><?php echo __('Aspect'); ?></h2>
<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('facets_description', __('Description')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('If checked, a short description will be shown above all values.'); ?>
</p>
<?php echo $view->formCheckbox('facets_description', get_option('facets_description'), null, array('1', '0')); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('facets_count', __('Facet Count')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('For all checkbox style fields, the maximum amount of values to be displayed (0 means all values will be displayed).'); ?>
</p>
<?php echo $view->formText('facets_count', get_option('facets_count')); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('facets_direction', __('Block Layout')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('The layout direction of the facets block.'); ?>
</p>
<?php echo $view->formSelect(
'facets_direction',
get_option('facets_direction'),
array(),
array(
'horizontal' => __('Horizontal (useful for themes with top main navigation menu)'),
'vertical' => __('Vertical (useful for themes with side main navigation menu)')
));
?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('facets_collapsible', __('Collapsible Block')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('If checked, facets block will be collapsible (tip: as it saves space, it\'s particularly useful with horizontal theme layouts).'); ?>
</p>
<?php echo $view->formCheckbox('facets_collapsible', get_option('facets_collapsible'), null, array('1', '0')); ?>
</div>
</div>
<h2><?php echo __('Elements'); ?></h2>
<div class="field">
<div class="inputs seven columns omega">
<p class="explanation">
<?php echo __('The elements that can be used for search refinement. Item and Collection columns to (de)activate, Style column to choose the facet style, Sort order column to choose sorting order, Popularity column to show counters near names.'); ?>
</p>
<table id="facets_elements-table">
<thead>
<tr>
<th class="boxes"><?php echo __('Element Name'); ?></th>
<th class="boxes"><?php echo __('Item'); ?></th>
<th class="boxes"><?php echo __('Collection'); ?></th>
<th class="boxes"><?php echo __('Style'); ?></th>
<th class="boxes"><?php echo __('Sort Order'); ?></th>
<th class="boxes"><?php echo __('Popularity'); ?></th>
</tr>
</thead>
<tbody>
<?php
$current_element_set = null;
foreach ($elements as $element):
if ($element->set_name != $current_element_set):
$current_element_set = $element->set_name;
?>
<tr>
<th colspan="6">
<strong><?php echo __($current_element_set); ?></strong>
</th>
</tr>
<?php endif; ?>
<tr>
<td class="boxes-left"><?php echo __($element->name); ?></td>
<td class="boxes">
<?php
echo $view->formCheckbox(
"elements[{$element->name}][item]",
'1',
array(
'disableHidden' => true,
'checked' => (isset($settings['elements'][$element->name]['item']) && $settings['elements'][$element->name]['item'] == 1)
)
);
?>
</td>
<td class="boxes">
<?php
if ($element->set_name == 'Dublin Core') {
echo $view->formCheckbox(
"elements[{$element->name}][collection]",
'1',
array(
'disableHidden' => true,
'checked' => (isset($settings['elements'][$element->name]['collection']) && $settings['elements'][$element->name]['collection'] == 1)
)
);
} else {
echo " ";
}
?>
</td>
<td class="boxes">
<?php
$style = (isset($settings['elements'][$element->name]['style']) ? $settings['elements'][$element->name]['style'] : '');
echo $view->formSelect(
"elements[{$element->name}][style]",
$style,
array(),
array(
'dropdown' => __('Dropdown'),
'checkbox' => __('Checkbox')
)
);
?>
</td>
<td class="boxes">
<?php
$sortOrder = (isset($settings['elements'][$element->name]['sort']) ? $settings['elements'][$element->name]['sort'] : '');
echo $view->formSelect(
"elements[{$element->name}][sort]",
$sortOrder,
array(),
array(
'alpha' => __('Alphabetical'),
'count_alpha' => __('Popularity first, then alphabetical')
)
);
?>
</td>
<td class="boxes">
<?php
echo $view->formCheckbox(
"elements[{$element->name}][popularity]",
'1',
array(
'disableHidden' => true,
'checked' => (isset($settings['elements'][$element->name]['popularity']) && $settings['elements'][$element->name]['popularity'] == 1)
)
);
?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<th colspan="6">
<strong><?php echo __('Extra parameters'); ?></strong>
</th>
</tr>
<?php
$extraParameters = array(
'item_types' => array('label' => 'Item Type', 'collection' => 0),
'collections' => array('label' => 'Collection', 'collection' => 0),
'tags' => array('label' => 'Tags', 'collection' => 0),
'users' => array('label' => 'Owner', 'collection' => 1),
'public' => array('label' => 'Public', 'collection' => 1),
'featured' => array('label' => 'Featured', 'collection' => 1)
);
foreach ($extraParameters as $key => $value):
?>
<tr>
<td class="boxes-left"><?php echo __($value['label']); ?></td>
<td class="boxes">
<?php
echo $view->formCheckbox(
"{$key}[item]",
'1',
array(
'disableHidden' => true,
'checked' => (isset($settings[$key]['item']) && $settings[$key]['item'] == 1)
)
);
?>
</td>
<td class="boxes">
<?php
if ($value['collection']) {
echo $view->formCheckbox(
"{$key}[collection]",
'1',
array(
'disableHidden' => true,
'checked' => isset($settings[$key]['collection'])
)
);
} else {
echo " ";
}
?>
</td>
<td class="boxes">
<?php
$style = (isset($settings[$key]['style']) ? $settings[$key]['style'] : '');
echo $view->formSelect(
"{$key}[style]",
$style,
array(),
array(
'dropdown' => __('Dropdown'),
'checkbox' => __('Checkbox')
)
);
?>
</td>
<td class="boxes">
<?php
$sort = (isset($settings[$key]['sort']) ? $settings[$key]['sort'] : '');
echo $view->formSelect(
"{$key}[sort]",
$sort,
array(),
array(
'alpha' => __('Alphabetical'),
'count_alpha' => __('Popularity first, then alphabetical')
)
);
?>
</td>
<td class="boxes">
<?php
echo $view->formCheckbox(
"{$key}[popularity]",
'1',
array(
'disableHidden' => true,
'checked' => (isset($settings[$key]['popularity']) && $settings[$key]['popularity'] == 1)
)
);
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>