note.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. /* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
  4. * Copyright (C) 2016 Laurent Destailleur <aldy@users.sourceforge.net>
  5. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  6. * Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/resource/note.php
  23. * \ingroup fichinter
  24. * \brief Fiche d'information sur une resource
  25. */
  26. require '../main.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array('companies', 'interventions'));
  31. $id = GETPOST('id', 'int');
  32. $ref = GETPOST('ref', 'alpha');
  33. $action = GETPOST('action', 'aZ09');
  34. // Security check
  35. if ($user->socid) {
  36. $socid = $user->socid;
  37. }
  38. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  39. $hookmanager->initHooks(array('resourcenote'));
  40. $object = new DolResource($db);
  41. // Load object
  42. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
  43. $result = restrictedArea($user, 'resource', $object->id, 'resource');
  44. $permissionnote = $user->rights->resource->write; // Used by the include of actions_setnotes.inc.php
  45. /*
  46. * Actions
  47. */
  48. $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
  49. if ($reshook < 0) {
  50. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  51. }
  52. if (empty($reshook)) {
  53. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
  54. }
  55. /*
  56. * View
  57. */
  58. llxHeader();
  59. $form = new Form($db);
  60. if ($id > 0 || !empty($ref)) {
  61. $head = resource_prepare_head($object);
  62. print dol_get_fiche_head($head, 'note', $langs->trans('ResourceSingular'), -1, 'resource');
  63. $linkback = '<a href="'.DOL_URL_ROOT.'/resource/list.php'.(!empty($socid) ? '?id='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
  64. $morehtmlref = '<div class="refidno">';
  65. $morehtmlref .= '</div>';
  66. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  67. print '<div class="fichecenter">';
  68. print '<div class="underbanner clearboth"></div>';
  69. print '<table class="border tableforfield centpercent">';
  70. // Resource type
  71. print '<tr>';
  72. print '<td class="titlefield">'.$langs->trans("ResourceType").'</td>';
  73. print '<td>';
  74. print $object->type_label;
  75. print '</td>';
  76. print '</tr>';
  77. print "</table>";
  78. print '</div>';
  79. $permission = $user->rights->resource->write;
  80. $cssclass = 'titlefield';
  81. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  82. print dol_get_fiche_end();
  83. }
  84. // End of page
  85. llxFooter();
  86. $db->close();