27if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
28 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
31$tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
32while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
35if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
36 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
38if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
39 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
42if (!$res && file_exists(
"../../main.inc.php")) {
43 $res = @include
"../../main.inc.php";
45if (!$res && file_exists(
"../../../main.inc.php")) {
46 $res = @include
"../../../main.inc.php";
49 die(
"Include of main fails");
55require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
56require_once DOL_DOCUMENT_ROOT.
'/recruitment/lib/recruitment.lib.php';
57require_once DOL_DOCUMENT_ROOT.
"/recruitment/class/recruitmentjobposition.class.php";
60$langs->loadLangs(array(
"admin",
"recruitment"));
68$action =
GETPOST(
'action',
'aZ09');
69$backtopage =
GETPOST(
'backtopage',
'alpha');
70$modulepart =
GETPOST(
'modulepart',
'aZ09');
72$value =
GETPOST(
'value',
'alpha');
73$label =
GETPOST(
'label',
'alpha');
74$scandir =
GETPOST(
'scan_dir',
'alpha');
75$type =
'recruitmentcandidature';
77$arrayofparameters = array(
90include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
92if ($action ==
'updateMask') {
93 $maskconst =
GETPOST(
'maskconstcand',
'aZ09');
94 $maskvalue =
GETPOST(
'maskcand',
'alpha');
96 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
97 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
109} elseif ($action ==
'specimen') {
110 $modele =
GETPOST(
'module',
'alpha');
111 $tmpobjectkey =
GETPOST(
'object');
113 $tmpobject =
new $tmpobjectkey($db);
114 $tmpobject->initAsSpecimen();
117 $file =
''; $classname =
''; $filefound = 0;
118 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
119 foreach ($dirmodels as $reldir) {
120 $file =
dol_buildpath($reldir.
"core/modules/mymodule/doc/pdf_".$modele.
"_".strtolower($tmpobjectkey).
".modules.php", 0);
121 if (file_exists($file)) {
123 $classname =
"pdf_".$modele;
131 $module =
new $classname($db);
133 if ($module->write_file($tmpobject, $langs) > 0) {
134 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
142 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
144} elseif ($action ==
'set') {
147} elseif ($action ==
'del') {
148 $tmpobjectkey =
GETPOST(
'object');
152 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
153 if ($conf->global->$constforval ==
"$value") {
157} elseif ($action ==
'setmod') {
159 $tmpobjectkey =
GETPOST(
'object');
160 if (!empty($tmpobjectkey)) {
161 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
"_ADDON";
165} elseif ($action ==
'setdoc') {
167 $tmpobjectkey =
GETPOST(
'object');
168 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
172 $conf->global->$constforval = $value;
180} elseif ($action ==
'unsetdoc') {
181 $tmpobjectkey =
GETPOST(
'object');
182 if (!empty($tmpobjectkey)) {
183 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
194$form =
new Form($db);
196$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
198$page_name =
"RecruitmentSetup";
202$linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
214if ($action ==
'edit') {
215 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
216 print
'<input type="hidden" name="token" value="'.newToken().
'">';
217 print
'<input type="hidden" name="action" value="update">';
219 print
'<table class="noborder centpercent">';
220 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
222 foreach ($arrayofparameters as $key => $val) {
223 print
'<tr class="oddeven"><td>';
224 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
225 print $form->textwithpicto($langs->trans($key), $tooltiphelp);
226 print
'</td><td><input name="'.$key.
'" class="flat '.(empty($val[
'css']) ?
'minwidth200' : $val[
'css']).
'" value="'.
getDolGlobalString($key).
'"></td></tr>';
230 print
'<br><div class="center">';
231 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
237 if (!empty($arrayofparameters)) {
238 print
'<table class="noborder centpercent">';
239 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
241 foreach ($arrayofparameters as $key => $val) {
244 print
'<tr class="oddeven"><td>';
245 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
246 print $form->textwithpicto($langs->trans($key), $tooltiphelp);
247 print
'</td><td>'.getDolGlobalString($key).
'</td></tr>';
252 print
'<div class="tabsAction">';
253 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
'</a>';
259$moduledir =
'recruitment';
260$myTmpObjects = array();
261$myTmpObjects[
'RecruitmentCandidature'] = array(
'includerefgeneration'=>1,
'includedocgeneration'=>0);
264foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
265 if ($myTmpObjectArray[
'includerefgeneration']) {
271 print
load_fiche_titre($langs->trans(
"NumberingModules", $myTmpObjectKey),
'',
'');
273 print
'<table class="noborder centpercent">';
274 print
'<tr class="liste_titre">';
275 print
'<td>'.$langs->trans(
"Name").
'</td>';
276 print
'<td>'.$langs->trans(
"Description").
'</td>';
277 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
278 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
279 print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
284 foreach ($dirmodels as $reldir) {
288 $handle = opendir($dir);
289 if (is_resource($handle)) {
290 while (($file = readdir($handle)) !==
false) {
291 if (strpos($file,
'mod_'.strtolower($myTmpObjectKey).
'_') === 0 && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
292 $file = substr($file, 0,
dol_strlen($file) - 4);
294 require_once $dir.
'/'.$file.
'.php';
296 $module =
new $file($db);
299 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
302 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
306 if ($module->isEnabled()) {
307 dol_include_once(
'/'.$moduledir.
'/class/'.strtolower($myTmpObjectKey).
'.class.php');
309 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
310 print $module->info();
314 print
'<td class="nowrap">';
315 $tmp = $module->getExample();
316 if (preg_match(
'/^Error/', $tmp)) {
317 $langs->load(
"errors");
318 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
319 } elseif ($tmp ==
'NotConfigured') {
320 print $langs->trans($tmp);
326 print
'<td class="center">';
327 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
329 print
img_picto($langs->trans(
"Activated"),
'switch_on');
331 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.newToken().
'&object='.strtolower($myTmpObjectKey).
'&value='.urlencode($file).
'">';
332 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
337 $mytmpinstance =
new $myTmpObjectKey($db);
338 $mytmpinstance->initAsSpecimen();
342 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
344 $nextval = $module->getNextValue($mytmpinstance);
345 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
346 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
348 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
349 $nextval = $langs->trans($nextval);
351 $htmltooltip .= $nextval.
'<br>';
353 $htmltooltip .= $langs->trans($module->error).
'<br>';
357 print
'<td class="center">';
358 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
369 print
"</table><br>\n";
372 if ($myTmpObjectArray[
'includedocgeneration']) {
377 $type = strtolower($myTmpObjectKey);
379 print
load_fiche_titre($langs->trans(
"DocumentModules", $myTmpObjectKey),
'',
'');
384 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
385 $sql .=
" WHERE type = '".$db->escape($type).
"'";
386 $sql .=
" AND entity = ".$conf->entity;
387 $resql = $db->query($sql);
390 $num_rows = $db->num_rows($resql);
391 while ($i < $num_rows) {
392 $array = $db->fetch_array($resql);
393 array_push($def, $array[0]);
401 print
"<table class=\"noborder\" width=\"100%\">\n";
402 print
"<tr class=\"liste_titre\">\n";
403 print
'<td>'.$langs->trans(
"Name").
'</td>';
404 print
'<td>'.$langs->trans(
"Description").
'</td>';
405 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
406 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
407 print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
408 print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
413 foreach ($dirmodels as $reldir) {
414 foreach (array(
'',
'/doc') as $valdir) {
415 $realpath = $reldir.
"core/modules/".$moduledir.$valdir;
419 $handle = opendir($dir);
420 if (is_resource($handle)) {
421 while (($file = readdir($handle)) !==
false) {
427 foreach ($filelist as $file) {
428 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
429 if (file_exists($dir.
'/'.$file)) {
430 $name = substr($file, 4,
dol_strlen($file) - 16);
431 $classname = substr($file, 0,
dol_strlen($file) - 12);
433 require_once $dir.
'/'.$file;
434 $module =
new $classname($db);
436 $modulequalified = 1;
437 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
438 $modulequalified = 0;
440 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
441 $modulequalified = 0;
444 if ($modulequalified) {
445 print
'<tr class="oddeven"><td width="100">';
446 print (empty($module->name) ? $name : $module->
name);
448 if (method_exists($module,
'info')) {
449 print $module->info($langs);
451 print $module->description;
456 if (in_array($name, $def)) {
457 print
'<td class="center">'.
"\n";
458 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'">';
459 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
463 print
'<td class="center">'.
"\n";
464 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
469 print
'<td class="center">';
470 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
474 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=unsetdoc&token='.newToken().
'&object='.urlencode(strtolower($myTmpObjectKey)).
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'&type='.urlencode($type).
'" alt="'.$langs->trans(
"Disable").
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
476 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.newToken().
'&object='.urlencode(strtolower($myTmpObjectKey)).
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
481 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
482 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
483 if ($module->type ==
'pdf') {
484 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
486 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
488 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
489 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
490 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
492 print
'<td class="center">';
493 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
497 print
'<td class="center">';
498 if ($module->type ==
'pdf') {
499 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'&object='.$myTmpObjectKey.
'">'.
img_object($langs->trans(
"Preview"),
'generic').
'</a>';
501 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
519if (empty($setupnotempty)) {
520 print
'<br>'.$langs->trans(
"NothingToSetup");
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
recruitmentAdminPrepareHead()
Prepare admin pages header.
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.