public_interface.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?php
  2. /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2006-2020 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/recruitment/admin/public_interface.php
  22. * \ingroup recruitment
  23. * \brief File of main public page for open job position
  24. */
  25. // Load Dolibarr environment
  26. require '../../main.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
  29. // Load translation files required by the page
  30. $langs->loadLangs(array("admin", "recruitment"));
  31. $action = GETPOST('action', 'aZ09');
  32. if (!$user->admin) {
  33. accessforbidden();
  34. }
  35. $error = 0;
  36. /*
  37. * Actions
  38. */
  39. if ($action == 'setRECRUITMENT_ENABLE_PUBLIC_INTERFACE') {
  40. if (GETPOST('value')) {
  41. dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
  42. } else {
  43. dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
  44. }
  45. }
  46. if ($action == 'update') {
  47. $public = GETPOST('RECRUITMENT_ENABLE_PUBLIC_INTERFACE');
  48. $res = dolibarr_set_const($db, "RECRUITMENT_ENABLE_PUBLIC_INTERFACE", $public, 'chaine', 0, '', $conf->entity);
  49. if (!($res > 0)) {
  50. $error++;
  51. }
  52. if (!$error) {
  53. setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
  54. } else {
  55. setEventMessages($langs->trans("Error"), null, 'errors');
  56. }
  57. }
  58. /*
  59. * View
  60. */
  61. $form = new Form($db);
  62. //$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
  63. $help_url = '';
  64. llxHeader('', $langs->trans("RecruitmentSetup"), $help_url);
  65. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  66. print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup');
  67. $head = recruitmentAdminPrepareHead();
  68. print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
  69. print '<input type="hidden" name="action" value="update">';
  70. print '<input type="hidden" name="token" value="'.newToken().'">';
  71. print dol_get_fiche_head($head, 'publicurl', '', -1, '');
  72. print '<span class="opacitymedium">'.$langs->trans("PublicInterfaceRecruitmentDesc").'</span><br><br>';
  73. $param = '';
  74. $enabledisablehtml = $langs->trans("EnablePublicRecruitmentPages").' ';
  75. if (empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
  76. // Button off, click to enable
  77. $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
  78. $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
  79. $enabledisablehtml .= '</a>';
  80. } else {
  81. // Button on, click to disable
  82. $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
  83. $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
  84. $enabledisablehtml .= '</a>';
  85. }
  86. print $enabledisablehtml;
  87. print '<input type="hidden" id="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" name="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">';
  88. print '<br>';
  89. /*
  90. if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
  91. print '<br>';
  92. print '<table class="noborder centpercent">';
  93. print '<tr class="liste_titre">';
  94. print '<td>'.$langs->trans("Parameter").'</td>';
  95. print '<td class="right">'.$langs->trans("Value").'</td>';
  96. print "</tr>\n";
  97. print '</table>';
  98. print '<div class="center">';
  99. print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
  100. print '</div>';
  101. }
  102. */
  103. print dol_get_fiche_end();
  104. print '</form>';
  105. if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
  106. print '<br>';
  107. //print $langs->trans('FollowingLinksArePublic').'<br>';
  108. print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
  109. if (isModEnabled('multicompany')) {
  110. $entity_qr = '?entity='.$conf->entity;
  111. } else {
  112. $entity_qr = '';
  113. }
  114. // Define $urlwithroot
  115. $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
  116. $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
  117. //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
  118. print '<div class="urllink">';
  119. print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">';
  120. print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
  121. print '</div>';
  122. print ajax_autoselect('publicurlmember');
  123. }
  124. // End of page
  125. llxFooter();
  126. $db->close();