eventorganization.lib.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /* Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
  3. * Copyright (C) 2023 Frédéric France <frederic.france@netlogic.fr>
  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/core/lib/eventorganization.lib.php
  20. * \ingroup eventorganization
  21. * \brief Library files with common functions for EventOrganization
  22. */
  23. /**
  24. * Prepare admin pages header
  25. *
  26. * @return array
  27. */
  28. function eventorganizationAdminPrepareHead()
  29. {
  30. global $langs, $conf, $db;
  31. $extrafields = new ExtraFields($db);
  32. $extrafields->fetch_name_optionals_label('actioncomm');
  33. $extrafields->fetch_name_optionals_label('eventorganization_conferenceorboothattendee');
  34. $langs->load("eventorganization");
  35. $h = 0;
  36. $head = array();
  37. $head[$h][0] = DOL_URL_ROOT.'/admin/eventorganization.php';
  38. $head[$h][1] = $langs->trans("Settings");
  39. $head[$h][2] = 'settings';
  40. $h++;
  41. $head[$h][0] = DOL_URL_ROOT.'/admin/eventorganization_confbooth_extrafields.php';
  42. $head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("EventOrganizationConfOrBooth").")";
  43. $nbExtrafields = $extrafields->attributes['actioncomm']['count'];
  44. if ($nbExtrafields > 0) {
  45. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  46. }
  47. $head[$h][2] = 'eventorganization_extrafields';
  48. $h++;
  49. $head[$h][0] = DOL_URL_ROOT.'/admin/eventorganization_confboothattendee_extrafields.php';
  50. $head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Attendees").")";
  51. $nbExtrafields = $extrafields->attributes['eventorganization_conferenceorboothattendee']['count'];
  52. if ($nbExtrafields > 0) {
  53. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  54. }
  55. $head[$h][2] = 'conferenceorboothattendee_extrafields';
  56. $h++;
  57. // Show more tabs from modules
  58. // Entries must be declared in modules descriptor with line
  59. //$this->tabs = array(
  60. // 'entity:+tabname:Title:@eventorganization:/eventorganization/mypage.php?id=__ID__'
  61. //); // to add new tab
  62. //$this->tabs = array(
  63. // 'entity:-tabname:Title:@eventorganization:/eventorganization/mypage.php?id=__ID__'
  64. //); // to remove a tab
  65. complete_head_from_modules($conf, $langs, null, $head, $h, 'eventorganization');
  66. complete_head_from_modules($conf, $langs, null, $head, $h, 'eventorganization', 'remove');
  67. return $head;
  68. }