dolibarr 19.0.4
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24if (!defined('NOLOGIN')) {
25 define("NOLOGIN", 1); // This means this output page does not require to be logged.
26}
27if (!defined('NOCSRFCHECK')) {
28 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
29}
30if (!defined('NOIPCHECK')) {
31 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
32}
33if (!defined('NOBROWSERNOTIF')) {
34 define('NOBROWSERNOTIF', '1');
35}
36
37// Load Dolibarr environment
38require '../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
42require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
43require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
44
45// Load translation files required by the page
46$langs->loadLangs(array("companies", "other", "recruitment"));
47
48// Get parameters
49$action = GETPOST('action', 'aZ09');
50$cancel = GETPOST('cancel', 'alpha');
51$SECUREKEY = GETPOST("securekey");
52$entity = GETPOST('entity', 'int') ? GETPOST('entity', 'int') : $conf->entity;
53$backtopage = '';
54$suffix = "";
55
56// Load variable for pagination
57$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
58$sortfield = GETPOST('sortfield', 'aZ09comma');
59$sortorder = GETPOST('sortorder', 'aZ09comma');
60$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
61if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
62 $page = 0;
63} // If $page is not defined, or '' or -1 or if we click on clear filters
64$offset = $limit * $page;
65$pageprev = $page - 1;
66$pagenext = $page + 1;
67
68if (GETPOST('btn_view')) {
69 unset($_SESSION['email_customer']);
70}
71if (isset($_SESSION['email_customer'])) {
72 $email = $_SESSION['email_customer'];
73}
74
75$object = new RecruitmentJobPosition($db);
76
77// Define $urlwithroot
78//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
79//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
80$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
81
82// Security check
83if (empty($conf->recruitment->enabled)) {
84 httponly_accessforbidden('Module Recruitment not enabled');
85}
86
87
88/*
89 * Actions
90 */
91
92// None
93
94
95/*
96 * View
97 */
98
99$head = '';
100if (getDolGlobalString('MAIN_RECRUITMENT_CSS_URL')) {
101 $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MAIN_RECRUITMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
102}
103
104$conf->dol_hide_topmenu = 1;
105$conf->dol_hide_leftmenu = 1;
106
107if (!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
108 $langs->load("errors");
109 print '<div class="error">'.$langs->trans('ErrorPublicInterfaceNotEnabled').'</div>';
110 $db->close();
111 exit();
112}
113
114$arrayofjs = array();
115$arrayofcss = array();
116
117$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
118llxHeader($head, $langs->trans("PositionToBeFilled"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1, 1);
119
120
121print '<span id="dolpaymentspan"></span>'."\n";
122print '<div class="center">'."\n";
123print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
124print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
125print '<input type="hidden" name="action" value="dosign">'."\n";
126print '<input type="hidden" name="tag" value="'.GETPOST("tag", 'alpha').'">'."\n";
127print '<input type="hidden" name="suffix" value="'.GETPOST("suffix", 'alpha').'">'."\n";
128print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
129print '<input type="hidden" name="entity" value="'.$entity.'" />';
130print "\n";
131print '<!-- Form to view jobs -->'."\n";
132
133// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
134// Define logo and logosmall
135$logosmall = $mysoc->logo_small;
136$logo = $mysoc->logo;
137$paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix;
138if (!empty($conf->global->$paramlogo)) {
139 $logosmall = $conf->global->$paramlogo;
140} elseif (getDolGlobalString('ONLINE_RECRUITMENT_LOGO')) {
141 $logosmall = $conf->global->ONLINE_RECRUITMENT_LOGO_;
142}
143//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
144// Define urllogo
145$urllogo = '';
146$urllogofull = '';
147if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
148 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
149 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
150} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
151 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
152 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
153}
154// Output html code for logo
155if ($urllogo) {
156 print '<div class="backgreypublicpayment">';
157 print '<div class="logopublicpayment">';
158 print '<img id="dolpaymentlogo" src="'.$urllogo.'">';
159 print '</div>';
160 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
161 print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
162 }
163 print '</div>';
164}
165
166if (getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE')) {
167 print '<div class="backimagepublicrecruitment">';
168 print '<img id="idPROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH" src="' . getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE').'">';
169 print '</div>';
170}
171
172
173$results = $object->fetchAll($sortfield, $sortorder, 0, 0, array('status' => 1));
174$now = dol_now();
175
176if (is_array($results)) {
177 if (empty($results)) {
178 print '<br>';
179 print $langs->trans("NoPositionOpen");
180 } else {
181 print '<br><br><br>';
182 print '<span class="opacitymedium">'.$langs->trans("WeAreRecruiting").'</span>';
183 print '<br><br><br>';
184 print '<br class="hideonsmartphone">';
185
186 foreach ($results as $job) {
187 $object = $job;
188
189 print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
190
191 // Output introduction text
192 $text = '';
193 if (getDolGlobalString('RECRUITMENT_NEWFORM_TEXT')) {
194 $reg = array();
195 if (preg_match('/^\‍((.*)\‍)$/', $conf->global->RECRUITMENT_NEWFORM_TEXT, $reg)) {
196 $text .= $langs->trans($reg[1])."<br>\n";
197 } else {
198 $text .= getDolGlobalString('RECRUITMENT_NEWFORM_TEXT') . "<br>\n";
199 }
200 $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
201 }
202 if (empty($text)) {
203 $text .= '<tr><td class="textpublicpayment"><br>'.$langs->trans("JobOfferToBeFilled", $mysoc->name);
204 $text .= ' &nbsp; - &nbsp; <strong>'.$mysoc->name.'</strong>';
205 $text .= ' &nbsp; - &nbsp; <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date($object->date_creation).'</span>';
206 $text .= '</td></tr>'."\n";
207 $text .= '<tr><td class="textpublicpayment"><h1 class="paddingleft paddingright">'.$object->label.'</h1></td></tr>'."\n";
208 }
209 print $text;
210
211 // Output payment summary form
212 print '<tr><td class="left">';
213
214 print '<div class="centpercent" id="tablepublicpayment">';
215 print '<div class="opacitymedium">'.$langs->trans("ThisIsInformationOnJobPosition").' :</div>'."\n";
216
217 $error = 0;
218 $found = true;
219
220 print '<br>';
221
222 // Label
223 print $langs->trans("Label").' : ';
224 print '<b>'.dol_escape_htmltag($object->label).'</b><br>';
225
226 // Date
227 print $langs->trans("DateExpected").' : ';
228 print '<b>';
229 if ($object->date_planned > $now) {
230 print dol_print_date($object->date_planned, 'day');
231 } else {
232 print $langs->trans("ASAP");
233 }
234 print '</b><br>';
235
236 // Remuneration
237 print $langs->trans("Remuneration").' : ';
238 print '<b>';
239 print dol_escape_htmltag($object->remuneration_suggested);
240 print '</b><br>';
241
242 // Contact
243 $tmpuser = new User($db);
244 $tmpuser->fetch($object->fk_user_recruiter);
245
246 print $langs->trans("ContactForRecruitment").' : ';
247 $emailforcontact = $object->email_recruiter;
248 if (empty($emailforcontact)) {
249 $emailforcontact = $tmpuser->email;
250 if (empty($emailforcontact)) {
251 $emailforcontact = $mysoc->email;
252 }
253 }
254 print '<b class="wordbreak">';
255 print $tmpuser->getFullName($langs);
256 print ' &nbsp; '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope');
257 print '</b>';
258 print '</b><br>';
259
260 if ($object->status == RecruitmentJobPosition::STATUS_RECRUITED) {
261 print info_admin($langs->trans("JobClosedTextCandidateFound"), 0, 0, 0, 'warning');
262 }
263 if ($object->status == RecruitmentJobPosition::STATUS_CANCELED) {
264 print info_admin($langs->trans("JobClosedTextCanceled"), 0, 0, 0, 'warning');
265 }
266
267 print '<br>';
268
269 // Description
270
271 $text = $object->description;
272 print $text;
273 print '<input type="hidden" name="ref" value="'.$object->ref.'">';
274
275 print '</div>'."\n";
276 print "\n";
277
278
279 if ($action != 'dosubmit') {
280 if ($found && !$error) {
281 // We are in a management option and no error
282 } else {
283 dol_print_error_email('ERRORSUBMITAPPLICATION');
284 }
285 } else {
286 // Print
287 }
288
289 print '</td></tr>'."\n";
290
291 print '</table>'."\n";
292
293 print '<br><br class="hideonsmartphone"><br class="hideonsmartphone"><br class="hideonsmartphone">'."\n";
294 }
295 }
296} else {
297 dol_print_error($db, $object->error, $object->errors);
298}
299
300print '</form>'."\n";
301print '</div>'."\n";
302print '<br>';
303
304
305htmlPrintOnlineFooter($mysoc, $langs);
306
307llxFooter('', 'public');
308
309$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class for RecruitmentJobPosition.
Class to manage Dolibarr users.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML pages.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.