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