dolibarr 21.0.0-alpha
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 *
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
27// Load Dolibarr environment
28require '../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
31
32// Load translation files required by the page
33$langs->loadLangs(array("admin", "recruitment"));
34
35$action = GETPOST('action', 'aZ09');
36
37if (!$user->admin) {
39}
40
41$error = 0;
42
43
44/*
45 * Actions
46 */
47
48if ($action == 'setRECRUITMENT_ENABLE_PUBLIC_INTERFACE') {
49 if (GETPOST('value')) {
50 dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
51 } else {
52 dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
53 }
54}
55
56if ($action == 'update') {
57 $public = GETPOST('RECRUITMENT_ENABLE_PUBLIC_INTERFACE');
58
59 $res = dolibarr_set_const($db, "RECRUITMENT_ENABLE_PUBLIC_INTERFACE", $public, 'chaine', 0, '', $conf->entity);
60
61 if (!($res > 0)) {
62 $error++;
63 }
64
65 if (!$error) {
66 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
67 } else {
68 setEventMessages($langs->trans("Error"), null, 'errors');
69 }
70}
71
72
73/*
74 * View
75 */
76
77$form = new Form($db);
78
79//$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
80$help_url = '';
81llxHeader('', $langs->trans("RecruitmentSetup"), $help_url);
82
83
84$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
85print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup');
86
88
89
90
91print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
92print '<input type="hidden" name="action" value="update">';
93print '<input type="hidden" name="token" value="'.newToken().'">';
94
95print dol_get_fiche_head($head, 'publicurl', '', -1, '');
96
97
98print '<span class="opacitymedium">'.$langs->trans("PublicInterfaceRecruitmentDesc").'</span><br><br>';
99
100$param = '';
101
102$enabledisablehtml = $langs->trans("EnablePublicRecruitmentPages").' ';
103if (!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
104 // Button off, click to enable
105 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
106 $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
107 $enabledisablehtml .= '</a>';
108} else {
109 // Button on, click to disable
110 $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
111 $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
112 $enabledisablehtml .= '</a>';
113}
114print $enabledisablehtml;
115print '<input type="hidden" id="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" name="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" value="'.(!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE') ? 0 : 1).'">';
116
117
118print '<br>';
119
120/*
121if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
122 print '<br>';
123
124 print '<table class="noborder centpercent">';
125
126 print '<tr class="liste_titre">';
127 print '<td>'.$langs->trans("Parameter").'</td>';
128 print '<td class="right">'.$langs->trans("Value").'</td>';
129 print "</tr>\n";
130
131 print '</table>';
132
133 print '<div class="center">';
134 print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
135 print '</div>';
136}
137*/
138
139print dol_get_fiche_end();
140
141print '</form>';
142
143
144if (getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
145 print '<br>';
146 //print $langs->trans('FollowingLinksArePublic').'<br>';
147 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
148 if (isModEnabled('multicompany')) {
149 $entity_qr = '?entity='.$conf->entity;
150 } else {
151 $entity_qr = '';
152 }
153
154 // Define $urlwithroot
155 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
156 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
157 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
158
159 print '<div class="urllink">';
160 print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">';
161 print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
162 print '</div>';
163 print ajax_autoselect('publicurlmember');
164}
165
166// End of page
167llxFooter();
168$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:70
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.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.