dolibarr  9.0.0
admin_extrafields_view.tpl.php
1 <?php
2 /* Copyright (C) 2010-2018 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2012-2017 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 /* To call this template, you must define
21  * $textobject
22  * $langs
23  * $extrafield
24  * $elementtype
25  */
26 
27 // Protection to avoid direct call of template
28 if (empty($langs) || ! is_object($langs))
29 {
30  print "Error, template page can't be called as URL";
31  exit;
32 }
33 
34 
35 $langs->load("modulebuilder");
36 
37 ?>
38 
39 <!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php -->
40 <?php
41 
42 print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
43 print '<br>';
44 
45 // Load attribute_label
46 $extrafields->fetch_name_optionals_label($elementtype);
47 
48 print '<div class="div-table-responsive">';
49 print '<table summary="listofattributes" class="noborder" width="100%">';
50 
51 print '<tr class="liste_titre">';
52 print '<td align="left">'.$langs->trans("Position");
53 print '<span class="nowrap">';
54 print img_picto('A-Z', '1downarrow.png');
55 print '</span>';
56 print '</td>';
57 print '<td>'.$langs->trans("LabelOrTranslationKey").'</td>';
58 print '<td>'.$langs->trans("TranslationString").'</td>';
59 print '<td>'.$langs->trans("AttributeCode").'</td>';
60 print '<td>'.$langs->trans("Type").'</td>';
61 print '<td align="right">'.$langs->trans("Size").'</td>';
62 print '<td>'.$langs->trans("ComputedFormula").'</td>';
63 print '<td align="center">'.$langs->trans("Unique").'</td>';
64 print '<td align="center">'.$langs->trans("Required").'</td>';
65 print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
66 print '<td align="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</td>';
67 print '<td align="center">'.$form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")).'</td>';
68 if ($conf->multicompany->enabled) {
69  print '<td align="center">'.$langs->trans("Entities").'</td>';
70 }
71 print '<td width="80">&nbsp;</td>';
72 print "</tr>\n";
73 
74 if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafields->attributes[$elementtype]['type']))
75 {
76  foreach($extrafields->attributes[$elementtype]['type'] as $key => $value)
77  {
78  // Load language if required
79  if (! empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
80  $langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);
81  }
82 
83  print '<tr class="oddeven">';
84  print "<td>".$extrafields->attributes[$elementtype]['pos'][$key]."</td>\n";
85  print "<td>".$extrafields->attributes[$elementtype]['label'][$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
86  print "<td>".$langs->trans($extrafields->attributes[$elementtype]['label'][$key])."</td>\n";
87  print "<td>".$key."</td>\n";
88  print "<td>".$type2label[$extrafields->attributes[$elementtype]['type'][$key]]."</td>\n";
89  print '<td align="right">'.$extrafields->attributes[$elementtype]['size'][$key]."</td>\n";
90  print '<td>'.dol_trunc($extrafields->attributes[$elementtype]['computed'][$key], 20)."</td>\n";
91  print '<td align="center">'.yn($extrafields->attributes[$elementtype]['unique'][$key])."</td>\n";
92  print '<td align="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n";
93  print '<td align="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n";
94  print '<td align="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n";
95  print '<td align="center">'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."</td>\n";
96  if (! empty($conf->multicompany->enabled)) {
97  print '<td align="center">'.($extrafields->attributes[$elementtype]['entityid'][$key]==0?$langs->trans("All"):$extrafields->attributes[$elementtype]['entitylabel'][$key]).'</td>';
98  }
99  print '<td class="right nowraponall""><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'#formeditextrafield">'.img_edit().'</a>';
100  print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
101  print "</tr>";
102  }
103 }
104 else
105 {
106  $colspan=9;
107 
108  print '<tr class="oddeven">';
109  print '<td class="opacitymedium" colspan="'.$colspan.'">';
110  print $langs->trans("None");
111  print '</td>';
112  print '</tr>';
113 }
114 
115 print "</table>";
116 print '</div>';
117 ?>
118 <!-- END PHP TEMPLATE admin_extrafields_view.tpl.php -->
print
Draft customers invoices.
Definition: index.php:91
img_edit($titlealt='default', $float=0, $other='class="pictoedit"')
Show logo editer/modifier fiche.
img_delete($titlealt='default', $other='class="pictodelete"')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it&#39;s its name (generic function)