dolibarr  7.0.0-beta
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  $var=true;
40 
41  foreach ($linked_resources as $linked_resource)
42  {
43 
44  $object_resource = fetchObjectByElement($linked_resource['resource_id'],$linked_resource['resource_type']);
45 
46  //$element_id = $linked_resource['rowid'];
47 
48  if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid'))
49  {
50 
51  print '<form class="tagtr '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'?element='.$element.'&element_id='.$element_id.'" method="POST">';
52  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
53  print '<input type="hidden" name="id" value="'.$object->id.'" />';
54  print '<input type="hidden" name="action" value="update_linked_resource" />';
55  print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
56  print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
57 
58  print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
59  print '<div class="tagtd">'.$object_resource->type_label.'</div>';
60  print '<div class="tagtd" align="center">'.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>';
61  print '<div class="tagtd" align="center">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
62  print '<div class="tagtd" align="right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
63  print '</form>';
64  }
65  else
66  {
67  $style='';
68  if ($linked_resource['rowid'] == GETPOST('lineid'))
69  $style='style="background: orange;"';
70 
71  print '<form class="tagtr '.($var==true?"pair":"impair").'" '.$style.'>';
72 
73  print '<div class="tagtd">';
74  print $object_resource->getNomUrl(1);
75  print '</div>';
76 
77  print '<div class="tagtd">';
78  print $object_resource->type_label;
79  print '</div>';
80 
81  print '<div class="tagtd" align="center">';
82  print yn($linked_resource['busy']);
83  print '</div>';
84 
85  print '<div class="tagtd" align="center">';
86  print yn($linked_resource['mandatory']);
87  print '</div>';
88 
89  print '<div class="tagtd" align="right">';
90  print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
91  print img_edit();
92  print '</a>';
93  print '&nbsp;';
94  print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
95  print img_delete();
96  print '</a>';
97  print '</div>';
98 
99  print '</form>';
100  }
101  }
102 
103 }
104 else {
105  print '<form class="tagtr '.($var==true?"pair":"impair").'">';
106  print '<div class="tagtd opacitymedium">'.$langs->trans('NoResourceLinked').'</div>';
107  print '<div class="tagtd opacitymedium"></div>';
108  print '<div class="tagtd opacitymedium"></div>';
109  print '<div class="tagtd opacitymedium"></div>';
110  print '<div class="tagtd opacitymedium"></div>';
111  print '</form>';
112 }
113 
114 print '</div>';
115 
116 ?>
117 <!-- END TEMPLATE resource_view.tpl.php -->
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $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.
Class to manage generation of HTML components Only common components must be here.
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.