forked from patrickmj/Corrections
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config_form.php
55 lines (51 loc) · 1.9 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
<div class="field">
<div class="two columns alpha">
<label><?php echo __('Email'); ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __('Email address to be notified about corrections (defaults to site admin)'); ?></p>
<div class="input-block">
<input type='text' value='<?php echo get_option('corrections_email'); ?>' name='corrections_email' />
</div>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label><?php echo __('Default text'); ?></label>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php echo __('Text for invitation to suggesting a correction'); ?></p>
<div class="input-block">
<input type='text' value='<?php echo get_option('corrections_text'); ?>' name='corrections_text' />
</div>
</div>
</div>
<p><?php echo __('Check the metadata fields that you want to make correctable by the public.'); ?></p>
<?php
$elTable = get_db()->getTable('Element');
$data = $elTable->findPairsForSelectForm();
$view = get_view();
$correctableElements = json_decode(get_option('corrections_elements'), true);
$values = array();
if(is_array($correctableElements)) {
foreach($correctableElements as $elSet=>$elements) {
foreach($elements as $element) {
$elObject = $elTable->findByElementSetNameAndElementName($elSet, $element);
$values[] = $elObject->id;
}
}
}
?>
<?php
if (get_option('show_element_set_headings') ) {
foreach($data as $elSet=>$options) {
echo "<div class='field'>";
echo "<h2>$elSet</h2>";
echo $view->formMultiCheckbox('element_sets', $values, null, $options, '');
echo "</div>";
}
} else {
echo "<div class='field no-headings'>";
echo $view->formMultiCheckbox('element_sets', $values, null, $data, '');
echo "</div>";
}