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->fieldOverride = (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->nameText = $item->getNameText().' more html text ';
163$item->fieldInputOverride = '';
164$item->helpText = $langs->transnoentities('AnHelpMessage');
165//$item->fieldValue = '';
166//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text
167//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too
168//$item->fieldInputOverride = false; // set this var to override field input
169//$item->fieldOutputOverride = false; // set this var to override field output
170
171
172$setupnotempty += count($formSetup->items);
173
174
175$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
176
177$moduledir = 'mymodule';
178$myTmpObjects = array();
179// TODO Scan list of objects to fill this array
180$myTmpObjects['myobject'] = array('label' => 'MyObject', 'includerefgeneration' => 0, 'includedocgeneration' => 0, 'class' => 'MyObject');
181
182$tmpobjectkey = GETPOST('object', 'aZ09');
183if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
184 accessforbidden('Bad value for object. Hack attempt ?');
185}
186
187
188/*
189 * Actions
190 */
191
192// For retrocompatibility Dolibarr < 15.0
193if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
194 $formSetup->saveConfFromPost();
195}
196
197include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
198
199if ($action == 'updateMask') {
200 $maskconst = GETPOST('maskconst', 'aZ09');
201 $maskvalue = GETPOST('maskvalue', 'alpha');
202
203 if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
204 $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
205 if (!($res > 0)) {
206 $error++;
207 }
208 }
209
210 if (!$error) {
211 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
212 } else {
213 setEventMessages($langs->trans("Error"), null, 'errors');
214 }
215} elseif ($action == 'specimen' && $tmpobjectkey) {
216 $modele = GETPOST('module', 'alpha');
217
218 $className = $myTmpObjects[$tmpobjectkey]['class'];
219 $tmpobject = new $className($db);
220 '@phan-var-force MyObject $tmpobject';
221 $tmpobject->initAsSpecimen();
222
223 // Search template files
224 $file = '';
225 $className = '';
226 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
227 foreach ($dirmodels as $reldir) {
228 $file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
229 if (file_exists($file)) {
230 $className = "pdf_".$modele."_".strtolower($tmpobjectkey);
231 break;
232 }
233 }
234
235 if ($className !== '') {
236 require_once $file;
237
238 $module = new $className($db);
239 '@phan-var-force ModelePDFMyObject $module';
240
241 '@phan-var-force ModelePDFMyObject $module';
242
243 if ($module->write_file($tmpobject, $langs) > 0) {
244 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mymodule-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
245 return;
246 } else {
247 setEventMessages($module->error, null, 'errors');
248 dol_syslog($module->error, LOG_ERR);
249 }
250 } else {
251 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
252 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
253 }
254} elseif ($action == 'setmod') {
255 // TODO Check if numbering module chosen can be activated by calling method canBeActivated
256 if (!empty($tmpobjectkey)) {
257 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON";
258 dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
259 }
260} elseif ($action == 'set') {
261 // Activate a model
262 $ret = addDocumentModel($value, $type, $label, $scandir);
263} elseif ($action == 'del') {
264 $ret = delDocumentModel($value, $type);
265 if ($ret > 0) {
266 if (!empty($tmpobjectkey)) {
267 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
268 if (getDolGlobalString($constforval) == "$value") {
269 dolibarr_del_const($db, $constforval, $conf->entity);
270 }
271 }
272 }
273} elseif ($action == 'setdoc') {
274 // Set or unset default model
275 if (!empty($tmpobjectkey)) {
276 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
277 if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
278 // The constant that was read before the new set
279 // We therefore requires a variable to have a coherent view
280 $conf->global->{$constforval} = $value;
281 }
282
283 // We disable/enable the document template (into llx_document_model table)
284 $ret = delDocumentModel($value, $type);
285 if ($ret > 0) {
286 $ret = addDocumentModel($value, $type, $label, $scandir);
287 }
288 }
289} elseif ($action == 'unsetdoc') {
290 if (!empty($tmpobjectkey)) {
291 $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
292 dolibarr_del_const($db, $constforval, $conf->entity);
293 }
294}
295
296$action = 'edit';
297
298
299/*
300 * View
301 */
302
303$form = new Form($db);
304
305$help_url = '';
306$title = "MyModuleSetup";
307
308llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', '', '', 'mod-mymodule page-admin');
309
310// Subheader
311$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
312
313print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
314
315// Configuration header
317print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "mymodule@mymodule");
318
319// Setup page goes here
320echo '<span class="opacitymedium">'.$langs->trans("MyModuleSetupPage").'</span><br><br>';
321
322
323/*if ($action == 'edit') {
324 print $formSetup->generateOutput(true);
325 print '<br>';
326 } elseif (!empty($formSetup->items)) {
327 print $formSetup->generateOutput();
328 print '<div class="tabsAction">';
329 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
330 print '</div>';
331 }
332 */
333if (!empty($formSetup->items)) {
334 print $formSetup->generateOutput(true);
335 print '<br>';
336} else {
337 print '<br>'.$langs->trans("NothingToSetup");
338}
339
340
341foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
342 if (!empty($myTmpObjectArray['includerefgeneration'])) {
343 /*
344 * Orders Numbering model
345 */
346 $setupnotempty++;
347
348 print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectArray['label']), '', '');
349
350 print '<table class="noborder centpercent">';
351 print '<tr class="liste_titre">';
352 print '<td>'.$langs->trans("Name").'</td>';
353 print '<td>'.$langs->trans("Description").'</td>';
354 print '<td class="nowrap">'.$langs->trans("Example").'</td>';
355 print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
356 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
357 print '</tr>'."\n";
358
359 clearstatcache();
360
361 foreach ($dirmodels as $reldir) {
362 $dir = dol_buildpath($reldir."core/modules/".$moduledir);
363
364 if (is_dir($dir)) {
365 $handle = opendir($dir);
366 if (is_resource($handle)) {
367 while (($file = readdir($handle)) !== false) {
368 if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
369 $file = substr($file, 0, dol_strlen($file) - 4);
370
371 require_once $dir.'/'.$file.'.php';
372
373 $module = new $file($db);
374 '@phan-var-force ModeleNumRefMyObject $module';
375
376 // Show modules according to features level
377 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
378 continue;
379 }
380 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
381 continue;
382 }
383
384 if ($module->isEnabled()) {
385 dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
386
387 print '<tr class="oddeven"><td>'.$module->getName($langs)."</td><td>\n";
388 print $module->info($langs);
389 print '</td>';
390
391 // Show example of numbering model
392 print '<td class="nowrap">';
393 $tmp = $module->getExample();
394 if (preg_match('/^Error/', $tmp)) {
395 $langs->load("errors");
396 print '<div class="error">'.$langs->trans($tmp).'</div>';
397 } elseif ($tmp == 'NotConfigured') {
398 print $langs->trans($tmp);
399 } else {
400 print $tmp;
401 }
402 print '</td>'."\n";
403
404 print '<td class="center">';
405 $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON';
406 if (getDolGlobalString($constforvar) == $file) {
407 print img_picto($langs->trans("Activated"), 'switch_on');
408 } else {
409 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
410 print img_picto($langs->trans("Disabled"), 'switch_off');
411 print '</a>';
412 }
413 print '</td>';
414
415 $className = $myTmpObjectArray['class'];
416 $mytmpinstance = new $className($db);
417 '@phan-var-force MyObject $mytmpinstance';
418 $mytmpinstance->initAsSpecimen();
419
420 // Info
421 $htmltooltip = '';
422 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
423
424 $nextval = $module->getNextValue($mytmpinstance);
425 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
426 $htmltooltip .= ''.$langs->trans("NextValue").': ';
427 if ($nextval) {
428 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
429 $nextval = $langs->trans($nextval);
430 }
431 $htmltooltip .= $nextval.'<br>';
432 } else {
433 $htmltooltip .= $langs->trans($module->error).'<br>';
434 }
435 }
436
437 print '<td class="center">';
438 print $form->textwithpicto('', $htmltooltip, 1, 0);
439 print '</td>';
440
441 print "</tr>\n";
442 }
443 }
444 }
445 closedir($handle);
446 }
447 }
448 }
449 print "</table><br>\n";
450 }
451
452 if (!empty($myTmpObjectArray['includedocgeneration'])) {
453 /*
454 * Document templates generators
455 */
456 $setupnotempty++;
457 $type = strtolower($myTmpObjectKey);
458
459 print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
460
461 // Load array def with activated templates
462 $def = array();
463 $sql = "SELECT nom";
464 $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
465 $sql .= " WHERE type = '".$db->escape($type)."'";
466 $sql .= " AND entity = ".$conf->entity;
467 $resql = $db->query($sql);
468 if ($resql) {
469 $i = 0;
470 $num_rows = $db->num_rows($resql);
471 while ($i < $num_rows) {
472 $array = $db->fetch_array($resql);
473 array_push($def, $array[0]);
474 $i++;
475 }
476 } else {
477 dol_print_error($db);
478 }
479
480 print '<table class="noborder centpercent">'."\n";
481 print '<tr class="liste_titre">'."\n";
482 print '<td>'.$langs->trans("Name").'</td>';
483 print '<td>'.$langs->trans("Description").'</td>';
484 print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
485 print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
486 print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
487 print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
488 print "</tr>\n";
489
490 clearstatcache();
491
492 foreach ($dirmodels as $reldir) {
493 foreach (array('', '/doc') as $valdir) {
494 $realpath = $reldir."core/modules/".$moduledir.$valdir;
495 $dir = dol_buildpath($realpath);
496
497 if (is_dir($dir)) {
498 $handle = opendir($dir);
499 if (is_resource($handle)) {
500 $filelist = array();
501 while (($file = readdir($handle)) !== false) {
502 $filelist[] = $file;
503 }
504 closedir($handle);
505 arsort($filelist);
506
507 foreach ($filelist as $file) {
508 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
509 if (file_exists($dir.'/'.$file)) {
510 $name = substr($file, 4, dol_strlen($file) - 16);
511 $className = substr($file, 0, dol_strlen($file) - 12);
512
513 require_once $dir.'/'.$file;
514 $module = new $className($db);
515 '@phan-var-force ModelePDFMyObject $module';
516
517 $modulequalified = 1;
518 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
519 $modulequalified = 0;
520 }
521 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
522 $modulequalified = 0;
523 }
524
525 if ($modulequalified) {
526 print '<tr class="oddeven"><td width="100">';
527 print(empty($module->name) ? $name : $module->name);
528 print "</td><td>\n";
529 if (method_exists($module, 'info')) {
530 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
531 } else {
532 print $module->description;
533 }
534 print '</td>';
535
536 // Active
537 if (in_array($name, $def)) {
538 print '<td class="center">'."\n";
539 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
540 print img_picto($langs->trans("Enabled"), 'switch_on');
541 print '</a>';
542 print '</td>';
543 } else {
544 print '<td class="center">'."\n";
545 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>';
546 print "</td>";
547 }
548
549 // Default
550 print '<td class="center">';
551 $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
552 if (getDolGlobalString($constforvar) == $name) {
553 //print img_picto($langs->trans("Default"), 'on');
554 // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
555 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>';
556 } else {
557 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>';
558 }
559 print '</td>';
560
561 // Info
562 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
563 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
564 if ($module->type == 'pdf') {
565 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
566 }
567 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
568
569 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
570 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
571 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
572
573 print '<td class="center">';
574 print $form->textwithpicto('', $htmltooltip, 1, 0);
575 print '</td>';
576
577 // Preview
578 print '<td class="center">';
579 if ($module->type == 'pdf') {
580 $newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
581 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($newname).'&object='.urlencode($myTmpObjectKey).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
582 } else {
583 print img_object($langs->trans("PreviewNotAvailable"), 'generic');
584 }
585 print '</td>';
586
587 print "</tr>\n";
588 }
589 }
590 }
591 }
592 }
593 }
594 }
595 }
596
597 print '</table>';
598 }
599}
600
601if (empty($setupnotempty)) {
602 print '<br>'.$langs->trans("NothingToSetup");
603}
604
605// Page end
606print dol_get_fiche_end();
607
608llxFooter();
609$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)
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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'.
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.