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