27require
'../../main.inc.php';
29global $conf, $langs, $user;
32require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
33require_once DOL_DOCUMENT_ROOT.
'/recruitment/lib/recruitment.lib.php';
34require_once DOL_DOCUMENT_ROOT.
"/recruitment/class/recruitmentjobposition.class.php";
37$langs->loadLangs(array(
"admin",
"recruitment"));
45$action =
GETPOST(
'action',
'aZ09');
46$backtopage =
GETPOST(
'backtopage',
'alpha');
47$modulepart =
GETPOST(
'modulepart',
'aZ09');
49$value =
GETPOST(
'value',
'alpha');
50$label =
GETPOST(
'label',
'alpha');
51$scandir =
GETPOST(
'scan_dir',
'alpha');
52$type =
'recruitmentjobposition';
54$arrayofparameters = array(
62$moduledir =
'recruitment';
63$myTmpObjects = array();
64$myTmpObjects[
'recruitmentjobposition'] = array(
'label' =>
'RecruitmentJobPosition',
'includerefgeneration' => 1,
'includedocgeneration' => 1,
'class' =>
'RecruitmentJobPosition');
66$tmpobjectkey =
GETPOST(
'object',
'aZ09');
67if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
76include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
78if ($action ==
'updateMask') {
79 $maskconst =
GETPOST(
'maskconstjob',
'alpha');
80 $maskvalue =
GETPOST(
'maskjob',
'alpha');
82 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
83 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
95} elseif ($action ==
'specimen' && $tmpobjectkey) {
96 $modele =
GETPOST(
'module',
'alpha');
98 $className = $myTmpObjects[$tmpobjectkey][
'class'];
99 $tmpobject =
new $className($db);
100 $tmpobject->initAsSpecimen();
105 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
106 foreach ($dirmodels as $reldir) {
107 $file =
dol_buildpath($reldir.
"core/modules/recruitment/doc/pdf_".$modele.
"_".strtolower($tmpobjectkey).
".modules.php", 0);
108 if (file_exists($file)) {
109 $classname =
"pdf_".$modele.
"_".strtolower($tmpobjectkey);
114 if ($classname !==
'') {
117 $module =
new $classname($db);
119 '@phan-var-force ModelePDFRecruitmentJobPosition $module';
121 if ($module->write_file($tmpobject, $langs) > 0) {
122 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=recruitment-".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
130 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
132} elseif ($action ==
'set') {
135} elseif ($action ==
'del') {
138 if (!empty($tmpobjectkey)) {
139 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
145} elseif ($action ==
'setmod') {
147 if (!empty($tmpobjectkey)) {
148 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
"_ADDON";
152} elseif ($action ==
'setdoc') {
154 if (!empty($tmpobjectkey)) {
155 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
159 $conf->global->$constforval = $value;
168} elseif ($action ==
'unsetdoc') {
169 if (!empty($tmpobjectkey)) {
170 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
181$form =
new Form($db);
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').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
201if ($action ==
'edit') {
202 print
'<form method="POST" action="'.$_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);
275 require_once $dir.
'/'.$file.
'.php';
277 $module =
new $file($db);
278 '@phan-var-force ModeleNumRefRecruitmentJobPosition $module';
281 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
284 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
288 if ($module->isEnabled()) {
289 dol_include_once(
'/'.$moduledir.
'/class/'.strtolower($myTmpObjectKey).
'.class.php');
291 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
292 print $module->info($langs);
296 print
'<td class="nowrap">';
297 $tmp = $module->getExample();
298 if (preg_match(
'/^Error/', $tmp)) {
299 $langs->load(
"errors");
300 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
301 } elseif ($tmp ==
'NotConfigured') {
302 print $langs->trans($tmp);
308 print
'<td class="center">';
309 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
311 print
img_picto($langs->trans(
"Activated"),
'switch_on');
313 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&object='.strtolower($myTmpObjectKey).
'&value='.urlencode($file).
'">';
314 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
319 $className = $myTmpObjectArray[
'class'];
320 $mytmpinstance =
new $className($db);
321 $mytmpinstance->initAsSpecimen();
325 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
327 $nextval = $module->getNextValue($mytmpinstance);
328 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
329 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
331 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
332 $nextval = $langs->trans($nextval);
334 $htmltooltip .= $nextval.
'<br>';
336 $htmltooltip .= $langs->trans($module->error).
'<br>';
340 print
'<td class="center">';
341 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
352 print
"</table><br>\n";
355 if ($myTmpObjectArray[
'includedocgeneration']) {
360 $type = strtolower($myTmpObjectKey);
362 print
load_fiche_titre($langs->trans(
"DocumentModules", $myTmpObjectKey),
'',
'');
367 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
368 $sql .=
" WHERE type = '".$db->escape($type).
"'";
369 $sql .=
" AND entity = ".$conf->entity;
370 $resql = $db->query($sql);
373 $num_rows = $db->num_rows($resql);
374 while ($i < $num_rows) {
375 $array = $db->fetch_array($resql);
376 if (is_array($array)) {
377 array_push($def, $array[0]);
386 print
"<table class=\"noborder\" width=\"100%\">\n";
387 print
"<tr class=\"liste_titre\">\n";
388 print
'<td>'.$langs->trans(
"Name").
'</td>';
389 print
'<td>'.$langs->trans(
"Description").
'</td>';
390 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
391 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
392 print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
393 print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
399 foreach ($dirmodels as $reldir) {
400 foreach (array(
'',
'/doc') as $valdir) {
401 $realpath = $reldir.
"core/modules/".$moduledir.$valdir;
405 $handle = opendir($dir);
406 if (is_resource($handle)) {
407 while (($file = readdir($handle)) !==
false) {
413 foreach ($filelist as $file) {
414 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
415 if (file_exists($dir.
'/'.$file)) {
416 $name = substr($file, 4,
dol_strlen($file) - 16);
417 $classname = substr($file, 0,
dol_strlen($file) - 12);
419 require_once $dir.
'/'.$file;
420 $module =
new $classname($db);
421 '@phan-var-force ModelePDFRecruitmentJobPosition $module';
423 $modulequalified = 1;
424 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
425 $modulequalified = 0;
427 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
428 $modulequalified = 0;
431 if ($modulequalified) {
432 print
'<tr class="oddeven"><td width="100">';
433 print(empty($module->name) ? $name : $module->
name);
435 if (method_exists($module,
'info')) {
436 print $module->info($langs);
438 print $module->description;
443 if (in_array($name, $def)) {
444 print
'<td class="center">'.
"\n";
445 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.urlencode($name).
'">';
446 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
450 print
'<td class="center">'.
"\n";
451 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>';
456 print
'<td class="center">';
457 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON_PDF';
461 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>';
463 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>';
468 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
469 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
470 if ($module->type ==
'pdf') {
471 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
473 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
475 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
476 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
477 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
479 print
'<td class="center">';
480 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
484 print
'<td class="center">';
485 if ($module->type ==
'pdf') {
486 $newname = preg_replace(
'/_'.preg_quote(strtolower($myTmpObjectKey),
'/').
'/',
'', $name);
487 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.urlencode($newname).
'&object='.urlencode($myTmpObjectKey).
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
489 print
img_object($langs->trans(
"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.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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)
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)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
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.