2015-11-22 12:23:10 +01:00
|
|
|
<!-- BEGIN TEMPLATE resource_view.tpl.php -->
|
2014-01-02 07:07:43 +01:00
|
|
|
<?php
|
2017-12-21 13:32:16 +01:00
|
|
|
// Protection to avoid direct call of template
|
2021-02-23 22:03:23 +01:00
|
|
|
if (empty($conf) || !is_object($conf)) {
|
2017-12-21 13:32:16 +01:00
|
|
|
print "Error, template page can't be called as URL";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-02 07:07:43 +01:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$form = new Form($db);
|
2014-01-02 07:07:43 +01:00
|
|
|
|
|
|
|
|
|
2016-06-07 13:15:38 +02:00
|
|
|
print '<div class="tagtable centpercent noborder allwidth">';
|
|
|
|
|
|
2019-05-20 12:16:39 +02:00
|
|
|
print '<form method="POST" class="tagtable centpercent noborder borderbottom allwidth">';
|
2019-03-05 13:04:54 +01:00
|
|
|
|
|
|
|
|
print '<div class="tagtr liste_titre">';
|
|
|
|
|
print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
|
|
|
|
|
print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
|
|
|
|
|
print '<div class="tagtd liste_titre center">'.$langs->trans('Busy').'</div>';
|
|
|
|
|
print '<div class="tagtd liste_titre center">'.$langs->trans('Mandatory').'</div>';
|
|
|
|
|
print '<div class="tagtd liste_titre"></div>';
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
2019-12-18 23:12:31 +01:00
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
2019-03-05 13:04:54 +01:00
|
|
|
print '<input type="hidden" name="id" value="'.$element_id.'" />';
|
|
|
|
|
print '<input type="hidden" name="action" value="update_linked_resource" />';
|
|
|
|
|
print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
|
2016-06-07 13:15:38 +02:00
|
|
|
|
2021-02-23 22:03:23 +01:00
|
|
|
if ((array) $linked_resources && count($linked_resources) > 0) {
|
|
|
|
|
foreach ($linked_resources as $linked_resource) {
|
2019-01-27 11:55:16 +01:00
|
|
|
$object_resource = fetchObjectByElement($linked_resource['resource_id'], $linked_resource['resource_type']);
|
2017-12-21 13:32:16 +01:00
|
|
|
|
2015-12-05 19:20:39 +01:00
|
|
|
//$element_id = $linked_resource['rowid'];
|
2017-12-21 13:32:16 +01:00
|
|
|
|
2021-04-25 15:55:36 +02:00
|
|
|
if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid', 'int')) {
|
2020-10-31 14:32:18 +01:00
|
|
|
print '<div class="tagtr oddeven">';
|
|
|
|
|
print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
|
|
|
|
|
print '<input type="hidden" name="element" value="'.$element.'" />';
|
2019-03-05 13:04:54 +01:00
|
|
|
print '<input type="hidden" name="element_id" value="'.$element_id.'" />';
|
2014-01-02 07:07:43 +01:00
|
|
|
|
|
|
|
|
print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
|
2015-11-22 12:23:10 +01:00
|
|
|
print '<div class="tagtd">'.$object_resource->type_label.'</div>';
|
2020-04-10 10:59:32 +02:00
|
|
|
print '<div class="tagtd center">'.$form->selectyesno('busy', $linked_resource['busy'] ? 1 : 0, 1).'</div>';
|
|
|
|
|
print '<div class="tagtd center">'.$form->selectyesno('mandatory', $linked_resource['mandatory'] ? 1 : 0, 1).'</div>';
|
2019-02-23 22:43:53 +01:00
|
|
|
print '<div class="tagtd right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
|
2019-03-05 13:04:54 +01:00
|
|
|
print '</div>';
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2020-04-10 10:59:32 +02:00
|
|
|
$class = '';
|
2021-04-25 15:55:36 +02:00
|
|
|
if ($linked_resource['rowid'] == GETPOST('lineid', 'int')) {
|
2020-04-10 10:59:32 +02:00
|
|
|
$class = 'highlight';
|
2021-02-23 22:03:23 +01:00
|
|
|
}
|
2014-01-02 07:07:43 +01:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
print '<div class="tagtr oddeven'.($class ? ' '.$class : '').'">';
|
2014-01-02 07:07:43 +01:00
|
|
|
|
|
|
|
|
print '<div class="tagtd">';
|
|
|
|
|
print $object_resource->getNomUrl(1);
|
2016-12-23 13:04:46 +01:00
|
|
|
print '</div>';
|
2014-01-02 07:07:43 +01:00
|
|
|
|
2015-11-22 12:23:10 +01:00
|
|
|
print '<div class="tagtd">';
|
|
|
|
|
print $object_resource->type_label;
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
2019-02-23 22:43:53 +01:00
|
|
|
print '<div class="tagtd center">';
|
2015-05-31 02:05:39 +02:00
|
|
|
print yn($linked_resource['busy']);
|
2014-01-02 07:07:43 +01:00
|
|
|
print '</div>';
|
|
|
|
|
|
2019-02-23 22:43:53 +01:00
|
|
|
print '<div class="tagtd center">';
|
2015-05-31 02:05:39 +02:00
|
|
|
print yn($linked_resource['mandatory']);
|
2014-01-02 07:07:43 +01:00
|
|
|
print '</div>';
|
|
|
|
|
|
2019-02-23 22:43:53 +01:00
|
|
|
print '<div class="tagtd right">';
|
2020-10-01 10:50:54 +02:00
|
|
|
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'].'">';
|
2014-11-23 21:03:34 +01:00
|
|
|
print img_edit();
|
|
|
|
|
print '</a>';
|
|
|
|
|
print ' ';
|
2020-10-01 10:50:54 +02:00
|
|
|
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'].'">';
|
2019-06-17 18:44:08 +02:00
|
|
|
print img_picto($langs->trans("Unlink"), 'unlink');
|
2014-11-23 21:03:34 +01:00
|
|
|
print '</a>';
|
2014-01-02 07:07:43 +01:00
|
|
|
print '</div>';
|
|
|
|
|
|
2019-03-05 13:04:54 +01:00
|
|
|
print '</div>';
|
2014-01-02 07:07:43 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2019-03-05 13:04:54 +01:00
|
|
|
print '<div class="tagtr oddeven">';
|
2016-09-19 10:43:30 +02:00
|
|
|
print '<div class="tagtd opacitymedium">'.$langs->trans('NoResourceLinked').'</div>';
|
|
|
|
|
print '<div class="tagtd opacitymedium"></div>';
|
|
|
|
|
print '<div class="tagtd opacitymedium"></div>';
|
|
|
|
|
print '<div class="tagtd opacitymedium"></div>';
|
|
|
|
|
print '<div class="tagtd opacitymedium"></div>';
|
2019-03-05 13:04:54 +01:00
|
|
|
print '</div>';
|
2014-01-02 07:07:43 +01:00
|
|
|
}
|
2016-06-07 13:15:38 +02:00
|
|
|
|
2019-03-05 13:04:54 +01:00
|
|
|
print '</form>';
|
|
|
|
|
|
2016-06-07 13:15:38 +02:00
|
|
|
print '</div>';
|
|
|
|
|
|
2015-11-22 12:23:10 +01:00
|
|
|
?>
|
|
|
|
|
<!-- END TEMPLATE resource_view.tpl.php -->
|