hrm.lib.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /* Copyright (C) 2020 jean-pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
  3. * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
  4. * Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
  5. * Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
  6. * Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
  7. * Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * \file hrm/lib/hrm.lib.php
  24. * \ingroup hrm
  25. * \brief Library files with common functions for Workstation
  26. */
  27. /**
  28. * Prepare admin pages header
  29. *
  30. * @return array
  31. */
  32. function hrmAdminPrepareHead()
  33. {
  34. global $langs, $conf, $db;
  35. $langs->load("hrm");
  36. $extrafields = new ExtraFields($db);
  37. $extrafields->fetch_name_optionals_label('hrm_evaluation');
  38. $extrafields->fetch_name_optionals_label('hrm_job');
  39. $extrafields->fetch_name_optionals_label('hrm_skill');
  40. $h = 0;
  41. $head = array();
  42. $head[$h][0] = DOL_URL_ROOT . "/admin/hrm.php";
  43. $head[$h][1] = $langs->trans("Settings");
  44. $head[$h][2] = 'settings';
  45. $h++;
  46. $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
  47. $head[$h][1] = $langs->trans("Establishments");
  48. $head[$h][2] = 'establishments';
  49. $h++;
  50. $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php';
  51. $head[$h][1] = $langs->trans("SkillsExtraFields");
  52. $nbExtrafields = $extrafields->attributes['hrm_skill']['count'];
  53. if ($nbExtrafields > 0) {
  54. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  55. }
  56. $head[$h][2] = 'skillsAttributes';
  57. $h++;
  58. $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php';
  59. $head[$h][1] = $langs->trans("JobsExtraFields");
  60. $nbExtrafields = $extrafields->attributes['hrm_job']['count'];
  61. if ($nbExtrafields > 0) {
  62. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  63. }
  64. $head[$h][2] = 'jobsAttributes';
  65. $h++;
  66. $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php';
  67. $head[$h][1] = $langs->trans("EvaluationsExtraFields");
  68. $nbExtrafields = $extrafields->attributes['hrm_evaluation']['count'];
  69. if ($nbExtrafields > 0) {
  70. $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
  71. }
  72. $head[$h][2] = 'evaluationsAttributes';
  73. $h++;
  74. // Show more tabs from modules
  75. // Entries must be declared in modules descriptor with line
  76. //$this->tabs = array(
  77. // 'entity:+tabname:Title:@workstation:/workstation/mypage.php?id=__ID__'
  78. //); // to add new tab
  79. //$this->tabs = array(
  80. // 'entity:-tabname:Title:@workstation:/workstation/mypage.php?id=__ID__'
  81. //); // to remove a tab
  82. complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin');
  83. complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove');
  84. return $head;
  85. }