dolibarr  17.0.4
extrafields_list_search_input.tpl.php
1 <?php
2 
3 print '<!-- extrafields_list_search_input.tpl.php -->'."\n";
4 
5 // Protection to avoid direct call of template
6 if (empty($conf) || !is_object($conf)) {
7  print "Error, template page can't be called as URL";
8  exit;
9 }
10 
11 if (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
16 if (!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('datetime', 'timestamp'))) {
42  $morecss = '';
43  echo $extrafields->showInputField($key, (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
44  } else {
45  // 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')
46  $morecss = '';
47  if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) {
48  $morecss = 'maxwidth200';
49  }
50  echo $extrafields->showInputField($key, (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
51  }
52  print '</td>';
53  }
54  }
55  }
56 }
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.