dolibarr 19.0.3
extrafields_list_search_input.tpl.php
1<?php
2
3print '<!-- extrafields_list_search_input.tpl.php -->'."\n";
4
5// Protection to avoid direct call of template
6if (empty($conf) || !is_object($conf)) {
7 print "Error, template page can't be called as URL";
8 exit;
9}
10
11if (empty($extrafieldsobjectkey) && is_object($object)) {
12 $extrafieldsobjectkey = $object->table_element;
13}
14
15// Loop to show all columns of extrafields for the search title line
16if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
17 if (!empty($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) {
18 if (empty($extrafieldsobjectprefix)) {
19 $extrafieldsobjectprefix = 'ef.';
20 }
21 if (empty($search_options_pattern)) {
22 $search_options_pattern = 'search_options_';
23 }
24
25 foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) {
26 if (!empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
27 $cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey);
28 $typeofextrafield = $extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
29
30 print '<td class="liste_titre'.($cssclass ? ' '.$cssclass : '').'">';
31 $tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
32 if (in_array($typeofextrafield, array('varchar', 'mail', 'ip', 'url', 'int', 'double')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) {
33 $searchclass = '';
34 if (in_array($typeofextrafield, array('varchar', 'mail', 'ip', 'url'))) {
35 $searchclass = 'searchstring';
36 }
37 if (in_array($typeofextrafield, array('int', 'double'))) {
38 $searchclass = 'searchnum';
39 }
40 print '<input class="flat'.($searchclass ? ' '.$searchclass : '').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag((empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey])).'">';
41 } elseif (in_array($typeofextrafield, array('date', 'datetime', 'timestamp'))) {
42 $morecss = '';
43 $preselectedvalues = (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]);
44 // Here $preselectedvalues can be an array('start'=>int, 'end'=>int) or an int
45 echo $extrafields->showInputField($key, $preselectedvalues, '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
46 } else {
47 // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
48 $morecss = '';
49 if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) {
50 $morecss = 'maxwidth200';
51 }
52 echo $extrafields->showInputField($key, (!isset($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
53 }
54 print '</td>';
55 }
56 }
57 }
58}
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...