1<!-- BEGIN TEMPLATE resource_view.tpl.php -->
6if (empty($conf) || !is_object($conf)) {
7 print
"Error, template page can't be called as URL";
12@phan-var-force string $element
13@phan-var-force int $element_id
14@phan-var-force string $resource_type
15@phan-var-force array<array{rowid:int,resource_id:int,resource_type:string,busy:int<0,1>,mandatory:int<0,1>}> $linked_resources
22print
'<div class="tagtable centpercent noborder allwidth">';
24print
'<form method="POST" class="tagtable centpercent noborder borderbottom allwidth">';
26print
'<div class="tagtr liste_titre">';
27print
'<div class="tagtd liste_titre">'.$langs->trans(
'Resource').
'</div>';
28print
'<div class="tagtd liste_titre">'.$langs->trans(
'Type').
'</div>';
29print
'<div class="tagtd liste_titre center">'.$langs->trans(
'Busy').
'</div>';
30print
'<div class="tagtd liste_titre center">'.$langs->trans(
'Mandatory').
'</div>';
31print
'<div class="tagtd liste_titre"></div>';
34print
'<input type="hidden" name="token" value="'.newToken().
'" />';
35print
'<input type="hidden" name="id" value="'.$element_id.
'" />';
36print
'<input type="hidden" name="action" value="update_linked_resource" />';
37print
'<input type="hidden" name="resource_type" value="'.$resource_type.
'" />';
39if ((array) $linked_resources && count($linked_resources) > 0) {
40 foreach ($linked_resources as $linked_resource) {
41 $object_resource =
fetchObjectByElement($linked_resource[
'resource_id'], $linked_resource[
'resource_type']);
45 if ($mode ==
'edit' && $linked_resource[
'rowid'] ==
GETPOSTINT(
'lineid')) {
46 print
'<div class="tagtr oddeven">';
47 print
'<input type="hidden" name="lineid" value="'.$linked_resource[
'rowid'].
'" />';
48 print
'<input type="hidden" name="element" value="'.$element.
'" />';
49 print
'<input type="hidden" name="element_id" value="'.$element_id.
'" />';
51 print
'<div class="tagtd">'.$object_resource->getNomUrl(1).
'</div>';
52 print
'<div class="tagtd">'.$object_resource->type_label.
'</div>';
53 print
'<div class="tagtd center">'.$form->selectyesno(
'busy', $linked_resource[
'busy'] ? 1 : 0, 1).
'</div>';
54 print
'<div class="tagtd center">'.$form->selectyesno(
'mandatory', $linked_resource[
'mandatory'] ? 1 : 0, 1).
'</div>';
55 print
'<div class="tagtd right"><input type="submit" class="button" value="'.$langs->trans(
"Update").
'"></div>';
59 if ($linked_resource[
'rowid'] ==
GETPOSTINT(
'lineid')) {
63 print
'<div class="tagtr oddeven'.($class ?
' '.$class :
'').
'">';
65 print
'<div class="tagtd">';
66 print $object_resource->getNomUrl(1);
69 print
'<div class="tagtd">';
70 print $object_resource->type_label;
73 print
'<div class="tagtd center">';
74 print
yn($linked_resource[
'busy']);
77 print
'<div class="tagtd center">';
78 print
yn($linked_resource[
'mandatory']);
81 print
'<div class="tagtd right">';
82 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'].
'">';
86 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'].
'">';
87 print
img_picto($langs->trans(
"Unlink"),
'unlink');
95 print
'<div class="tagtr oddeven">';
96 print
'<div class="tagtd opacitymedium">'.$langs->trans(
'NoResourceLinked').
'</div>';
97 print
'<div class="tagtd opacitymedium"></div>';
98 print
'<div class="tagtd opacitymedium"></div>';
99 print
'<div class="tagtd opacitymedium"></div>';
100 print
'<div class="tagtd opacitymedium"></div>';
109<!-- END TEMPLATE resource_view.tpl.php -->
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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.