1 <?php
2 3 4 5 6 7
8
9 defined('FOF_INCLUDED') or die;
10
11 12 13 14 15 16
17 class extends FOFFormHeaderField
18 {
19 20 21 22 23
24 protected function getFilter()
25 {
26
27 $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
28 $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : '';
29 $filterclass = $this->element['filterclass'] ? ' class="' . (string) $this->element['filterclass'] . '"' : '';
30 $placeholder = $this->element['placeholder'] ? $this->element['placeholder'] : $this->getLabel();
31 $name = $this->element['searchfieldname'] ? $this->element['searchfieldname'] : $this->name;
32 $placeholder = ' placeholder="' . JText::_($placeholder) . '"';
33
34 if ($this->element['searchfieldname'])
35 {
36 $model = $this->form->getModel();
37 $searchvalue = $model->getState((string) $this->element['searchfieldname']);
38 }
39 else
40 {
41 $searchvalue = $this->value;
42 }
43
44
45 if ($this->element['onchange'])
46 {
47 $onchange = ' onchange="' . (string) $this->element['onchange'] . '"';
48 }
49 else
50 {
51 $onchange = ' onchange="document.adminForm.submit();"';
52 }
53
54 return '<input type="text" name="' . $name . '" id="' . $this->id . '"' . ' value="'
55 . htmlspecialchars($searchvalue, ENT_COMPAT, 'UTF-8') . '"' . $filterclass . $size . $placeholder . $onchange . $maxLength . '/>';
56 }
57
58 59 60 61 62
63 protected function getButtons()
64 {
65 $buttonclass = $this->element['buttonclass'] ? (string) $this->element['buttonclass'] : 'btn hasTip hasTooltip';
66 $buttonsState = strtolower($this->element['buttons']);
67 $show_buttons = !in_array($buttonsState, array('no', 'false', '0'));
68
69 if (!$show_buttons)
70 {
71 return '';
72 }
73
74 $html = '';
75
76 $html .= '<button class="' . $buttonclass . '" onclick="this.form.submit();" title="' . JText::_('JSEARCH_FILTER') . '" >' . "\n";
77 $html .= '<i class="icon-search"></i>';
78 $html .= '</button>' . "\n";
79 $html .= '<button class="' . $buttonclass . '" onclick="document.adminForm.' . $this->id . '.value=\'\';this.form.submit();" title="' . JText::_('JSEARCH_RESET') . '">' . "\n";
80 $html .= '<i class="icon-remove"></i>';
81 $html .= '</button>' . "\n";
82
83 return $html;
84 }
85 }
86