dolibarr 21.0.0-beta
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} else {
356 print '<br>'.$langs->trans("NothingToSetup");
357}
358
359
360foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
361 if (!empty($myTmpObjectArray['includerefgeneration'])) {
362 /*
363 * Orders Numbering model
364 */
365 $setupnotempty++;
366
367 print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectArray['label']), '', '');
368
369 print '<table class="noborder centpercent">';
370 print '<tr class="liste_titre">';
371 print '<td>'.$langs->trans("Name").'</td>';
372 print '<td>'.$langs->trans("Description").'</td>';
373 print '<td class="nowrap">'.$langs->trans("Example").'</td>';
374 print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
375 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
376 print '</tr>'."\n";
377
378 clearstatcache();
379
380 foreach ($dirmodels as $reldir) {
381 $dir = dol_buildpath($reldir."core/modules/".$moduledir);
382
383 if (is_dir($dir)) {
384 $handle = opendir($dir);
385 if (is_resource($handle)) {
386 while (($file = readdir($handle)) !== false) {
387 if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
388 $file = substr($file, 0, dol_strlen($file) - 4);
389
390 require_once $dir.'/'.$file.'.php';
391
392 $module = new $file($db);
393 '@phan-var-force ModeleNumRefMyObject $module';
394
395 // Show modules according to features level
396 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
397 continue;
398 }
399 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
400 continue;
401 }
402
403 if ($module->isEnabled()) {
404 dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
405
406 print '<tr class="oddeven"><td>'.$module->getName($langs)."</td><td>\n";
407 print $module->info($langs);
408 print '</td>';
409
410 // Show example of numbering model
411 print '<td class="nowrap">';
412 $tmp = $module->getExample();
413 if (preg_match('/^Error/', $tmp)) {
414 $langs->load("errors");
415 print '<div class="error">'.$langs->trans($tmp).'</div>';
416 } elseif ($tmp == 'NotConfigured') {
417 print $langs->trans($tmp);
418 } else {
419 print $tmp;
420 }
421 print '</td>'."\n";
422
423 print '<td class="center">';
424 $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON';
425 if (getDolGlobalString($constforvar) == $file) {
426 print img_picto($langs->trans("Activated"), 'switch_on');
427 } else {
428 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
429 print img_picto($langs->trans("Disabled"), 'switch_off');
430 print '</a>';
431 }
432 print '</td>';
433
434 $className = $myTmpObjectArray['class'];
435 $mytmpinstance = new $className($db);
436 '@phan-var-force MyObject $mytmpinstance';
437 $mytmpinstance->initAsSpecimen();
438
439 // Info
440 $htmltooltip = '';
441 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
442
443 $nextval = $module->getNextValue($mytmpinstance);
444 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
445 $htmltooltip .= ''.$langs->trans("NextValue").': ';
446 if ($nextval) {
447 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
448 $nextval = $langs->trans($nextval);
449 }
450 $htmltooltip .= $nextval.'<br>';
451 } else {
452 $htmltooltip .= $langs->trans($module->error).'<br>';
453 }
454 }
455
456 print '<td class="center">';
457 print $form->textwithpicto('', $htmltooltip, 1, 0);
458 print '</td>';
459
460 print "</tr>\n";
461 }
462 }
463 }
464 closedir($handle);
465 }
466 }
467 }
468 print "</table><br>\n";
469 }
470
471 if (!empty($myTmpObjectArray['includedocgeneration'])) {
472 /*
473 * Document templates generators
474 */
475 $setupnotempty++;
476 $type = strtolower($myTmpObjectKey);
477
478 print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
479
480 // Load array def with activated templates
481 $def = array();
482 $sql = "SELECT nom";
483 $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
484 $sql .= " WHERE type = '".$db->escape($type)."'";
485 $sql .= " AND entity = ".$conf->entity;
486 $resql = $db->query($sql);
487 if ($resql) {
488 $i = 0;
489 $num_rows = $db->num_rows($resql);
490 while ($i < $num_rows) {
491 $array = $db->fetch_array($resql);
492 array_push($def, $array[0]);
493 $i++;
494 }
495 } else {
496 dol_print_error($db);
497 }
498
499 print '<table class="noborder centpercent">'."\n";
500 print '<tr class="liste_titre">'."\n";
501 print '<td>'.$langs->trans("Name").'</td>';
502 print '<td>'.$langs->trans("Description").'</td>';
503 print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
504 print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
505 print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
506 print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
507 print "</tr>\n";
508
509 clearstatcache();
510
511 foreach ($dirmodels as $reldir) {
512 foreach (array('', '/doc') as $valdir) {
513 $realpath = $reldir."core/modules/".$moduledir.$valdir;
514 $dir = dol_buildpath($realpath);
515
516 if (is_dir($dir)) {
517 $handle = opendir($dir);
518 if (is_resource($handle)) {
519 $filelist = array();
520 while (($file = readdir($handle)) !== false) {
521 $filelist[] = $file;
522 }
523 closedir($handle);
524 arsort($filelist);
525
526 foreach ($filelist as $file) {
527 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
528 if (file_exists($dir.'/'.$file)) {
529 $name = substr($file, 4, dol_strlen($file) - 16);
530 $className = substr($file, 0, dol_strlen($file) - 12);
531
532 require_once $dir.'/'.$file;
533 $module = new $className($db);
534 '@phan-var-force ModelePDFMyObject $module';
535
536 $modulequalified = 1;
537 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
538 $modulequalified = 0;
539 }
540 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
541 $modulequalified = 0;
542 }
543
544 if ($modulequalified) {
545 print '<tr class="oddeven"><td width="100">';
546 print(empty($module->name) ? $name : $module->name);
547 print "</td><td>\n";
548 if (method_exists($module, 'info')) {
549 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
550 } else {
551 print $module->description;
552 }
553 print '</td>';
554
555 // Active
556 if (in_array($name, $def)) {
557 print '<td class="center">'."\n";
558 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
559 print img_picto($langs->trans("Enabled"), 'switch_on');
560 print '</a>';
561 print '</td>';
562 } else {
563 print '<td class="center">'."\n";
564 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>';
565 print "</td>";
566 }
567
568 // Default
569 print '<td class="center">';
570 $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
571 if (getDolGlobalString($constforvar) == $name) {
572 //print img_picto($langs->trans("Default"), 'on');
573 // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
574 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>';
575 } else {
576 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>';
577 }
578 print '</td>';
579
580 // Info
581 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
582 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
583 if ($module->type == 'pdf') {
584 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
585 }
586 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
587
588 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
589 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
590 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
591
592 print '<td class="center">';
593 print $form->textwithpicto('', $htmltooltip, 1, 0);
594 print '</td>';
595
596 // Preview
597 print '<td class="center">';
598 if ($module->type == 'pdf') {
599 $newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
600 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($newname).'&object='.urlencode($myTmpObjectKey).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
601 } else {
602 print img_object($langs->trans("PreviewNotAvailable"), 'generic');
603 }
604 print '</td>';
605
606 print "</tr>\n";
607 }
608 }
609 }
610 }
611 }
612 }
613 }
614 }
615
616 print '</table>';
617 }
618}
619
620if (empty($setupnotempty)) {
621 print '<br>'.$langs->trans("NothingToSetup");
622}
623
624// Page end
625print dol_get_fiche_end();
626
627llxFooter();
628$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
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.
llxFooter()
Footer empty.
Definition document.php:107
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.
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:152
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.