dolibarr 19.0.3
extrafields_list_search_param.tpl.php
1<?php
2
3// Protection to avoid direct call of template
4if (empty($conf) || !is_object($conf)) {
5 print "Error, template page can't be called as URL";
6 exit;
7}
8
9// Loop to complete $param for extrafields
10if (!empty($search_array_options) && is_array($search_array_options)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
11 if (empty($search_options_pattern)) {
12 $search_options_pattern = 'search_options_';
13 }
14
15 foreach ($search_array_options as $key => $val) {
16 $crit = $val;
17 $tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
18 if (is_array($val) && array_key_exists('start', $val) && array_key_exists('end', $val)) {
19 // date range from list filters is stored as array('start' => <timestamp>, 'end' => <timestamp>)
20 // start date
21 $param .= '&'.$search_options_pattern.$tmpkey.'_startyear='.dol_print_date($val['start'], '%Y');
22 $param .= '&'.$search_options_pattern.$tmpkey.'_startmonth='.dol_print_date($val['start'], '%m');
23 $param .= '&'.$search_options_pattern.$tmpkey.'_startday='.dol_print_date($val['start'], '%d');
24 $param .= '&'.$search_options_pattern.$tmpkey.'_starthour='.dol_print_date($val['start'], '%H');
25 $param .= '&'.$search_options_pattern.$tmpkey.'_startmin='.dol_print_date($val['start'], '%M');
26 // end date
27 $param .= '&'.$search_options_pattern.$tmpkey.'_endyear='.dol_print_date($val['end'], '%Y');
28 $param .= '&'.$search_options_pattern.$tmpkey.'_endmonth='.dol_print_date($val['end'], '%m');
29 $param .= '&'.$search_options_pattern.$tmpkey.'_endday='.dol_print_date($val['end'], '%d');
30 $param .= '&'.$search_options_pattern.$tmpkey.'_endhour='.dol_print_date($val['end'], '%H');
31 $param .= '&'.$search_options_pattern.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M');
32 $val = '';
33 }
34 if ($val !== '') {
35 if (is_array($val)) {
36 foreach ($val as $val2) {
37 $param .= '&'.$search_options_pattern.$tmpkey.'[]='.urlencode($val2);
38 }
39 } else {
40 $param .= '&'.$search_options_pattern.$tmpkey.'='.urlencode($val);
41 }
42 }
43 }
44}
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).