dolibarr  9.0.0
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 if($mode == 'edit' )
17 {
18  print '<form 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" align="center">'.$langs->trans('Busy').'</div>';
22  print '<div class="tagtd liste_titre" align="center">'.$langs->trans('Mandatory').'</div>';
23  print '<div class="tagtd liste_titre"></div>';
24  print '</form>';
25 }
26 else
27 {
28  print '<form class="tagtr liste_titre">';
29  print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
30  print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
31  print '<div class="tagtd liste_titre" align="center">'.$langs->trans('Busy').'</div>';
32  print '<div class="tagtd liste_titre" align="center">'.$langs->trans('Mandatory').'</div>';
33  print '<div class="tagtd liste_titre"></div>';
34  print '</form>';
35 }
36 
37 if( (array) $linked_resources && count($linked_resources) > 0)
38 {
39 
40  foreach ($linked_resources as $linked_resource)
41  {
42 
43  $object_resource = fetchObjectByElement($linked_resource['resource_id'],$linked_resource['resource_type']);
44 
45  //$element_id = $linked_resource['rowid'];
46 
47  if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid'))
48  {
49 
50  print '<form class="tagtr oddeven" action="'.$_SERVER["PHP_SELF"].'?element='.$element.'&element_id='.$element_id.'" method="POST">';
51  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
52  print '<input type="hidden" name="id" value="'.$object->id.'" />';
53  print '<input type="hidden" name="action" value="update_linked_resource" />';
54  print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
55  print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
56 
57  print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
58  print '<div class="tagtd">'.$object_resource->type_label.'</div>';
59  print '<div class="tagtd" align="center">'.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>';
60  print '<div class="tagtd" align="center">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
61  print '<div class="tagtd" align="right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
62  print '</form>';
63  }
64  else
65  {
66  $style='';
67  if ($linked_resource['rowid'] == GETPOST('lineid'))
68  $style='style="background: orange;"';
69 
70  print '<form class="tagtr oddeven" '.$style.'>';
71 
72  print '<div class="tagtd">';
73  print $object_resource->getNomUrl(1);
74  print '</div>';
75 
76  print '<div class="tagtd">';
77  print $object_resource->type_label;
78  print '</div>';
79 
80  print '<div class="tagtd" align="center">';
81  print yn($linked_resource['busy']);
82  print '</div>';
83 
84  print '<div class="tagtd" align="center">';
85  print yn($linked_resource['mandatory']);
86  print '</div>';
87 
88  print '<div class="tagtd" align="right">';
89  print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
90  print img_edit();
91  print '</a>';
92  print '&nbsp;';
93  print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
94  print img_delete();
95  print '</a>';
96  print '</div>';
97 
98  print '</form>';
99  }
100  }
101 }
102 else {
103  print '<form class="tagtr oddeven">';
104  print '<div class="tagtd opacitymedium">'.$langs->trans('NoResourceLinked').'</div>';
105  print '<div class="tagtd opacitymedium"></div>';
106  print '<div class="tagtd opacitymedium"></div>';
107  print '<div class="tagtd opacitymedium"></div>';
108  print '<div class="tagtd opacitymedium"></div>';
109  print '</form>';
110 }
111 
112 print '</div>';
113 
114 ?>
115 <!-- END TEMPLATE resource_view.tpl.php -->
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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.
fetchObjectByElement($element_id, $element_type, $element_ref='')
Fetch an object from its id and element_type Inclusion of classes is automatic.
Class to manage generation of HTML components Only common components must be here.