info.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/comm/action/info.php
  20. * \ingroup agenda
  21. * \brief Page des informations d'une action
  22. */
  23. // Load Dolibarr environment
  24. require '../../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
  30. if (isModEnabled('project')) {
  31. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
  33. }
  34. // Load translation files required by the page
  35. $langs->load("commercial");
  36. $id = GETPOST('id', 'int');
  37. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  38. $hookmanager->initHooks(array('actioncard', 'globalcard'));
  39. // Security check
  40. if ($user->socid > 0) {
  41. $action = '';
  42. $socid = $user->socid;
  43. }
  44. $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
  45. if ($user->socid && $socid) {
  46. $result = restrictedArea($user, 'societe', $socid);
  47. }
  48. $usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'));
  49. /*
  50. * View
  51. */
  52. $form = new Form($db);
  53. $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
  54. llxHeader('', $langs->trans("Agenda"), $help_url);
  55. $object = new ActionComm($db);
  56. $object->fetch($id);
  57. $object->info($object->id);
  58. $head = actions_prepare_head($object);
  59. print dol_get_fiche_head($head, 'info', $langs->trans("Action"), -1, 'action');
  60. // Link to other agenda views
  61. $linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1">';
  62. $linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"');
  63. $linkback .= '<span class="hideonsmartphone">'.$langs->trans("BackToList").'</span>';
  64. $linkback .= '</a>';
  65. $linkback .= '</li>';
  66. $linkback .= '<li class="noborder litext">';
  67. $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
  68. $linkback .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview pictofixedwidth"');
  69. $linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewCal").'</span>';
  70. $linkback .= '</a>';
  71. $linkback .= '</li>';
  72. $linkback .= '<li class="noborder litext">';
  73. $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
  74. $linkback .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview pictofixedwidth"');
  75. $linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewWeek").'</span>';
  76. $linkback .= '</a>';
  77. $linkback .= '</li>';
  78. $linkback .= '<li class="noborder litext">';
  79. $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
  80. $linkback .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview pictofixedwidth"');
  81. $linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewDay").'</span>';
  82. $linkback .= '</a>';
  83. $linkback .= '</li>';
  84. $linkback .= '<li class="noborder litext">';
  85. $linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?mode=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
  86. $linkback .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview pictofixedwidth"');
  87. $linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewPerUser").'</span>';
  88. $linkback .= '</a>';
  89. // Add more views from hooks
  90. $parameters = array();
  91. $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
  92. if (empty($reshook)) {
  93. $linkback .= $hookmanager->resPrint;
  94. } elseif ($reshook > 1) {
  95. $linkback = $hookmanager->resPrint;
  96. }
  97. $morehtmlref = '<div class="refidno">';
  98. // Project
  99. if (isModEnabled('project')) {
  100. $langs->load("projects");
  101. //$morehtmlref .= '<br>';
  102. if (0) {
  103. $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
  104. if ($action != 'classify') {
  105. $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
  106. }
  107. $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
  108. } else {
  109. if (!empty($object->fk_project)) {
  110. $proj = new Project($db);
  111. $proj->fetch($object->fk_project);
  112. $morehtmlref .= $proj->getNomUrl(1);
  113. if ($proj->title) {
  114. $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
  115. }
  116. }
  117. }
  118. }
  119. $morehtmlref .= '</div>';
  120. dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref);
  121. print '<div class="underbanner clearboth"></div>';
  122. print '<br>';
  123. print '<table width="100%"><tr><td>';
  124. dol_print_object_info($object);
  125. print '</td></tr></table>';
  126. print dol_get_fiche_end();
  127. // End of page
  128. llxFooter();
  129. $db->close();