dolibarr  16.0.5
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 require '../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment.lib.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array("admin", "recruitment"));
33 
34 $action = GETPOST('action', 'aZ09');
35 
36 if (!$user->admin) {
38 }
39 
40 $error = 0;
41 
42 
43 /*
44  * Actions
45  */
46 
47 if ($action == 'setRECRUITMENT_ENABLE_PUBLIC_INTERFACE') {
48  if (GETPOST('value')) {
49  dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
50  } else {
51  dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
52  }
53 }
54 
55 if ($action == 'update') {
56  $public = GETPOST('RECRUITMENT_ENABLE_PUBLIC_INTERFACE');
57 
58  $res = dolibarr_set_const($db, "RECRUITMENT_ENABLE_PUBLIC_INTERFACE", $public, 'chaine', 0, '', $conf->entity);
59 
60  if (!($res > 0)) {
61  $error++;
62  }
63 
64  if (!$error) {
65  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
66  } else {
67  setEventMessages($langs->trans("Error"), null, 'errors');
68  }
69 }
70 
71 
72 /*
73  * View
74  */
75 
76 $form = new Form($db);
77 
78 //$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
79 $help_url = '';
80 llxHeader('', $langs->trans("RecruitmentSetup"), $help_url);
81 
82 
83 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
84 print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup');
85 
87 
88 
89 
90 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
91 print '<input type="hidden" name="action" value="update">';
92 print '<input type="hidden" name="token" value="'.newToken().'">';
93 
94 print dol_get_fiche_head($head, 'publicurl', '', -1, '');
95 
96 
97 print '<span class="opacitymedium">'.$langs->trans("PublicInterfaceRecruitmentDesc").'</span><br><br>';
98 
99 $param = '';
100 
101 $enabledisablehtml = $langs->trans("EnablePublicRecruitmentPages").' ';
102 if (empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
103  // Button off, click to enable
104  $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
105  $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
106  $enabledisablehtml .= '</a>';
107 } else {
108  // Button on, click to disable
109  $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
110  $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
111  $enabledisablehtml .= '</a>';
112 }
113 print $enabledisablehtml;
114 print '<input type="hidden" id="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" name="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">';
115 
116 
117 print '<br>';
118 
119 /*
120 if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
121  print '<br>';
122 
123  print '<table class="noborder centpercent">';
124 
125  print '<tr class="liste_titre">';
126  print '<td>'.$langs->trans("Parameter").'</td>';
127  print '<td class="right">'.$langs->trans("Value").'</td>';
128  print "</tr>\n";
129 
130  print '</table>';
131 
132  print '<div class="center">';
133  print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
134  print '</div>';
135 }
136 */
137 
138 print dol_get_fiche_end();
139 
140 print '</form>';
141 
142 
143 if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
144  print '<br>';
145  //print $langs->trans('FollowingLinksArePublic').'<br>';
146  print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
147  if (!empty($conf->multicompany->enabled)) {
148  $entity_qr = '?entity='.$conf->entity;
149  } else {
150  $entity_qr = '';
151  }
152 
153  // Define $urlwithroot
154  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
155  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
156  //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
157 
158  print '<div class="urllink">';
159  print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">';
160  print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/recruitment/index.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
161  print '</div>';
162  print ajax_autoselect('publicurlmember');
163 }
164 
165 // End of page
166 llxFooter();
167 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
recruitmentAdminPrepareHead
recruitmentAdminPrepareHead()
Prepare admin pages header.
Definition: recruitment.lib.php:29
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
dolibarr_set_const
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).
Definition: admin.lib.php:627
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
ajax_autoselect
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
Definition: functions.lib.php:9681
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59