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