27require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
31require_once DOL_DOCUMENT_ROOT.
'/recruitment/lib/recruitment.lib.php';
32require_once DOL_DOCUMENT_ROOT.
"/recruitment/class/recruitmentjobposition.class.php";
43$langs->loadLangs(array(
"admin",
"recruitment"));
51$action =
GETPOST(
'action',
'aZ09');
52$backtopage =
GETPOST(
'backtopage',
'alpha');
53$modulepart =
GETPOST(
'modulepart',
'aZ09');
55$value =
GETPOST(
'value',
'alpha');
56$label =
GETPOST(
'label',
'alpha');
57$scandir =
GETPOST(
'scan_dir',
'alpha');
58$type =
'recruitmentcandidature';
60$arrayofparameters = array(
68$tmpobjectkey =
GETPOST(
'object',
'aZ09');
69$moduledir =
'recruitment';
70$myTmpObjects = array();
71$myTmpObjects[
'recruitmentcandidature'] = array(
'label' =>
'RecruitmentCandidature',
'includerefgeneration' => 1,
'includedocgeneration' => 0,
'class' =>
'RecruitmentCandidature');
78include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
80if ($action ==
'updateMask') {
81 $maskconst =
GETPOST(
'maskconstcand',
'aZ09');
82 $maskvalue =
GETPOST(
'maskcand',
'alpha');
86 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
99} elseif ($action ==
'specimen' && $tmpobjectkey) {
100 $modele =
GETPOST(
'module',
'alpha');
102 $className = $myTmpObjects[$tmpobjectkey][
'class'];
103 $tmpobject =
new $className(
$db);
104 $tmpobject->initAsSpecimen();
109 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
110 foreach ($dirmodels as $reldir) {
111 $file =
dol_buildpath($reldir.
"core/modules/mymodule/doc/pdf_".$modele.
"_".strtolower($tmpobjectkey).
".modules.php", 0);
112 if (file_exists($file)) {
113 $classname =
"pdf_".$modele;
118 if ($classname !==
'') {
121 $module =
new $classname(
$db);
123 '@phan-var-force ModelePDFRecruitmentCandidature $module';
125 if ($module->write_file($tmpobject, $langs) > 0) {
126 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
134 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
136} elseif ($action ==
'set') {
139} elseif ($action ==
'del') {
142 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
147} elseif ($action ==
'setmod') {
149 if (!empty($tmpobjectkey)) {
150 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
"_ADDON";
154} elseif ($action ==
'setdoc') {
156 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
160 $conf->global->$constforval = $value;
168} elseif ($action ==
'unsetdoc') {
169 if (!empty($tmpobjectkey)) {
170 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
183$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
185$page_name =
"RecruitmentSetup";
189$linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
201if ($action ==
'edit') {
202 print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
203 print
'<input type="hidden" name="token" value="'.newToken().
'">';
204 print
'<input type="hidden" name="action" value="update">';
206 print
'<table class="noborder centpercent">';
207 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
209 foreach ($arrayofparameters as $key => $val) {
210 print
'<tr class="oddeven"><td>';
211 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
212 print $form->textwithpicto($langs->trans($key), $tooltiphelp);
213 print
'</td><td><input name="'.$key.
'" class="flat '.(empty($val[
'css']) ?
'minwidth200' : $val[
'css']).
'" value="'.
getDolGlobalString($key).
'"></td></tr>';
217 print
'<br><div class="center">';
218 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
224 if (!empty($arrayofparameters)) {
225 print
'<table class="noborder centpercent">';
226 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
228 foreach ($arrayofparameters as $key => $val) {
231 print
'<tr class="oddeven"><td>';
232 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
233 print $form->textwithpicto($langs->trans($key), $tooltiphelp);
234 print
'</td><td>'.getDolGlobalString($key).
'</td></tr>';
239 print
'<div class="tabsAction">';
240 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
'</a>';
246foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
247 if ($myTmpObjectArray[
'includerefgeneration']) {
253 print
load_fiche_titre($langs->trans(
"NumberingModules", $myTmpObjectKey),
'',
'');
255 print
'<table class="noborder centpercent">';
256 print
'<tr class="liste_titre">';
257 print
'<td>'.$langs->trans(
"Name").
'</td>';
258 print
'<td>'.$langs->trans(
"Description").
'</td>';
259 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
260 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
261 print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
266 foreach ($dirmodels as $reldir) {
270 $handle = opendir($dir);
271 if (is_resource($handle)) {
272 while (($file = readdir($handle)) !==
false) {
273 if (strpos($file,
'mod_'.strtolower($myTmpObjectKey).
'_') === 0 && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
274 $file = substr($file, 0,
dol_strlen($file) - 4);
276 require_once $dir.
'/'.$file.
'.php';
278 $module =
new $file(
$db);
279 '@phan-var-force ModeleNumRefRecruitmentCandidature $module';
282 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
285 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
289 if ($module->isEnabled()) {
290 dol_include_once(
'/'.$moduledir.
'/class/'.strtolower($myTmpObjectKey).
'.class.php');
292 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
293 print $module->info($langs);
297 print
'<td class="nowrap">';
298 $tmp = $module->getExample();
299 if (preg_match(
'/^Error/', $tmp)) {
300 $langs->load(
"errors");
301 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
302 } elseif ($tmp ==
'NotConfigured') {
303 print $langs->trans($tmp);
309 print
'<td class="center">';
310 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
312 print
img_picto($langs->trans(
"Activated"),
'switch_on');
314 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.newToken().
'&object='.strtolower($myTmpObjectKey).
'&value='.urlencode($file).
'">';
315 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
320 $className = $myTmpObjectArray[
'class'];
321 $mytmpinstance =
new $className(
$db);
322 $mytmpinstance->initAsSpecimen();
326 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
328 $nextval = $module->getNextValue($mytmpinstance);
329 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
330 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
332 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
333 $nextval = $langs->trans($nextval);
335 $htmltooltip .= $nextval.
'<br>';
337 $htmltooltip .= $langs->trans($module->error).
'<br>';
341 print
'<td class="center">';
342 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
353 print
"</table><br>\n";
356 if ($myTmpObjectArray[
'includedocgeneration']) {
361 $type = strtolower($myTmpObjectKey);
363 print
load_fiche_titre($langs->trans(
"DocumentModules", $myTmpObjectKey),
'',
'');
368 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
369 $sql .=
" WHERE type = '".$db->escape($type).
"'";
370 $sql .=
" AND entity = ".$conf->entity;
371 $resql =
$db->query($sql);
374 $num_rows =
$db->num_rows($resql);
375 while ($i < $num_rows) {
376 $array =
$db->fetch_array($resql);
377 if (is_array($array)) {
378 array_push($def, $array[0]);
387 print
"<table class=\"noborder\" width=\"100%\">\n";
388 print
"<tr class=\"liste_titre\">\n";
389 print
'<td>'.$langs->trans(
"Name").
'</td>';
390 print
'<td>'.$langs->trans(
"Description").
'</td>';
391 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
392 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
393 print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
394 print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
400 foreach ($dirmodels as $reldir) {
401 foreach (array(
'',
'/doc') as $valdir) {
402 $realpath = $reldir.
"core/modules/".$moduledir.$valdir;
406 $handle = opendir($dir);
407 if (is_resource($handle)) {
408 while (($file = readdir($handle)) !==
false) {
414 foreach ($filelist as $file) {
415 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
416 if (file_exists($dir.
'/'.$file)) {
417 $name = substr($file, 4,
dol_strlen($file) - 16);
418 $classname = substr($file, 0,
dol_strlen($file) - 12);
420 require_once $dir.
'/'.$file;
421 $module =
new $classname(
$db);
422 '@phan-var-force ModelePDFRecruitmentJobPosition $module';
424 $modulequalified = 1;
425 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
426 $modulequalified = 0;
428 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
429 $modulequalified = 0;
432 if ($modulequalified) {
433 print
'<tr class="oddeven"><td width="100">';
434 print(empty($module->name) ? $name : $module->
name);
436 if (method_exists($module,
'info')) {
437 print $module->info($langs);
439 print $module->description;
444 if (in_array($name, $def)) {
445 print
'<td class="center">'.
"\n";
446 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'">';
447 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
451 print
'<td class="center">'.
"\n";
452 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>';
457 print
'<td class="center">';
458 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
462 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>';
464 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>';
469 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
470 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
471 if ($module->type ==
'pdf') {
472 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
474 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
476 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
477 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
478 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
480 print
'<td class="center">';
481 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
485 print
'<td class="center">';
486 if ($module->type ==
'pdf') {
487 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'&object='.$myTmpObjectKey.
'">'.
img_object($langs->trans(
"Preview"),
'generic').
'</a>';
489 print
img_object($langs->transnoentitiesnoconv(
"PreviewNotAvailable"),
'generic');
507if (empty($setupnotempty)) {
508 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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a 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.