recruitment.lib.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2022 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 recruitment/lib/recruitment.lib.php
  20. * \ingroup recruitment
  21. * \brief Library files with common functions for Recruitment
  22. */
  23. /**
  24. * Prepare admin pages header
  25. *
  26. * @return array
  27. */
  28. function recruitmentAdminPrepareHead()
  29. {
  30. global $langs, $conf, $db;
  31. $extrafields = new ExtraFields($db);
  32. $extrafields->fetch_name_optionals_label('recruitment_recruitmentjobposition');
  33. $extrafields->fetch_name_optionals_label('recruitment_recruitmentcandidature');
  34. $langs->load("recruitment");
  35. $h = 0;
  36. $head = array();
  37. $head[$h][0] = dol_buildpath("/recruitment/admin/setup.php", 1);
  38. $head[$h][1] = $langs->trans("JobPositions");
  39. $head[$h][2] = 'settings';
  40. $h++;
  41. $head[$h][0] = dol_buildpath("/recruitment/admin/setup_candidatures.php", 1);
  42. $head[$h][1] = $langs->trans("RecruitmentCandidatures");
  43. $head[$h][2] = 'settings_candidatures';
  44. $h++;
  45. $head[$h][0] = dol_buildpath("/recruitment/admin/public_interface.php", 1);
  46. $head[$h][1] = $langs->trans("PublicUrl");
  47. $head[$h][2] = 'publicurl';
  48. $h++;
  49. $head[$h][0] = dol_buildpath("/recruitment/admin/jobposition_extrafields.php", 1);
  50. $head[$h][1] = $langs->trans("ExtrafieldsJobPosition");
  51. $nbExtrafields = $extrafields->attributes['recruitment_recruitmentjobposition']['count'];
  52. if ($nbExtrafields > 0) {
  53. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  54. }
  55. $head[$h][2] = 'jobposition_extrafields';
  56. $h++;
  57. $head[$h][0] = dol_buildpath("/recruitment/admin/candidature_extrafields.php", 1);
  58. $head[$h][1] = $langs->trans("ExtrafieldsApplication");
  59. $nbExtrafields = $extrafields->attributes['recruitment_recruitmentcandidature']['count'];
  60. if ($nbExtrafields > 0) {
  61. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  62. }
  63. $head[$h][2] = 'candidature_extrafields';
  64. $h++;
  65. // Show more tabs from modules
  66. // Entries must be declared in modules descriptor with line
  67. //$this->tabs = array(
  68. // 'entity:+tabname:Title:@recruitment:/recruitment/mypage.php?id=__ID__'
  69. //); // to add new tab
  70. //$this->tabs = array(
  71. // 'entity:-tabname:Title:@recruitment:/recruitment/mypage.php?id=__ID__'
  72. //); // to remove a tab
  73. complete_head_from_modules($conf, $langs, null, $head, $h, 'recruitment');
  74. complete_head_from_modules($conf, $langs, null, $head, $h, 'recruitment', 'remove');
  75. return $head;
  76. }