dolibarr 21.0.0-beta
public_interface.php
Go to the documentation of this file.
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
32
41// Load translation files required by the page
42$langs->loadLangs(array("admin", "recruitment"));
43
44$action = GETPOST('action', 'aZ09');
45
46if (!$user->admin) {
48}
49
50$error = 0;
51
52
53/*
54 * Actions
55 */
56
57if ($action == 'setRECRUITMENT_ENABLE_PUBLIC_INTERFACE') {
58 if (GETPOST('value')) {
59 dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
60 } else {
61 dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
62 }
63}
64
65if ($action == 'update') {
66 $public = GETPOST('RECRUITMENT_ENABLE_PUBLIC_INTERFACE');
67
68 $res = dolibarr_set_const($db, "RECRUITMENT_ENABLE_PUBLIC_INTERFACE", $public, 'chaine', 0, '', $conf->entity);
69
70 if (!($res > 0)) {
71 $error++;
72 }
73
74 if (!$error) {
75 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
76 } else {
77 setEventMessages($langs->trans("Error"), null, 'errors');
78 }
79}
80
81
82/*
83 * View
84 */
85
86$form = new Form($db);
87
88//$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
89$help_url = '';
90llxHeader('', $langs->trans("RecruitmentSetup"), $help_url);
91
92
93$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
94print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup');
95
97
98
99
100print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
101print '<input type="hidden" name="action" value="update">';
102print '<input type="hidden" name="token" value="'.newToken().'">';
103
104print dol_get_fiche_head($head, 'publicurl', '', -1, '');
105
106
107print '<span class="opacitymedium">'.$langs->trans("PublicInterfaceRecruitmentDesc").'</span><br><br>';
108
109$param = '';
110
111$enabledisablehtml = $langs->trans("EnablePublicRecruitmentPages").' ';
112if (!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
113 // Button off, click to enable
114 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
115 $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
116 $enabledisablehtml .= '</a>';
117} else {
118 // Button on, click to disable
119 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
120 $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
121 $enabledisablehtml .= '</a>';
122}
123print $enabledisablehtml;
124print '<input type="hidden" id="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" name="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" value="'.(!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).'">';
125
126
127print '<br>';
128
129/*
130if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
131 print '<br>';
132
133 print '<table class="noborder centpercent">';
134
135 print '<tr class="liste_titre">';
136 print '<td>'.$langs->trans("Parameter").'</td>';
137 print '<td class="right">'.$langs->trans("Value").'</td>';
138 print "</tr>\n";
139
140 print '</table>';
141
142 print '<div class="center">';
143 print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
144 print '</div>';
145}
146*/
147
148print dol_get_fiche_end();
149
150print '</form>';
151
152
153if (getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
154 print '<br>';
155 //print $langs->trans('FollowingLinksArePublic').'<br>';
156 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
157 if (isModEnabled('multicompany')) {
158 $entity_qr = '?entity='.$conf->entity;
159 } else {
160 $entity_qr = '';
161 }
162
163 // Define $urlwithroot
164 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
165 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
166 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
167
168 print '<div class="urllink">';
169 print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">';
170 print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
171 print '</div>';
172 print ajax_autoselect('publicurlmember');
173}
174
175// End of page
176llxFooter();
177$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
recruitmentAdminPrepareHead()
Prepare admin pages header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.