forked from sydcode/custom_attributes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_form_fields.php
57 lines (57 loc) · 2.21 KB
/
search_form_fields.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
<?php
if ( !defined('ABS_PATH') ) {
exit('ABS_PATH is not loaded. Direct access is not allowed.');
}
?>
<fieldset class='box show_only'>
<?php
foreach ($fields as $field) {
if (empty($field['b_search'])) {
continue;
}
$id = $field['pk_i_id'];
$label = $field['s_label'];
$type = $field['s_type'];
$search_limits = $field['b_search_limits'];
if ($search_limits) {
$name_min = 'min_field_' . $id;
$name_max = 'max_field_' . $id;
$class = 'row two_input';
$value_min = Params::getParam($name_min);
$value_max = Params::getParam($name_max);
} else {
$name = 'field_' . $id;
$class = 'row one_input';
$value = Params::getParam($name);
}
?>
<div class='<?php echo $class; ?>'>
<h6><?php echo $label; ?></h6>
<?php if ($type == 'checkbox') { ?>
<?php $checked = ($value == 'checked') ? " checked='checked'" : ''; ?>
<input class='search_checkbox' type='checkbox' id='<?php echo $name; ?>' name='<?php echo $name; ?>' value='checked'<?php echo $checked; ?> />
<label class='search_label' for='<?php echo $name; ?>'><?php _e('Check to show listings', CA_PLUGIN_NAME); ?></label>
<?php } elseif ($type == 'date') { ?>
<input class='search_date' type='text' name='<?php echo $name; ?>' value='<?php echo $value; ?>' />
<?php } elseif ($type == 'radio') { ?>
<?php $this->radio_buttons($id, $name, $value, null, true); ?>
<?php } elseif ($type == 'select') { ?>
<select class='search_select' name='<?php echo $name; ?>'>
<?php $this->select_options($id, $value); ?>
</select>
<?php } elseif ($type == 'text') { ?>
<?php if ($search_limits) { ?>
<div class='search_limits'>
<label>Min:</label><input class='search_smalltext' type='text' name='<?php echo $name_min; ?>' value='<?php echo $value_min; ?>' />
<label class='search_maximum'>Max:</label><input class='search_smalltext' type='text' name='<?php echo $name_max; ?>' value='<?php echo $value_max; ?>' />
</div>
<?php } else { ?>
<input type='text' name='<?php echo $name; ?>' value='<?php echo $value; ?>' />
<?php } ?>
<?php } elseif ($type == 'textarea') { ?>
<textarea class='search_textarea' name='<?php echo $name; ?>'><?php echo $value; ?></textarea>
<?php } ?>
</div>
<?php } ?>
</fieldset>
<?php //END