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 =
'recruitmentcandidature';
54$arrayofparameters = array(
62$tmpobjectkey =
GETPOST(
'object',
'aZ09');
63$moduledir =
'recruitment';
64$myTmpObjects = array();
65$myTmpObjects[
'recruitmentcandidature'] = array(
'label' =>
'RecruitmentCandidature',
'includerefgeneration' => 1,
'includedocgeneration' => 0,
'class' =>
'RecruitmentCandidature');
72include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
74if ($action ==
'updateMask') {
75 $maskconst =
GETPOST(
'maskconstcand',
'aZ09');
76 $maskvalue =
GETPOST(
'maskcand',
'alpha');
78 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
79 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
91} elseif ($action ==
'specimen' && $tmpobjectkey) {
92 $modele =
GETPOST(
'module',
'alpha');
94 $className = $myTmpObjects[$tmpobjectkey][
'class'];
95 $tmpobject =
new $className($db);
96 $tmpobject->initAsSpecimen();
101 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
102 foreach ($dirmodels as $reldir) {
103 $file =
dol_buildpath($reldir.
"core/modules/mymodule/doc/pdf_".$modele.
"_".strtolower($tmpobjectkey).
".modules.php", 0);
104 if (file_exists($file)) {
105 $classname =
"pdf_".$modele;
110 if ($classname !==
'') {
113 $module =
new $classname($db);
115 if ($module->write_file($tmpobject, $langs) > 0) {
116 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
124 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
126} elseif ($action ==
'set') {
129} elseif ($action ==
'del') {
132 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
137} elseif ($action ==
'setmod') {
139 if (!empty($tmpobjectkey)) {
140 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
"_ADDON";
144} elseif ($action ==
'setdoc') {
146 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
150 $conf->global->$constforval = $value;
158} elseif ($action ==
'unsetdoc') {
159 if (!empty($tmpobjectkey)) {
160 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
171$form =
new Form($db);
173$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
175$page_name =
"RecruitmentSetup";
179$linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
191if ($action ==
'edit') {
192 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
193 print
'<input type="hidden" name="token" value="'.newToken().
'">';
194 print
'<input type="hidden" name="action" value="update">';
196 print
'<table class="noborder centpercent">';
197 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
199 foreach ($arrayofparameters as $key => $val) {
200 print
'<tr class="oddeven"><td>';
201 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
202 print $form->textwithpicto($langs->trans($key), $tooltiphelp);
203 print
'</td><td><input name="'.$key.
'" class="flat '.(empty($val[
'css']) ?
'minwidth200' : $val[
'css']).
'" value="'.
getDolGlobalString($key).
'"></td></tr>';
207 print
'<br><div class="center">';
208 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
214 if (!empty($arrayofparameters)) {
215 print
'<table class="noborder centpercent">';
216 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
218 foreach ($arrayofparameters as $key => $val) {
221 print
'<tr class="oddeven"><td>';
222 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
223 print $form->textwithpicto($langs->trans($key), $tooltiphelp);
224 print
'</td><td>'.getDolGlobalString($key).
'</td></tr>';
229 print
'<div class="tabsAction">';
230 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>';
236foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
237 if ($myTmpObjectArray[
'includerefgeneration']) {
243 print
load_fiche_titre($langs->trans(
"NumberingModules", $myTmpObjectKey),
'',
'');
245 print
'<table class="noborder centpercent">';
246 print
'<tr class="liste_titre">';
247 print
'<td>'.$langs->trans(
"Name").
'</td>';
248 print
'<td>'.$langs->trans(
"Description").
'</td>';
249 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
250 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
251 print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
256 foreach ($dirmodels as $reldir) {
260 $handle = opendir($dir);
261 if (is_resource($handle)) {
262 while (($file = readdir($handle)) !==
false) {
263 if (strpos($file,
'mod_'.strtolower($myTmpObjectKey).
'_') === 0 && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
264 $file = substr($file, 0,
dol_strlen($file) - 4);
266 require_once $dir.
'/'.$file.
'.php';
268 $module =
new $file($db);
269 '@phan-var-force ModeleNumRefRecruitmentCandidature $module';
272 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
275 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
279 if ($module->isEnabled()) {
280 dol_include_once(
'/'.$moduledir.
'/class/'.strtolower($myTmpObjectKey).
'.class.php');
282 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
283 print $module->info($langs);
287 print
'<td class="nowrap">';
288 $tmp = $module->getExample();
289 if (preg_match(
'/^Error/', $tmp)) {
290 $langs->load(
"errors");
291 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
292 } elseif ($tmp ==
'NotConfigured') {
293 print $langs->trans($tmp);
299 print
'<td class="center">';
300 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
302 print
img_picto($langs->trans(
"Activated"),
'switch_on');
304 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&object='.strtolower($myTmpObjectKey).
'&value='.urlencode($file).
'">';
305 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
310 $className = $myTmpObjectArray[
'class'];
311 $mytmpinstance =
new $className($db);
312 $mytmpinstance->initAsSpecimen();
316 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
318 $nextval = $module->getNextValue($mytmpinstance);
319 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
320 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
322 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
323 $nextval = $langs->trans($nextval);
325 $htmltooltip .= $nextval.
'<br>';
327 $htmltooltip .= $langs->trans($module->error).
'<br>';
331 print
'<td class="center">';
332 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
343 print
"</table><br>\n";
346 if ($myTmpObjectArray[
'includedocgeneration']) {
351 $type = strtolower($myTmpObjectKey);
353 print
load_fiche_titre($langs->trans(
"DocumentModules", $myTmpObjectKey),
'',
'');
358 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
359 $sql .=
" WHERE type = '".$db->escape($type).
"'";
360 $sql .=
" AND entity = ".$conf->entity;
361 $resql = $db->query($sql);
364 $num_rows = $db->num_rows($resql);
365 while ($i < $num_rows) {
366 $array = $db->fetch_array($resql);
367 if (is_array($array)) {
368 array_push($def, $array[0]);
377 print
"<table class=\"noborder\" width=\"100%\">\n";
378 print
"<tr class=\"liste_titre\">\n";
379 print
'<td>'.$langs->trans(
"Name").
'</td>';
380 print
'<td>'.$langs->trans(
"Description").
'</td>';
381 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
382 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
383 print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
384 print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
390 foreach ($dirmodels as $reldir) {
391 foreach (array(
'',
'/doc') as $valdir) {
392 $realpath = $reldir.
"core/modules/".$moduledir.$valdir;
396 $handle = opendir($dir);
397 if (is_resource($handle)) {
398 while (($file = readdir($handle)) !==
false) {
404 foreach ($filelist as $file) {
405 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
406 if (file_exists($dir.
'/'.$file)) {
407 $name = substr($file, 4,
dol_strlen($file) - 16);
408 $classname = substr($file, 0,
dol_strlen($file) - 12);
410 require_once $dir.
'/'.$file;
411 $module =
new $classname($db);
412 '@phan-var-force ModelePDFRecruitmentJobPosition $module';
414 $modulequalified = 1;
415 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
416 $modulequalified = 0;
418 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
419 $modulequalified = 0;
422 if ($modulequalified) {
423 print
'<tr class="oddeven"><td width="100">';
424 print(empty($module->name) ? $name : $module->
name);
426 if (method_exists($module,
'info')) {
427 print $module->info($langs);
429 print $module->description;
434 if (in_array($name, $def)) {
435 print
'<td class="center">'.
"\n";
436 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.urlencode($name).
'">';
437 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
441 print
'<td class="center">'.
"\n";
442 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>';
447 print
'<td class="center">';
448 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
452 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>';
454 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>';
459 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
460 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
461 if ($module->type ==
'pdf') {
462 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
464 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
466 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
467 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
468 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
470 print
'<td class="center">';
471 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
475 print
'<td class="center">';
476 if ($module->type ==
'pdf') {
477 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'&object='.$myTmpObjectKey.
'">'.
img_object($langs->trans(
"Preview"),
'generic').
'</a>';
479 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
497if (empty($setupnotempty)) {
498 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.