26require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
32require_once
'../lib/bookcal.lib.php';
36$langs->loadLangs(array(
"admin",
"agenda"));
39$hookmanager->initHooks(array(
'bookcalsetup',
'globalsetup'));
47$action =
GETPOST(
'action',
'aZ09');
48$backtopage =
GETPOST(
'backtopage',
'alpha');
49$modulepart =
GETPOST(
'modulepart',
'aZ09');
51$value =
GETPOST(
'value',
'alpha');
52$label =
GETPOST(
'label',
'alpha');
53$scandir =
GETPOST(
'scan_dir',
'alpha');
63if (!class_exists(
'FormSetup')) {
64 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
71$item = $formSetup->newItem(
'BOOKCAL_PUBLIC_INTERFACE_TOPIC');
72$item->defaultFieldValue =
'MyBigCompany public interface for Bookcal';
105$setupnotempty =+ count($formSetup->items);
108$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
116if (
versioncompare(explode(
'.', DOL_VERSION), array(15)) < 0 && $action ==
'update' && !empty($user->admin)) {
117 $formSetup->saveConfFromPost();
120include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
122if ($action ==
'updateMask') {
123 $maskconst =
GETPOST(
'maskconst',
'aZ09');
124 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
126 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
127 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
138} elseif ($action ==
'specimen') {
139 $modele =
GETPOST(
'module',
'alpha');
140 $tmpobjectkey =
GETPOST(
'object');
142 $tmpobject =
new $tmpobjectkey($db);
143 $tmpobject->initAsSpecimen();
149 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
150 foreach ($dirmodels as $reldir) {
151 $file =
dol_buildpath($reldir.
"core/modules/bookcal/doc/pdf_".$modele.
"_".strtolower($tmpobjectkey).
".modules.php", 0);
152 if (file_exists($file)) {
154 $classname =
"pdf_".$modele.
"_".strtolower($tmpobjectkey);
162 $module =
new $classname($db);
164 if ($module->write_file($tmpobject, $langs) > 0) {
165 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=bookcal-".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
173 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
175} elseif ($action ==
'setmod') {
177 $tmpobjectkey =
GETPOST(
'object');
178 if (!empty($tmpobjectkey)) {
179 $constforval =
'BOOKCAL_'.strtoupper($tmpobjectkey).
"_ADDON";
182} elseif ($action ==
'set') {
185} elseif ($action ==
'del') {
188 $tmpobjectkey =
GETPOST(
'object');
189 if (!empty($tmpobjectkey)) {
190 $constforval =
'BOOKCAL_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
196} elseif ($action ==
'setdoc') {
198 $tmpobjectkey =
GETPOST(
'object');
199 if (!empty($tmpobjectkey)) {
200 $constforval =
'BOOKCAL_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
204 $conf->global->$constforval = $value;
213} elseif ($action ==
'unsetdoc') {
214 $tmpobjectkey =
GETPOST(
'object');
215 if (!empty($tmpobjectkey)) {
216 $constforval =
'BOOKCAL_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
227$form =
new Form($db);
230$page_name =
"BookCalSetup";
232llxHeader(
'', $langs->trans($page_name), $help_url);
235$linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
241print
dol_get_fiche_head($head,
'settings', $langs->trans($page_name), -1,
"fa-calendar-check");
247if ($action ==
'edit') {
248 print $formSetup->generateOutput(
true);
250} elseif (!empty($formSetup->items)) {
251 print $formSetup->generateOutput();
252 print
'<div class="tabsAction">';
253 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
'</a>';
256 print
'<br>'.$langs->trans(
"NothingToSetup");
260if (empty($setupnotempty)) {
261 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.
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
bookcalAdminPrepareHead()
Prepare admin pages header.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.