dolibarr  13.0.2
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) accessforbidden();
37 
38 $error = 0;
39 
40 
41 /*
42  * Actions
43  */
44 
45 if ($action == 'setRECRUITMENT_ENABLE_PUBLIC_INTERFACE') {
46  if (GETPOST('value')) dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
47  else dolibarr_set_const($db, 'RECRUITMENT_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
48 }
49 
50 if ($action == 'update') {
51  $public = GETPOST('RECRUITMENT_ENABLE_PUBLIC_INTERFACE');
52 
53  $res = dolibarr_set_const($db, "RECRUITMENT_ENABLE_PUBLIC_INTERFACE", $public, 'chaine', 0, '', $conf->entity);
54 
55  if (!($res > 0)) $error++;
56 
57  if (!$error) {
58  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
59  } else {
60  setEventMessages($langs->trans("Error"), null, 'errors');
61  }
62 }
63 
64 
65 /*
66  * View
67  */
68 
69 $form = new Form($db);
70 
71 //$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
72 $help_url = '';
73 llxHeader('', $langs->trans("RecruitmentSetup"), $help_url);
74 
75 
76 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
77 print load_fiche_titre($langs->trans("RecruitmentSetup"), $linkback, 'title_setup');
78 
80 
81 
82 
83 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
84 print '<input type="hidden" name="action" value="update">';
85 print '<input type="hidden" name="token" value="'.newToken().'">';
86 
87 print dol_get_fiche_head($head, 'publicurl', '', -1, '');
88 
89 
90 print '<span class="opacitymedium">'.$langs->trans("PublicInterfaceRecruitmentDesc").'</span><br><br>';
91 
92 
93 $enabledisablehtml = $langs->trans("EnablePublicRecruitmentPages").' ';
94 if (empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
95  // Button off, click to enable
96  $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=1'.$param.'">';
97  $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
98  $enabledisablehtml .= '</a>';
99 } else {
100  // Button on, click to disable
101  $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setRECRUITMENT_ENABLE_PUBLIC_INTERFACE&token='.newToken().'&value=0'.$param.'">';
102  $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
103  $enabledisablehtml .= '</a>';
104 }
105 print $enabledisablehtml;
106 print '<input type="hidden" id="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" name="RECRUITMENT_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">';
107 
108 
109 print '<br>';
110 
111 /*
112 if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
113  print '<br>';
114 
115  print '<table class="noborder centpercent">';
116 
117  print '<tr class="liste_titre">';
118  print '<td>'.$langs->trans("Parameter").'</td>';
119  print '<td class="right">'.$langs->trans("Value").'</td>';
120  print "</tr>\n";
121 
122  // Force Type
123  $adht = new AdherentType($db);
124  print '<tr class="oddeven drag" id="trforcetype"><td>';
125  print $langs->trans("ForceMemberType");
126  print '</td><td class="right">';
127  $listofval = array();
128  $listofval += $adht->liste_array();
129  $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
130  print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0);
131  print "</td></tr>\n";
132 
133  // Amount
134  print '<tr class="oddeven" id="tramount"><td>';
135  print $langs->trans("DefaultAmount");
136  print '</td><td class="right">';
137  print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
138  print "</td></tr>\n";
139 
140  // Can edit
141  print '<tr class="oddeven" id="tredit"><td>';
142  print $langs->trans("CanEditAmount");
143  print '</td><td class="right">';
144  print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1);
145  print "</td></tr>\n";
146 
147  // Jump to an online payment page
148  print '<tr class="oddeven" id="trpayment"><td>';
149  print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
150  print '</td><td class="right">';
151  $listofval = array();
152  $listofval['-1'] = $langs->trans('No');
153  $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
154  if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox';
155  if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal';
156  if (!empty($conf->stripe->enabled)) $listofval['stripe'] = 'Stripe';
157  print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0);
158  print "</td></tr>\n";
159 
160  print '</table>';
161 
162  print '<div class="center">';
163  print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
164  print '</div>';
165 }
166 */
167 
168 print dol_get_fiche_end();
169 
170 print '</form>';
171 
172 /*
173 if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {
174  print '<br>';
175  //print $langs->trans('FollowingLinksArePublic').'<br>';
176  print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').':<br>';
177  if ($conf->multicompany->enabled) {
178  $entity_qr = '?entity='.$conf->entity;
179  } else {
180  $entity_qr = '';
181  }
182 
183  // Define $urlwithroot
184  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
185  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
186  //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
187 
188  print '<a target="_blank" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.$urlwithroot.'/public/members/new.php'.$entity_qr.'</a>';
189 }
190 */
191 
192 // End of page
193 llxFooter();
194 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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:575
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
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 ...
recruitmentAdminPrepareHead()
Prepare admin pages header.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
newToken()
Return the value of token currently saved into session with name &#39;newtoken&#39;.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
llxFooter()
Empty footer.
Definition: wrapper.php:59