dolibarr 20.0.2
resource_view.tpl.php
1<!-- BEGIN TEMPLATE resource_view.tpl.php -->
2<?php
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(1);
7}
8
9
10$form = new Form($db);
11
12
13print '<div class="tagtable centpercent noborder allwidth">';
14
15print '<form method="POST" class="tagtable centpercent noborder borderbottom allwidth">';
16
17print '<div class="tagtr liste_titre">';
18print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
19print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
20print '<div class="tagtd liste_titre center">'.$langs->trans('Busy').'</div>';
21print '<div class="tagtd liste_titre center">'.$langs->trans('Mandatory').'</div>';
22print '<div class="tagtd liste_titre"></div>';
23print '</div>';
24
25print '<input type="hidden" name="token" value="'.newToken().'" />';
26print '<input type="hidden" name="id" value="'.$element_id.'" />';
27print '<input type="hidden" name="action" value="update_linked_resource" />';
28print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
29
30if ((array) $linked_resources && count($linked_resources) > 0) {
31 foreach ($linked_resources as $linked_resource) {
32 $object_resource = fetchObjectByElement($linked_resource['resource_id'], $linked_resource['resource_type']);
33
34 //$element_id = $linked_resource['rowid'];
35
36 if ($mode == 'edit' && $linked_resource['rowid'] == GETPOSTINT('lineid')) {
37 print '<div class="tagtr oddeven">';
38 print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
39 print '<input type="hidden" name="element" value="'.$element.'" />';
40 print '<input type="hidden" name="element_id" value="'.$element_id.'" />';
41
42 print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
43 print '<div class="tagtd">'.$object_resource->type_label.'</div>';
44 print '<div class="tagtd center">'.$form->selectyesno('busy', $linked_resource['busy'] ? 1 : 0, 1).'</div>';
45 print '<div class="tagtd center">'.$form->selectyesno('mandatory', $linked_resource['mandatory'] ? 1 : 0, 1).'</div>';
46 print '<div class="tagtd right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
47 print '</div>';
48 } else {
49 $class = '';
50 if ($linked_resource['rowid'] == GETPOSTINT('lineid')) {
51 $class = 'highlight';
52 }
53
54 print '<div class="tagtr oddeven'.($class ? ' '.$class : '').'">';
55
56 print '<div class="tagtd">';
57 print $object_resource->getNomUrl(1);
58 print '</div>';
59
60 print '<div class="tagtd">';
61 print $object_resource->type_label;
62 print '</div>';
63
64 print '<div class="tagtd center">';
65 print yn($linked_resource['busy']);
66 print '</div>';
67
68 print '<div class="tagtd center">';
69 print yn($linked_resource['mandatory']);
70 print '</div>';
71
72 print '<div class="tagtd right">';
73 print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=edit&token='.newToken().'&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
74 print img_edit();
75 print '</a>';
76 print '&nbsp;';
77 print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&token='.newToken().'&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
78 print img_picto($langs->trans("Unlink"), 'unlink');
79 print '</a>';
80 print '</div>';
81
82 print '</div>';
83 }
84 }
85} else {
86 print '<div class="tagtr oddeven">';
87 print '<div class="tagtd opacitymedium">'.$langs->trans('NoResourceLinked').'</div>';
88 print '<div class="tagtd opacitymedium"></div>';
89 print '<div class="tagtd opacitymedium"></div>';
90 print '<div class="tagtd opacitymedium"></div>';
91 print '<div class="tagtd opacitymedium"></div>';
92 print '</div>';
93}
94
95print '</form>';
96
97print '</div>';
98
99?>
100<!-- END TEMPLATE resource_view.tpl.php -->
Class to manage generation of HTML components Only common components must be here.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
fetchObjectByElement($element_id, $element_type, $element_ref='', $useCache=0, $maxCacheByType=10)
Fetch an object from its id and element_type Inclusion of classes is automatic.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.