4 |
## $Id$ |
## $Id$ |
5 |
## ----------------------------------------------------------------------------- |
## ----------------------------------------------------------------------------- |
6 |
## $Log$ |
## $Log$ |
7 |
|
## Revision 1.5 2003/04/08 17:33:22 jonen |
8 |
|
## + fixed problems with hidden form fields(current base URL) at the 'simple search form' |
9 |
|
## |
10 |
## Revision 1.4 2003/04/06 01:41:07 jonen |
## Revision 1.4 2003/04/06 01:41:07 jonen |
11 |
## - removed duplicated decode functions |
## - removed duplicated decode functions |
12 |
## |
## |
263 |
} |
} |
264 |
|
|
265 |
|
|
266 |
|
/** |
267 |
|
* This function builds the simple search TD |
268 |
|
* |
269 |
|
* @return ContainerWidget |
270 |
|
*/ |
271 |
|
function _build_simple_search_form() { |
272 |
|
|
273 |
|
//if there is only 1 item enabled for search |
274 |
|
//then the search looks simple. |
275 |
|
$fields = $this->_get_searchable_fields(); |
276 |
|
$cnt = count($fields); |
277 |
|
if ($cnt == 0) { |
278 |
|
return NULL; |
279 |
|
} |
280 |
|
|
281 |
|
$container = new ContainerWidget; |
282 |
|
|
283 |
|
if ($cnt == 1) { |
284 |
|
//user only has 1 field to show. |
285 |
|
list($name, $field) = each($fields); |
286 |
|
$container->push("Find ".$name." "); |
287 |
|
} else { |
288 |
|
//user has many fields to show. |
289 |
|
$container->push("Find ", |
290 |
|
form_select($this->_vars["search_fieldVar"], $fields, $this->search_field())); |
291 |
|
} |
292 |
|
|
293 |
|
if ($this->get_simple_search_modifier()) { |
294 |
|
//the user wants the search modifier turned on. |
295 |
|
$container->push($this->_build_simple_search_modifier()); |
296 |
|
} |
297 |
|
|
298 |
|
$container->push(form_text($this->_vars["search_valueVar"], $this->search_value_filter($this->search_value()), "20", "100", array("style"=>"vertical-align:middle;")), |
299 |
|
form_submit($this->get_form_name(), "Search", array("style"=>"vertical-align:middle;"))); |
300 |
|
|
301 |
|
if ($this->is_advanced_search_enabled()) { |
302 |
|
$span = html_span(html_a("ass","Advanced Search", "title")); |
303 |
|
$container->push(" ", $span); |
304 |
|
} |
305 |
|
|
306 |
|
if ($cnt == 1) { |
307 |
|
$container->push(form_hidden($this->_vars["search_fieldVar"], $field)); |
308 |
|
} |
309 |
|
|
310 |
|
// find variables attached at base URL and add them as hidden fields, |
311 |
|
// so the search method will reach its starting point at deep frameworks |
312 |
|
$base_url = $this->build_base_url(); |
313 |
|
$url_vars = split("&", $base_url); |
314 |
|
$tmp = split("\?", $url_vars[0]); |
315 |
|
$url_vars[0] = $tmp[1]; |
316 |
|
if(is_array($url_vars)) { |
317 |
|
foreach($url_vars as $value) { |
318 |
|
$var = split("=", $value); |
319 |
|
$container->push(form_hidden($var[0], $var[1])); |
320 |
|
} |
321 |
|
} |
322 |
|
|
323 |
|
$container->push(form_close() ); |
324 |
|
return $container; |
325 |
|
} |
326 |
|
|
327 |
|
|
328 |
} |
} |