dolibarr 23.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 str_replace("..", "", $_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->fieldParams['isMandatory'] = 1;
116$item->fieldAttr['placeholder'] = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
117$item->cssClass = 'minwidth500';
118
119// Setup conf for selection of a simple string input
120$item = $formSetup->newItem('MYMODULE_MYPARAM2');
121$item->defaultFieldValue = 'default value';
122$item->fieldAttr['placeholder'] = 'A placeholder here';
123$item->helpText = 'Tooltip text';
124
125// Setup conf for selection of a simple textarea input but we replace the text of field title
126$item = $formSetup->newItem('MYMODULE_MYPARAM3');
127$item->nameText = $item->getNameText().' more html text ';
128
129// Setup conf for a selection of a Thirdparty
130$item = $formSetup->newItem('MYMODULE_MYPARAM4');
131$item->setAsThirdpartyType();
132
133// Setup conf for a selection of a boolean
134$formSetup->newItem('MYMODULE_MYPARAM5')->setAsYesNo(); // ->fieldParams['alertifoff'] = 1 or ->fieldParams['alertifon'] = 1;
135
136// Setup conf for a selection of an Email template of type thirdparty
137$formSetup->newItem('MYMODULE_MYPARAM6')->setAsEmailTemplate('thirdparty');
138
139// Setup conf for a selection of a secured key
140//$formSetup->newItem('MYMODULE_MYPARAM7')->setAsSecureKey();
141
142// Setup conf for a selection of a Product
143$formSetup->newItem('MYMODULE_MYPARAM8')->setAsProduct();
144
145// Add a title for a new section
146$formSetup->newItem('NewSection')->setAsTitle();
147
148$TField = array(
149 'test01' => $langs->trans('test01'),
150 'test02' => $langs->trans('test02'),
151 'test03' => $langs->trans('test03'),
152 'test04' => $langs->trans('test04'),
153 'test05' => $langs->trans('test05'),
154 'test06' => $langs->trans('test06'),
155);
156
157// Setup conf for a simple combo list
158$formSetup->newItem('MYMODULE_MYPARAM9')->setAsSelect($TField);
159
160// Setup conf for a multiselect combo list
161$item = $formSetup->newItem('MYMODULE_MYPARAM10');
162$item->setAsMultiSelect($TField);
163$item->helpText = $langs->transnoentities('MYMODULE_MYPARAM10');
164
165// Setup conf for a category selection
166$formSetup->newItem('MYMODULE_CATEGORY_ID_XXX')->setAsCategory('product');
167
168// Setup conf MYMODULE_MYPARAM10
169$item = $formSetup->newItem('MYMODULE_MYPARAM10');
170$item->setAsColor();
171$item->defaultFieldValue = '#FF0000';
172//$item->fieldValue = '';
173//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text
174//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too
175//$item->fieldInputOverride = false; // set this var to override field input
176//$item->fieldOutputOverride = false; // set this var to override field output
177
178$item = $formSetup->newItem('MYMODULE_MYPARAM11')->setAsHtml();
179$item->nameText = $item->getNameText().' more html text ';
180$item->fieldInputOverride = '';
181$item->helpText = $langs->transnoentities('HelpMessage');
182$item->cssClass = 'minwidth500';
183
184$item = $formSetup->newItem('MYMODULE_MYPARAM12');
185$item->fieldOverride = "Value forced, can't be modified";
186$item->cssClass = 'minwidth500';
187
188//$item = $formSetup->newItem('MYMODULE_MYPARAM13')->setAsDate(); // Not yet implemented
189
190// End of definition of parameters
191
192
193$setupnotempty += count($formSetup->items);
194
195
196$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
197
198$moduledir = 'mymodule';
199$myTmpObjects = array();
200// TODO Scan list of objects to fill this array
201$myTmpObjects['myobject'] = array('label' => 'MyObject', 'includerefgeneration' => 0, 'includedocgeneration' => 0, 'class' => 'MyObject');
202
203$tmpobjectkey = GETPOST('object', 'aZ09');
204if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
205 accessforbidden('Bad value for object. Hack attempt ?');
206}
207
208
209/*
210 * Actions
211 */
212
213// For retrocompatibility Dolibarr < 15.0
214if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
215 $formSetup->saveConfFromPost();
216}
217
218include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
219
220if ($action == 'updateMask') {
221 $maskconst = GETPOST('maskconst', 'aZ09');
222 $maskvalue = GETPOST('maskvalue', 'alpha');
223
224 if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
225 $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
226 if (!($res > 0)) {
227 $error++;
228 }
229 }
230
231 if (!$error) {
232 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
233 } else {
234 setEventMessages($langs->trans("Error"), null, 'errors');
235 }
236} elseif ($action == 'specimen' && $tmpobjectkey) {
237 $modele = GETPOST('module', 'alpha');
238
239 $className = $myTmpObjects[$tmpobjectkey]['class'];
240 $tmpobject = new $className($db);
241 '@phan-var-force MyObject $tmpobject';
242 $tmpobject->initAsSpecimen();
243
244 // Search template files
245 $file = '';
246 $className = '';
247 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
248 foreach ($dirmodels as $reldir) {
249 $file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
250 if (file_exists($file)) {
251 $className = "pdf_".$modele."_".strtolower($tmpobjectkey);
252 break;
253 }
254 }
255
256 if ($className !== '') {
257 require_once $file;
258
259 $module = new $className($db);
260 '@phan-var-force ModelePDFMyObject $module';
261
262 '@phan-var-force ModelePDFMyObject $module';
263
264 if ($module->write_file($tmpobject, $langs) > 0) {
265 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mymodule-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
266 return;
267 } else {
268 setEventMessages($module->error, null, 'errors');
269 dol_syslog($module->error, LOG_ERR);
270 }
271 } else {
272 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
273 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
274 }
275} elseif ($action == 'setmod') {
276 // TODO Check if numbering module chosen can be activated by calling method canBeActivated
277 if (!empty($tmpobjectkey)) {
278 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON";
279 dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
280 }
281} elseif ($action == 'set') {
282 // Activate a model
283 $ret = addDocumentModel($value, $type, $label, $scandir);
284} elseif ($action == 'del') {
285 $ret = delDocumentModel($value, $type);
286 if ($ret > 0) {
287 if (!empty($tmpobjectkey)) {
288 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
289 if (getDolGlobalString($constforval) == "$value") {
290 dolibarr_del_const($db, $constforval, $conf->entity);
291 }
292 }
293 }
294} elseif ($action == 'setdoc') {
295 // Set or unset default model
296 if (!empty($tmpobjectkey)) {
297 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
298 if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
299 // The constant that was read before the new set
300 // We therefore requires a variable to have a coherent view
301 $conf->global->{$constforval} = $value;
302 }
303
304 // We disable/enable the document template (into llx_document_model table)
305 $ret = delDocumentModel($value, $type);
306 if ($ret > 0) {
307 $ret = addDocumentModel($value, $type, $label, $scandir);
308 }
309 }
310} elseif ($action == 'unsetdoc') {
311 if (!empty($tmpobjectkey)) {
312 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
313 dolibarr_del_const($db, $constforval, $conf->entity);
314 }
315}
316
317$action = 'edit';
318
319
320/*
321 * View
322 */
323
324$form = new Form($db);
325
326$help_url = '';
327$title = "MyModuleSetup";
328
329llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', '', '', 'mod-mymodule page-admin');
330
331// Subheader
332$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
333
334print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
335
336// Configuration header
338print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "mymodule@mymodule");
339
340// Setup page goes here
341echo '<span class="opacitymedium">'.$langs->trans("MyModuleSetupPage").'</span><br><br>';
342
343
344/*if ($action == 'edit') {
345 print $formSetup->generateOutput(true);
346 print '<br>';
347 } elseif (!empty($formSetup->items)) {
348 print $formSetup->generateOutput();
349 print '<div class="tabsAction">';
350 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
351 print '</div>';
352 }
353 */
354if (!empty($formSetup->items)) {
355 print $formSetup->generateOutput(true);
356 print '<br>';
357}
358
359
360foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
361 if (!empty($myTmpObjectArray['includerefgeneration'])) {
362 // Numbering models
363
364 $setupnotempty++;
365
366 print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectArray['label']), '', '');
367
368 print '<table class="noborder centpercent">';
369 print '<tr class="liste_titre">';
370 print '<td>'.$langs->trans("Name").'</td>';
371 print '<td>'.$langs->trans("Description").'</td>';
372 print '<td class="nowrap">'.$langs->trans("Example").'</td>';
373 print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
374 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
375 print '</tr>'."\n";
376
377 clearstatcache();
378
379 foreach ($dirmodels as $reldir) {
380 $dir = dol_buildpath($reldir."core/modules/".$moduledir);
381
382 if (is_dir($dir)) {
383 $handle = opendir($dir);
384 if (is_resource($handle)) {
385 while (($file = readdir($handle)) !== false) {
386 if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
387 $file = substr($file, 0, dol_strlen($file) - 4);
388
389 require_once $dir.'/'.$file.'.php';
390
391 $module = new $file($db);
392 '@phan-var-force ModeleNumRefMyObject $module';
393
394 // Show modules according to features level
395 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
396 continue;
397 }
398 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
399 continue;
400 }
401
402 if ($module->isEnabled()) {
403 dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
404
405 print '<tr class="oddeven"><td>'.$module->getName($langs)."</td><td>\n";
406 print $module->info($langs);
407 print '</td>';
408
409 // Show example of numbering model
410 print '<td class="nowrap">';
411 $tmp = $module->getExample();
412 if (preg_match('/^Error/', $tmp)) {
413 $langs->load("errors");
414 print '<div class="error">'.$langs->trans($tmp).'</div>';
415 } elseif ($tmp == 'NotConfigured') {
416 print $langs->trans($tmp);
417 } else {
418 print $tmp;
419 }
420 print '</td>'."\n";
421
422 print '<td class="center">';
423 $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON';
424 $defaultifnotset = 'thevaluetousebydefault';
425 $activenumberingmodel = getDolGlobalString($constforvar, $defaultifnotset);
426 if ($activenumberingmodel == $file) {
427 print img_picto($langs->trans("Activated"), 'switch_on');
428 } else {
429 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
430 print img_picto($langs->trans("Disabled"), 'switch_off');
431 print '</a>';
432 }
433 print '</td>';
434
435 $className = $myTmpObjectArray['class'];
436 $mytmpinstance = new $className($db);
437 '@phan-var-force MyObject $mytmpinstance';
438 $mytmpinstance->initAsSpecimen();
439
440 // Info
441 $htmltooltip = '';
442 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
443
444 $nextval = $module->getNextValue($mytmpinstance);
445 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
446 $htmltooltip .= ''.$langs->trans("NextValue").': ';
447 if ($nextval) {
448 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
449 $nextval = $langs->trans($nextval);
450 }
451 $htmltooltip .= $nextval.'<br>';
452 } else {
453 $htmltooltip .= $langs->trans($module->error).'<br>';
454 }
455 }
456
457 print '<td class="center">';
458 print $form->textwithpicto('', $htmltooltip, 1, 'info');
459 print '</td>';
460
461 print "</tr>\n";
462 }
463 }
464 }
465 closedir($handle);
466 }
467 }
468 }
469 print "</table><br>\n";
470 }
471
472 if (!empty($myTmpObjectArray['includedocgeneration'])) {
473 /*
474 * Document templates generators
475 */
476 $setupnotempty++;
477 $type = strtolower($myTmpObjectKey);
478
479 print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
480
481 // Load array def with activated templates
482 $def = array();
483 // TODO Replace with $def = getListOfModels($db, $type);
484 $sql = "SELECT nom";
485 $sql .= " FROM ".$db->prefix()."document_model";
486 $sql .= " WHERE type = '".$db->escape($type)."'";
487 $sql .= " AND entity = ".$conf->entity;
488 $resql = $db->query($sql);
489 if ($resql) {
490 $i = 0;
491 $num_rows = $db->num_rows($resql);
492 while ($i < $num_rows) {
493 $array = $db->fetch_array($resql);
494 array_push($def, $array[0]);
495 $i++;
496 }
497 } else {
498 dol_print_error($db);
499 }
500
501 print '<table class="noborder centpercent">'."\n";
502 print '<tr class="liste_titre">'."\n";
503 print '<td>'.$langs->trans("Name").'</td>';
504 print '<td>'.$langs->trans("Description").'</td>';
505 print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
506 print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
507 print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
508 print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
509 print "</tr>\n";
510
511 clearstatcache();
512
513 foreach ($dirmodels as $reldir) {
514 foreach (array('', '/doc') as $valdir) {
515 $realpath = $reldir."core/modules/".$moduledir.$valdir;
516 $dir = dol_buildpath($realpath);
517
518 if (is_dir($dir)) {
519 $handle = opendir($dir);
520 if (is_resource($handle)) {
521 $filelist = array();
522 while (($file = readdir($handle)) !== false) {
523 $filelist[] = $file;
524 }
525 closedir($handle);
526 arsort($filelist);
527
528 foreach ($filelist as $file) {
529 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
530 if (file_exists($dir.'/'.$file)) {
531 $name = substr($file, 4, dol_strlen($file) - 16);
532 $className = substr($file, 0, dol_strlen($file) - 12);
533
534 require_once $dir.'/'.$file;
535 $module = new $className($db);
536 '@phan-var-force ModelePDFMyObject $module';
537
538 $modulequalified = 1;
539 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
540 $modulequalified = 0;
541 }
542 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
543 $modulequalified = 0;
544 }
545
546 if ($modulequalified) {
547 print '<tr class="oddeven"><td width="100">';
548 print(empty($module->name) ? $name : $module->name);
549 print "</td><td>\n";
550 if (method_exists($module, 'info')) {
551 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
552 } else {
553 print $module->description;
554 }
555 print '</td>';
556
557 // Active
558 if (in_array($name, $def)) {
559 print '<td class="center">'."\n";
560 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
561 print img_picto($langs->trans("Enabled"), 'switch_on');
562 print '</a>';
563 print '</td>';
564 } else {
565 print '<td class="center">'."\n";
566 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>';
567 print "</td>";
568 }
569
570 // Default
571 print '<td class="center">';
572 $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
573 if (getDolGlobalString($constforvar) == $name) {
574 //print img_picto($langs->trans("Default"), 'on');
575 // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
576 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>';
577 } else {
578 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>';
579 }
580 print '</td>';
581
582 // Info
583 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
584 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
585 if ($module->type == 'pdf') {
586 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
587 }
588 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
589
590 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
591 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
592 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
593
594 print '<td class="center">';
595 print $form->textwithpicto('', $htmltooltip, 1, 'info');
596 print '</td>';
597
598 // Preview
599 print '<td class="center">';
600 if ($module->type == 'pdf') {
601 $newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
602 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($newname).'&object='.urlencode($myTmpObjectKey).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
603 } else {
604 print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
605 }
606 print '</td>';
607
608 print "</tr>\n";
609 }
610 }
611 }
612 }
613 }
614 }
615 }
616 }
617
618 print '</table>';
619 }
620}
621
622if (empty($setupnotempty)) {
623 print '<br>'.$langs->trans("NothingToSetup");
624}
625
626// Page end
627print dol_get_fiche_end();
628
629llxFooter();
630$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), to know if a version (a,b,c) is lower than (x,...
Definition admin.lib.php:71
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage generation of HTML components Only common components must be here.
This class help you create setup render.
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, $morecssdiv='')
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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:128
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.