dolibarr 21.0.3
setup.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) ---Replace with your own copyright and developer email---
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27$res = 0;
28// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
29if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
30 $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
31}
32// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
33$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
34$tmp2 = realpath(__FILE__);
35$i = strlen($tmp) - 1;
36$j = strlen($tmp2) - 1;
37while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
38 $i--;
39 $j--;
40}
41if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
42 $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
43}
44if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
45 $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
46}
47// Try main.inc.php using relative path
48if (!$res && file_exists("../../main.inc.php")) {
49 $res = @include "../../main.inc.php";
50}
51if (!$res && file_exists("../../../main.inc.php")) {
52 $res = @include "../../../main.inc.php";
53}
54if (!$res) {
55 die("Include of main fails");
56}
57
58// Libraries
59require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
60require_once '../lib/mymodule.lib.php';
61//require_once "../class/myclass.class.php";
62
71// Translations
72$langs->loadLangs(array("admin", "mymodule@mymodule"));
73
74// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
76$hookmanager->initHooks(array('mymodulesetup', 'globalsetup'));
77
78// Parameters
79$action = GETPOST('action', 'aZ09');
80$backtopage = GETPOST('backtopage', 'alpha');
81$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
82
83$value = GETPOST('value', 'alpha');
84$label = GETPOST('label', 'alpha');
85$scandir = GETPOST('scan_dir', 'alpha');
86$type = 'myobject';
87
88$error = 0;
89$setupnotempty = 0;
90
91// Access control
92if (!$user->admin) {
94}
95
96
97// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
98$useFormSetup = 1;
99
100if (!class_exists('FormSetup')) {
101 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
102}
103$formSetup = new FormSetup($db);
104
105// Access control
106if (!$user->admin) {
108}
109
110
111// Enter here all parameters in your setup page
112
113// Setup conf for selection of an URL
114$item = $formSetup->newItem('MYMODULE_MYPARAM1');
115$item->fieldAttr['placeholder'] = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
116$item->cssClass = 'minwidth500';
117
118// Setup conf for selection of a simple string input
119$item = $formSetup->newItem('MYMODULE_MYPARAM2');
120$item->defaultFieldValue = 'default value';
121$item->fieldAttr['placeholder'] = 'A placeholder here';
122
123// Setup conf for selection of a simple textarea input but we replace the text of field title
124$item = $formSetup->newItem('MYMODULE_MYPARAM3');
125$item->nameText = $item->getNameText().' more html text ';
126
127// Setup conf for a selection of a Thirdparty
128$item = $formSetup->newItem('MYMODULE_MYPARAM4');
129$item->setAsThirdpartyType();
130
131// Setup conf for a selection of a boolean
132$formSetup->newItem('MYMODULE_MYPARAM5')->setAsYesNo();
133
134// Setup conf for a selection of an Email template of type thirdparty
135$formSetup->newItem('MYMODULE_MYPARAM6')->setAsEmailTemplate('thirdparty');
136
137// Setup conf for a selection of a secured key
138//$formSetup->newItem('MYMODULE_MYPARAM7')->setAsSecureKey();
139
140// Setup conf for a selection of a Product
141$formSetup->newItem('MYMODULE_MYPARAM8')->setAsProduct();
142
143// Add a title for a new section
144$formSetup->newItem('NewSection')->setAsTitle();
145
146$TField = array(
147 'test01' => $langs->trans('test01'),
148 'test02' => $langs->trans('test02'),
149 'test03' => $langs->trans('test03'),
150 'test04' => $langs->trans('test04'),
151 'test05' => $langs->trans('test05'),
152 'test06' => $langs->trans('test06'),
153);
154
155// Setup conf for a simple combo list
156$formSetup->newItem('MYMODULE_MYPARAM9')->setAsSelect($TField);
157
158// Setup conf for a multiselect combo list
159$item = $formSetup->newItem('MYMODULE_MYPARAM10');
160$item->setAsMultiSelect($TField);
161$item->helpText = $langs->transnoentities('MYMODULE_MYPARAM10');
162
163// Setup conf for a category selection
164$formSetup->newItem('MYMODULE_CATEGORY_ID_XXX')->setAsCategory('product');
165
166// Setup conf MYMODULE_MYPARAM10
167$item = $formSetup->newItem('MYMODULE_MYPARAM10');
168$item->setAsColor();
169$item->defaultFieldValue = '#FF0000';
170//$item->fieldValue = '';
171//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text
172//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too
173//$item->fieldInputOverride = false; // set this var to override field input
174//$item->fieldOutputOverride = false; // set this var to override field output
175
176$item = $formSetup->newItem('MYMODULE_MYPARAM11')->setAsHtml();
177$item->nameText = $item->getNameText().' more html text ';
178$item->fieldInputOverride = '';
179$item->helpText = $langs->transnoentities('HelpMessage');
180$item->cssClass = 'minwidth500';
181
182$item = $formSetup->newItem('MYMODULE_MYPARAM12');
183$item->fieldOverride = "Value forced, can't be modified";
184$item->cssClass = 'minwidth500';
185
186//$item = $formSetup->newItem('MYMODULE_MYPARAM13')->setAsDate(); // Not yet implemented
187
188// End of definition of parameters
189
190
191$setupnotempty += count($formSetup->items);
192
193
194$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
195
196$moduledir = 'mymodule';
197$myTmpObjects = array();
198// TODO Scan list of objects to fill this array
199$myTmpObjects['myobject'] = array('label' => 'MyObject', 'includerefgeneration' => 0, 'includedocgeneration' => 0, 'class' => 'MyObject');
200
201$tmpobjectkey = GETPOST('object', 'aZ09');
202if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
203 accessforbidden('Bad value for object. Hack attempt ?');
204}
205
206
207/*
208 * Actions
209 */
210
211// For retrocompatibility Dolibarr < 15.0
212if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
213 $formSetup->saveConfFromPost();
214}
215
216include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
217
218if ($action == 'updateMask') {
219 $maskconst = GETPOST('maskconst', 'aZ09');
220 $maskvalue = GETPOST('maskvalue', 'alpha');
221
222 if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
223 $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
224 if (!($res > 0)) {
225 $error++;
226 }
227 }
228
229 if (!$error) {
230 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
231 } else {
232 setEventMessages($langs->trans("Error"), null, 'errors');
233 }
234} elseif ($action == 'specimen' && $tmpobjectkey) {
235 $modele = GETPOST('module', 'alpha');
236
237 $className = $myTmpObjects[$tmpobjectkey]['class'];
238 $tmpobject = new $className($db);
239 '@phan-var-force MyObject $tmpobject';
240 $tmpobject->initAsSpecimen();
241
242 // Search template files
243 $file = '';
244 $className = '';
245 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
246 foreach ($dirmodels as $reldir) {
247 $file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
248 if (file_exists($file)) {
249 $className = "pdf_".$modele."_".strtolower($tmpobjectkey);
250 break;
251 }
252 }
253
254 if ($className !== '') {
255 require_once $file;
256
257 $module = new $className($db);
258 '@phan-var-force ModelePDFMyObject $module';
259
260 '@phan-var-force ModelePDFMyObject $module';
261
262 if ($module->write_file($tmpobject, $langs) > 0) {
263 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mymodule-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
264 return;
265 } else {
266 setEventMessages($module->error, null, 'errors');
267 dol_syslog($module->error, LOG_ERR);
268 }
269 } else {
270 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
271 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
272 }
273} elseif ($action == 'setmod') {
274 // TODO Check if numbering module chosen can be activated by calling method canBeActivated
275 if (!empty($tmpobjectkey)) {
276 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON";
277 dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
278 }
279} elseif ($action == 'set') {
280 // Activate a model
281 $ret = addDocumentModel($value, $type, $label, $scandir);
282} elseif ($action == 'del') {
283 $ret = delDocumentModel($value, $type);
284 if ($ret > 0) {
285 if (!empty($tmpobjectkey)) {
286 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
287 if (getDolGlobalString($constforval) == "$value") {
288 dolibarr_del_const($db, $constforval, $conf->entity);
289 }
290 }
291 }
292} elseif ($action == 'setdoc') {
293 // Set or unset default model
294 if (!empty($tmpobjectkey)) {
295 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
296 if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
297 // The constant that was read before the new set
298 // We therefore requires a variable to have a coherent view
299 $conf->global->{$constforval} = $value;
300 }
301
302 // We disable/enable the document template (into llx_document_model table)
303 $ret = delDocumentModel($value, $type);
304 if ($ret > 0) {
305 $ret = addDocumentModel($value, $type, $label, $scandir);
306 }
307 }
308} elseif ($action == 'unsetdoc') {
309 if (!empty($tmpobjectkey)) {
310 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
311 dolibarr_del_const($db, $constforval, $conf->entity);
312 }
313}
314
315$action = 'edit';
316
317
318/*
319 * View
320 */
321
322$form = new Form($db);
323
324$help_url = '';
325$title = "MyModuleSetup";
326
327llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', '', '', 'mod-mymodule page-admin');
328
329// Subheader
330$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
331
332print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
333
334// Configuration header
336print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "mymodule@mymodule");
337
338// Setup page goes here
339echo '<span class="opacitymedium">'.$langs->trans("MyModuleSetupPage").'</span><br><br>';
340
341
342/*if ($action == 'edit') {
343 print $formSetup->generateOutput(true);
344 print '<br>';
345 } elseif (!empty($formSetup->items)) {
346 print $formSetup->generateOutput();
347 print '<div class="tabsAction">';
348 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
349 print '</div>';
350 }
351 */
352if (!empty($formSetup->items)) {
353 print $formSetup->generateOutput(true);
354 print '<br>';
355}
356
357
358foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
359 if (!empty($myTmpObjectArray['includerefgeneration'])) {
360 /*
361 * Orders Numbering model
362 */
363 $setupnotempty++;
364
365 print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectArray['label']), '', '');
366
367 print '<table class="noborder centpercent">';
368 print '<tr class="liste_titre">';
369 print '<td>'.$langs->trans("Name").'</td>';
370 print '<td>'.$langs->trans("Description").'</td>';
371 print '<td class="nowrap">'.$langs->trans("Example").'</td>';
372 print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
373 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
374 print '</tr>'."\n";
375
376 clearstatcache();
377
378 foreach ($dirmodels as $reldir) {
379 $dir = dol_buildpath($reldir."core/modules/".$moduledir);
380
381 if (is_dir($dir)) {
382 $handle = opendir($dir);
383 if (is_resource($handle)) {
384 while (($file = readdir($handle)) !== false) {
385 if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
386 $file = substr($file, 0, dol_strlen($file) - 4);
387
388 require_once $dir.'/'.$file.'.php';
389
390 $module = new $file($db);
391 '@phan-var-force ModeleNumRefMyObject $module';
392
393 // Show modules according to features level
394 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
395 continue;
396 }
397 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
398 continue;
399 }
400
401 if ($module->isEnabled()) {
402 dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
403
404 print '<tr class="oddeven"><td>'.$module->getName($langs)."</td><td>\n";
405 print $module->info($langs);
406 print '</td>';
407
408 // Show example of numbering model
409 print '<td class="nowrap">';
410 $tmp = $module->getExample();
411 if (preg_match('/^Error/', $tmp)) {
412 $langs->load("errors");
413 print '<div class="error">'.$langs->trans($tmp).'</div>';
414 } elseif ($tmp == 'NotConfigured') {
415 print $langs->trans($tmp);
416 } else {
417 print $tmp;
418 }
419 print '</td>'."\n";
420
421 print '<td class="center">';
422 $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON';
423 if (getDolGlobalString($constforvar) == $file) {
424 print img_picto($langs->trans("Activated"), 'switch_on');
425 } else {
426 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
427 print img_picto($langs->trans("Disabled"), 'switch_off');
428 print '</a>';
429 }
430 print '</td>';
431
432 $className = $myTmpObjectArray['class'];
433 $mytmpinstance = new $className($db);
434 '@phan-var-force MyObject $mytmpinstance';
435 $mytmpinstance->initAsSpecimen();
436
437 // Info
438 $htmltooltip = '';
439 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
440
441 $nextval = $module->getNextValue($mytmpinstance);
442 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
443 $htmltooltip .= ''.$langs->trans("NextValue").': ';
444 if ($nextval) {
445 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
446 $nextval = $langs->trans($nextval);
447 }
448 $htmltooltip .= $nextval.'<br>';
449 } else {
450 $htmltooltip .= $langs->trans($module->error).'<br>';
451 }
452 }
453
454 print '<td class="center">';
455 print $form->textwithpicto('', $htmltooltip, 1, 0);
456 print '</td>';
457
458 print "</tr>\n";
459 }
460 }
461 }
462 closedir($handle);
463 }
464 }
465 }
466 print "</table><br>\n";
467 }
468
469 if (!empty($myTmpObjectArray['includedocgeneration'])) {
470 /*
471 * Document templates generators
472 */
473 $setupnotempty++;
474 $type = strtolower($myTmpObjectKey);
475
476 print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
477
478 // Load array def with activated templates
479 $def = array();
480 $sql = "SELECT nom";
481 $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
482 $sql .= " WHERE type = '".$db->escape($type)."'";
483 $sql .= " AND entity = ".$conf->entity;
484 $resql = $db->query($sql);
485 if ($resql) {
486 $i = 0;
487 $num_rows = $db->num_rows($resql);
488 while ($i < $num_rows) {
489 $array = $db->fetch_array($resql);
490 array_push($def, $array[0]);
491 $i++;
492 }
493 } else {
494 dol_print_error($db);
495 }
496
497 print '<table class="noborder centpercent">'."\n";
498 print '<tr class="liste_titre">'."\n";
499 print '<td>'.$langs->trans("Name").'</td>';
500 print '<td>'.$langs->trans("Description").'</td>';
501 print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
502 print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
503 print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
504 print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
505 print "</tr>\n";
506
507 clearstatcache();
508
509 foreach ($dirmodels as $reldir) {
510 foreach (array('', '/doc') as $valdir) {
511 $realpath = $reldir."core/modules/".$moduledir.$valdir;
512 $dir = dol_buildpath($realpath);
513
514 if (is_dir($dir)) {
515 $handle = opendir($dir);
516 if (is_resource($handle)) {
517 $filelist = array();
518 while (($file = readdir($handle)) !== false) {
519 $filelist[] = $file;
520 }
521 closedir($handle);
522 arsort($filelist);
523
524 foreach ($filelist as $file) {
525 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
526 if (file_exists($dir.'/'.$file)) {
527 $name = substr($file, 4, dol_strlen($file) - 16);
528 $className = substr($file, 0, dol_strlen($file) - 12);
529
530 require_once $dir.'/'.$file;
531 $module = new $className($db);
532 '@phan-var-force ModelePDFMyObject $module';
533
534 $modulequalified = 1;
535 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
536 $modulequalified = 0;
537 }
538 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
539 $modulequalified = 0;
540 }
541
542 if ($modulequalified) {
543 print '<tr class="oddeven"><td width="100">';
544 print(empty($module->name) ? $name : $module->name);
545 print "</td><td>\n";
546 if (method_exists($module, 'info')) {
547 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
548 } else {
549 print $module->description;
550 }
551 print '</td>';
552
553 // Active
554 if (in_array($name, $def)) {
555 print '<td class="center">'."\n";
556 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
557 print img_picto($langs->trans("Enabled"), 'switch_on');
558 print '</a>';
559 print '</td>';
560 } else {
561 print '<td class="center">'."\n";
562 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>';
563 print "</td>";
564 }
565
566 // Default
567 print '<td class="center">';
568 $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
569 if (getDolGlobalString($constforvar) == $name) {
570 //print img_picto($langs->trans("Default"), 'on');
571 // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
572 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).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
573 } else {
574 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>';
575 }
576 print '</td>';
577
578 // Info
579 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
580 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
581 if ($module->type == 'pdf') {
582 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
583 }
584 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
585
586 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
587 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
588 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
589
590 print '<td class="center">';
591 print $form->textwithpicto('', $htmltooltip, 1, 0);
592 print '</td>';
593
594 // Preview
595 print '<td class="center">';
596 if ($module->type == 'pdf') {
597 $newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
598 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($newname).'&object='.urlencode($myTmpObjectKey).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
599 } else {
600 print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
601 }
602 print '</td>';
603
604 print "</tr>\n";
605 }
606 }
607 }
608 }
609 }
610 }
611 }
612 }
613
614 print '</table>';
615 }
616}
617
618if (empty($setupnotempty)) {
619 print '<br>'.$langs->trans("NothingToSetup");
620}
621
622// Page end
623print dol_get_fiche_end();
624
625llxFooter();
626$db->close();
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).
Definition admin.lib.php:69
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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.
Definition wrapper.php:71
Class to manage generation of HTML components Only common components must be here.
This class help you create setup render.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
mymoduleAdminPrepareHead()
Prepare admin pages header.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:153
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.