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 if ($module->write_file($tmpobject, $langs) > 0) {
120 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=recruitment-".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
128 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
130} elseif ($action ==
'set') {
133} elseif ($action ==
'del') {
136 if (!empty($tmpobjectkey)) {
137 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
143} elseif ($action ==
'setmod') {
145 if (!empty($tmpobjectkey)) {
146 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
"_ADDON";
150} elseif ($action ==
'setdoc') {
152 if (!empty($tmpobjectkey)) {
153 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
157 $conf->global->$constforval = $value;
166} elseif ($action ==
'unsetdoc') {
167 if (!empty($tmpobjectkey)) {
168 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
179$form =
new Form($db);
181$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
183$page_name =
"RecruitmentSetup";
187$linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
199if ($action ==
'edit') {
200 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
201 print
'<input type="hidden" name="token" value="'.newToken().
'">';
202 print
'<input type="hidden" name="action" value="update">';
204 print
'<table class="noborder centpercent">';
205 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
207 foreach ($arrayofparameters as $key => $val) {
208 print
'<tr class="oddeven"><td>';
209 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
210 print $form->textwithpicto($langs->trans($key), $tooltiphelp);
211 print
'</td><td><input name="'.$key.
'" class="flat '.(empty($val[
'css']) ?
'minwidth200' : $val[
'css']).
'" value="'.
getDolGlobalString($key).
'"></td></tr>';
215 print
'<br><div class="center">';
216 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
222 if (!empty($arrayofparameters)) {
223 print
'<table class="noborder centpercent">';
224 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
226 foreach ($arrayofparameters as $key => $val) {
229 print
'<tr class="oddeven"><td>';
230 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
231 print $form->textwithpicto($langs->trans($key), $tooltiphelp);
232 print
'</td><td>'.getDolGlobalString($key).
'</td></tr>';
237 print
'<div class="tabsAction">';
238 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>';
244foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
245 if ($myTmpObjectArray[
'includerefgeneration']) {
251 print
load_fiche_titre($langs->trans(
"NumberingModules", $myTmpObjectKey),
'',
'');
253 print
'<table class="noborder centpercent">';
254 print
'<tr class="liste_titre">';
255 print
'<td>'.$langs->trans(
"Name").
'</td>';
256 print
'<td>'.$langs->trans(
"Description").
'</td>';
257 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
258 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
259 print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
264 foreach ($dirmodels as $reldir) {
268 $handle = opendir($dir);
269 if (is_resource($handle)) {
270 while (($file = readdir($handle)) !==
false) {
271 if (strpos($file,
'mod_'.strtolower($myTmpObjectKey).
'_') === 0 && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
272 $file = substr($file, 0,
dol_strlen($file) - 4);
273 require_once $dir.
'/'.$file.
'.php';
275 $module =
new $file($db);
278 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
281 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
285 if ($module->isEnabled()) {
286 dol_include_once(
'/'.$moduledir.
'/class/'.strtolower($myTmpObjectKey).
'.class.php');
288 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
289 print $module->info($langs);
293 print
'<td class="nowrap">';
294 $tmp = $module->getExample();
295 if (preg_match(
'/^Error/', $tmp)) {
296 $langs->load(
"errors");
297 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
298 } elseif ($tmp ==
'NotConfigured') {
299 print $langs->trans($tmp);
305 print
'<td class="center">';
306 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
308 print
img_picto($langs->trans(
"Activated"),
'switch_on');
310 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&object='.strtolower($myTmpObjectKey).
'&value='.urlencode($file).
'">';
311 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
316 $className = $myTmpObjectArray[
'class'];
317 $mytmpinstance =
new $className($db);
318 $mytmpinstance->initAsSpecimen();
322 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
324 $nextval = $module->getNextValue($mytmpinstance);
325 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
326 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
328 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
329 $nextval = $langs->trans($nextval);
331 $htmltooltip .= $nextval.
'<br>';
333 $htmltooltip .= $langs->trans($module->error).
'<br>';
337 print
'<td class="center">';
338 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
349 print
"</table><br>\n";
352 if ($myTmpObjectArray[
'includedocgeneration']) {
357 $type = strtolower($myTmpObjectKey);
359 print
load_fiche_titre($langs->trans(
"DocumentModules", $myTmpObjectKey),
'',
'');
364 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
365 $sql .=
" WHERE type = '".$db->escape($type).
"'";
366 $sql .=
" AND entity = ".$conf->entity;
367 $resql = $db->query($sql);
370 $num_rows = $db->num_rows($resql);
371 while ($i < $num_rows) {
372 $array = $db->fetch_array($resql);
373 if (is_array($array)) {
374 array_push($def, $array[0]);
383 print
"<table class=\"noborder\" width=\"100%\">\n";
384 print
"<tr class=\"liste_titre\">\n";
385 print
'<td>'.$langs->trans(
"Name").
'</td>';
386 print
'<td>'.$langs->trans(
"Description").
'</td>';
387 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
388 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
389 print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
390 print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
396 foreach ($dirmodels as $reldir) {
397 foreach (array(
'',
'/doc') as $valdir) {
398 $realpath = $reldir.
"core/modules/".$moduledir.$valdir;
402 $handle = opendir($dir);
403 if (is_resource($handle)) {
404 while (($file = readdir($handle)) !==
false) {
410 foreach ($filelist as $file) {
411 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
412 if (file_exists($dir.
'/'.$file)) {
413 $name = substr($file, 4,
dol_strlen($file) - 16);
414 $classname = substr($file, 0,
dol_strlen($file) - 12);
416 require_once $dir.
'/'.$file;
417 $module =
new $classname($db);
419 $modulequalified = 1;
420 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
421 $modulequalified = 0;
423 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
424 $modulequalified = 0;
427 if ($modulequalified) {
428 print
'<tr class="oddeven"><td width="100">';
429 print(empty($module->name) ? $name : $module->
name);
431 if (method_exists($module,
'info')) {
432 print $module->info($langs);
434 print $module->description;
439 if (in_array($name, $def)) {
440 print
'<td class="center">'.
"\n";
441 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.urlencode($name).
'">';
442 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
446 print
'<td class="center">'.
"\n";
447 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>';
452 print
'<td class="center">';
453 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON_PDF';
457 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>';
459 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>';
464 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
465 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
466 if ($module->type ==
'pdf') {
467 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
469 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
471 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
472 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
473 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
475 print
'<td class="center">';
476 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
480 print
'<td class="center">';
481 if ($module->type ==
'pdf') {
482 $newname = preg_replace(
'/_'.preg_quote(strtolower($myTmpObjectKey),
'/').
'/',
'', $name);
483 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.urlencode($newname).
'&object='.urlencode($myTmpObjectKey).
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
485 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
503if (empty($setupnotempty)) {
504 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($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)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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_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'.
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.
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 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.