dolibarr  19.0.0-dev
resource_view.tpl.php
1 <!-- BEGIN TEMPLATE resource_view.tpl.php -->
2 <?php
3 // Protection to avoid direct call of template
4 if (empty($conf) || !is_object($conf)) {
5  print "Error, template page can't be called as URL";
6  exit;
7 }
8 
9 
10 $form = new Form($db);
11 
12 
13 print '<div class="tagtable centpercent noborder allwidth">';
14 
15 print '<form method="POST" class="tagtable centpercent noborder borderbottom allwidth">';
16 
17 print '<div class="tagtr liste_titre">';
18 print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
19 print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
20 print '<div class="tagtd liste_titre center">'.$langs->trans('Busy').'</div>';
21 print '<div class="tagtd liste_titre center">'.$langs->trans('Mandatory').'</div>';
22 print '<div class="tagtd liste_titre"></div>';
23 print '</div>';
24 
25 print '<input type="hidden" name="token" value="'.newToken().'" />';
26 print '<input type="hidden" name="id" value="'.$element_id.'" />';
27 print '<input type="hidden" name="action" value="update_linked_resource" />';
28 print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
29 
30 if ((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'] == GETPOST('lineid', 'int')) {
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'] == GETPOST('lineid', 'int')) {
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 
95 print '</form>';
96 
97 print '</div>';
98 
99 ?>
100 <!-- END TEMPLATE resource_view.tpl.php -->
Class to manage generation of HTML components Only common components must be here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
fetchObjectByElement($element_id, $element_type, $element_ref='')
Fetch an object from its id and element_type Inclusion of classes is automatic.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.