dolibarr 23.0.3
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';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
41
42// Load translation files required by the page
43$langs->loadLangs(array("admin", "recruitment"));
44
45$action = GETPOST('action', 'aZ09');
46
47if (!$user->admin) {
49}
50
51$error = 0;
52
53
54/*
55 * Actions
56 */
57
58if ($action == 'setRECRUITMENT_ENABLE_PUBLIC_INTERFACE') {
59 if (GETPOST('value')) {
60 dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
61 } else {
62 dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
63 }
64}
65
66if ($action == 'update') {
67 $public = GETPOST('RECRUITMENT_ENABLE_PUBLIC_INTERFACE');
68
69 $res = dolibarr_set_const($db, "RECRUITMENT_ENABLE_PUBLIC_INTERFACE", $public, 'chaine', 0, '', $conf->entity);
70
71 if (!($res > 0)) {
72 $error++;
73 }
74
75 if (!$error) {
76 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
77 } else {
78 setEventMessages($langs->trans("Error"), null, 'errors');
79 }
80}
81
82
83/*
84 * View
85 */
86
87$form = new Form($db);
88
89//$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
90$help_url = '';
91llxHeader('', $langs->trans("RecruitmentSetup"), $help_url);
92
93$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
94
95print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup');
96
98
99
100
101print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
102print '<input type="hidden" name="action" value="update">';
103print '<input type="hidden" name="token" value="'.newToken().'">';
104
105print dol_get_fiche_head($head, 'publicurl', '', -1, '');
106
107
108print '<span class="opacitymedium">'.$langs->trans("PublicInterfaceRecruitmentDesc").'</span><br><br>';
109
110$param = '';
111
112$enabledisablehtml = $langs->trans("EnablePublicRecruitmentPages").' ';
113if (!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
114 // Button off, click to enable
115 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
116 $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
117 $enabledisablehtml .= '</a>';
118} else {
119 // Button on, click to disable
120 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
121 $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
122 $enabledisablehtml .= '</a>';
123}
124print $enabledisablehtml;
125print '<input type="hidden" id="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" name="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" value="'.(!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).'">';
126
127
128print '<br>';
129
130/*
131if (getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
132 print '<br>';
133
134 print '<table class="noborder centpercent">';
135
136 print '<tr class="liste_titre">';
137 print '<td>'.$langs->trans("Parameter").'</td>';
138 print '<td class="right">'.$langs->trans("Value").'</td>';
139 print "</tr>\n";
140
141 print '</table>';
142
143 print '<div class="center">';
144 print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
145 print '</div>';
146}
147*/
148
149print dol_get_fiche_end();
150
151print '</form>';
152
153
154if (getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
155 print '<br>';
156 //print $langs->trans('FollowingLinksArePublic').'<br>';
157 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
158 if (isModEnabled('multicompany')) {
159 $entity_qr = '?entity='.$conf->entity;
160 } else {
161 $entity_qr = '';
162 }
163
164 // Define $urlwithroot
165 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
166 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
167 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
168
169 print '<div class="urllink">';
170 print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">';
171 print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
172 print '</div>';
173 print ajax_autoselect('publicurlmember');
174}
175
176// End of page
177llxFooter();
178$db->close();
global $dolibarr_main_url_root
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).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage generation of HTML components Only common components must be here.
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, $allowothertags=array())
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, $morecssdiv='')
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.