dolibarr 19.0.4
knowledgemanagement.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2021 SuperAdmin
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
26require '../main.inc.php';
27
28global $langs, $user;
29
30// Libraries
31require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
32require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/lib/knowledgemanagement.lib.php";
33
34// Translations
35$langs->loadLangs(array("admin", "knowledgemanagement"));
36
37// Parameters
38$action = GETPOST('action', 'aZ09');
39$backtopage = GETPOST('backtopage', 'alpha');
40$value = GETPOST('value', 'alpha');
41$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
42
43$label = GETPOST('label', 'alpha');
44$scandir = GETPOST('scan_dir', 'alpha');
45$type = 'knowledgemanagement';
46
47$arrayofparameters = array(
48 'KNOWLEDGEMANAGEMENT_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>0),
49 //'KNOWLEDGEMANAGEMENT_MYPARAM2'=>array('type'=>'textarea','enabled'=>1),
50 //'KNOWLEDGEMANAGEMENT_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
51 //'KNOWLEDGEMANAGEMENT_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
52 //'KNOWLEDGEMANAGEMENT_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
53 //'KNOWLEDGEMANAGEMENT_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1),
54);
55
56$error = 0;
57$setupnotempty = 0;
58
59// Access control
60if (!$user->admin) {
62}
63
64
65/*
66 * Actions
67 */
68
69include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
70
71if ($action == 'updateMask') {
72 $maskconst = GETPOST('maskconst', 'aZ09');
73 $maskorder = GETPOST('maskorder', 'alpha');
74
75 if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
76 $res = dolibarr_set_const($db, $maskconst, $maskorder, 'chaine', 0, '', $conf->entity);
77 if (!($res > 0)) {
78 $error++;
79 }
80 }
81
82 if (!$error) {
83 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
84 } else {
85 setEventMessages($langs->trans("Error"), null, 'errors');
86 }
87} elseif ($action == 'specimen') {
88 $modele = GETPOST('module', 'alpha');
89 $tmpobjectkey = GETPOST('object');
90
91 $tmpobject = new $tmpobjectkey($db);
92 $tmpobject->initAsSpecimen();
93
94 // Search template files
95 $file = '';
96 $classname = '';
97 $filefound = 0;
98 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
99 foreach ($dirmodels as $reldir) {
100 $file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
101 if (file_exists($file)) {
102 $filefound = 1;
103 $classname = "pdf_".$modele;
104 break;
105 }
106 }
107
108 if ($filefound) {
109 require_once $file;
110
111 $module = new $classname($db);
112
113 if ($module->write_file($tmpobject, $langs) > 0) {
114 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
115 return;
116 } else {
117 setEventMessages($module->error, null, 'errors');
118 dol_syslog($module->error, LOG_ERR);
119 }
120 } else {
121 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
122 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
123 }
124} elseif ($action == 'setmod') {
125 // TODO Check if numbering module chosen can be activated by calling method canBeActivated
126 $tmpobjectkey = GETPOST('object');
127 if (!empty($tmpobjectkey)) {
128 $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey)."_ADDON";
129 dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
130 }
131} elseif ($action == 'set') {
132 // Activate a model
133 $ret = addDocumentModel($value, $type, $label, $scandir);
134} elseif ($action == 'del') {
135 $ret = delDocumentModel($value, $type);
136 if ($ret > 0) {
137 $tmpobjectkey = GETPOST('object');
138 if (!empty($tmpobjectkey)) {
139 $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
140 if (getDolGlobalString($constforval) == "$value") {
141 dolibarr_del_const($db, $constforval, $conf->entity);
142 }
143 }
144 }
145} elseif ($action == 'setdoc') {
146 // Set or unset default model
147 $tmpobjectkey = GETPOST('object');
148 if (!empty($tmpobjectkey)) {
149 $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
150 if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
151 // The constant that was read before the new set
152 // We therefore requires a variable to have a coherent view
153 $conf->global->$constforval = $value;
154 }
155
156 // We disable/enable the document template (into llx_document_model table)
157 $ret = delDocumentModel($value, $type);
158 if ($ret > 0) {
159 $ret = addDocumentModel($value, $type, $label, $scandir);
160 }
161 }
162} elseif ($action == 'unsetdoc') {
163 $tmpobjectkey = GETPOST('object');
164 if (!empty($tmpobjectkey)) {
165 $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
166 dolibarr_del_const($db, $constforval, $conf->entity);
167 }
168}
169
170
171
172/*
173 * View
174 */
175
176$form = new Form($db);
177
178$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
179
180$page_name = "KnowledgeManagementSetup";
181llxHeader('', $langs->trans($page_name));
182
183// Subheader
184$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
185
186print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
187
188// Configuration header
190print dol_get_fiche_head($head, 'setup', $langs->trans('ModuleKnowledgeManagementName'), -1, "knowledgemanagement");
191
192// Setup page goes here
193echo '<span class="opacitymedium">'.$langs->trans("KnowledgeManagementSetupPage").'</span><br><br>';
194
195
196if ($action == 'edit') {
197 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
198 print '<input type="hidden" name="token" value="'.newToken().'">';
199 print '<input type="hidden" name="action" value="update">';
200
201 print '<table class="noborder centpercent">';
202 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
203
204 foreach ($arrayofparameters as $constname => $val) {
205 if ($val['enabled']==1) {
206 $setupnotempty++;
207 print '<tr class="oddeven"><td>';
208 $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
209 print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
210 print '</td><td>';
211
212 if ($val['type'] == 'textarea') {
213 print '<textarea class="flat" name="' . $constname . '" id="' . $constname . '" cols="50" rows="5" wrap="soft">' . "\n";
214 print getDolGlobalString($constname);
215 print "</textarea>\n";
216 } elseif ($val['type'] == 'html') {
217 require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
218 $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
219 $doleditor->Create();
220 } elseif ($val['type'] == 'yesno') {
221 print $form->selectyesno($constname, getDolGlobalString($constname), 1);
222 } elseif (preg_match('/emailtemplate:/', $val['type'])) {
223 include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
224 $formmail = new FormMail($db);
225
226 $tmp = explode(':', $val['type']);
227 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
228 //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
229 $arrayofmessagename = array();
230 if (is_array($formmail->lines_model)) {
231 foreach ($formmail->lines_model as $modelmail) {
232 //var_dump($modelmail);
233 $moreonlabel = '';
234 if (!empty($arrayofmessagename[$modelmail->label])) {
235 $moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
236 }
237 // The 'label' is the key that is unique if we exclude the language
238 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\‍(|\‍)/', '', $modelmail->label)) . $moreonlabel;
239 }
240 }
241 print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
242 } elseif (preg_match('/category:/', $val['type'])) {
243 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
244 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
245 $formother = new FormOther($db);
246
247 $tmp = explode(':', $val['type']);
248 print img_picto('', 'category', 'class="pictofixedwidth"');
249 print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
250 } elseif (preg_match('/thirdparty_type/', $val['type'])) {
251 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
252 $formcompany = new FormCompany($db);
253 print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname);
254 } else {
255 print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($constname).'">';
256 }
257 print '</td></tr>';
258 }
259 }
260 print '</table>';
261
262 print $form->buttonsSaveCancel("Save", '');
263
264 print '</form>';
265 print '<br>';
266} else {
267 if (!empty($arrayofparameters)) {
268 print '<table class="noborder centpercent">';
269 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
270
271 foreach ($arrayofparameters as $constname => $val) {
272 if ($val['enabled']==1) {
273 $setupnotempty++;
274 print '<tr class="oddeven"><td>';
275 $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
276 print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
277 print '</td><td>';
278
279 if ($val['type'] == 'textarea') {
280 print dol_nl2br(getDolGlobalString($constname));
281 } elseif ($val['type']== 'html') {
282 print getDolGlobalString($constname);
283 } elseif ($val['type'] == 'yesno') {
284 print ajax_constantonoff($constname);
285 } elseif (preg_match('/emailtemplate:/', $val['type'])) {
286 include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
287 $formmail = new FormMail($db);
288
289 $tmp = explode(':', $val['type']);
290
291 $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
292 if ($template<0) {
293 setEventMessages(null, $formmail->errors, 'errors');
294 }
295 print $langs->trans($template->label);
296 } elseif (preg_match('/category:/', $val['type'])) {
297 $c = new Categorie($db);
298 $result = $c->fetch(getDolGlobalInt($constname));
299 if ($result < 0) {
300 setEventMessages(null, $c->errors, 'errors');
301 }
302 $ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
303 $toprint = array();
304 foreach ($ways as $way) {
305 $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
306 }
307 print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
308 } elseif (preg_match('/thirdparty_type/', $val['type'])) {
309 if (getDolGlobalString($constname)==2) {
310 print $langs->trans("Prospect");
311 } elseif (getDolGlobalString($constname)==3) {
312 print $langs->trans("ProspectCustomer");
313 } elseif (getDolGlobalInt($constname)==1) {
314 print $langs->trans("Customer");
315 } elseif (getDolGlobalInt($constname)==0) {
316 print $langs->trans("NorProspectNorCustomer");
317 }
318 } else {
319 print getDolGlobalString($constname);
320 }
321 print '</td></tr>';
322 }
323 }
324
325 print '</table>';
326
327 print '<div class="tabsAction">';
328 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
329 print '</div>';
330 } else {
331 //print '<br>'.$langs->trans("NothingToSetup");
332 }
333}
334
335
336$moduledir = 'knowledgemanagement';
337$myTmpObjects = array();
338$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
339
340
341foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
342 if ($myTmpObjectKey == 'MyObject') {
343 continue;
344 }
345 if ($myTmpObjectArray['includerefgeneration']) {
346 /*
347 * Orders Numbering model
348 */
349 $setupnotempty++;
350
351 print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
352
353 print '<table class="noborder centpercent">';
354 print '<tr class="liste_titre">';
355 print '<td>'.$langs->trans("Name").'</td>';
356 print '<td>'.$langs->trans("Description").'</td>';
357 print '<td class="nowrap">'.$langs->trans("Example").'</td>';
358 print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
359 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
360 print '</tr>'."\n";
361
362 clearstatcache();
363
364 foreach ($dirmodels as $reldir) {
365 $dir = dol_buildpath($reldir."core/modules/".$moduledir);
366
367 if (is_dir($dir)) {
368 $handle = opendir($dir);
369 if (is_resource($handle)) {
370 while (($file = readdir($handle)) !== false) {
371 if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
372 $file = substr($file, 0, dol_strlen($file) - 4);
373
374 require_once $dir.'/'.$file.'.php';
375
376 $module = new $file($db);
377
378 // Show modules according to features level
379 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
380 continue;
381 }
382 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
383 continue;
384 }
385
386 if ($module->isEnabled()) {
387 dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
388
389 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
390 print $module->info($langs);
391 print '</td>';
392
393 // Show example of numbering model
394 print '<td class="nowrap">';
395 $tmp = $module->getExample();
396 if (preg_match('/^Error/', $tmp)) {
397 $langs->load("errors");
398 print '<div class="error">'.$langs->trans($tmp).'</div>';
399 } elseif ($tmp == 'NotConfigured') {
400 print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
401 } else {
402 print $tmp;
403 }
404 print '</td>'."\n";
405
406 print '<td class="center">';
407 $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
408 if (getDolGlobalString($constforvar) == $file) {
409 print img_picto($langs->trans("Activated"), 'switch_on');
410 } else {
411 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
412 print img_picto($langs->trans("Disabled"), 'switch_off');
413 print '</a>';
414 }
415 print '</td>';
416
417 $mytmpinstance = new $myTmpObjectKey($db);
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 ($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\" width=\"100%\">\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 while (($file = readdir($handle)) !== false) {
501 $filelist[] = $file;
502 }
503 closedir($handle);
504 arsort($filelist);
505
506 foreach ($filelist as $file) {
507 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
508 if (file_exists($dir.'/'.$file)) {
509 $name = substr($file, 4, dol_strlen($file) - 16);
510 $classname = substr($file, 0, dol_strlen($file) - 12);
511
512 require_once $dir.'/'.$file;
513 $module = new $classname($db);
514
515 $modulequalified = 1;
516 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
517 $modulequalified = 0;
518 }
519 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
520 $modulequalified = 0;
521 }
522
523 if ($modulequalified) {
524 print '<tr class="oddeven"><td width="100">';
525 print(empty($module->name) ? $name : $module->name);
526 print "</td><td>\n";
527 if (method_exists($module, 'info')) {
528 print $module->info($langs);
529 } else {
530 print $module->description;
531 }
532 print '</td>';
533
534 // Active
535 if (in_array($name, $def)) {
536 print '<td class="center">'."\n";
537 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
538 print img_picto($langs->trans("Enabled"), 'switch_on');
539 print '</a>';
540 print '</td>';
541 } else {
542 print '<td class="center">'."\n";
543 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>';
544 print "</td>";
545 }
546
547 // Default
548 print '<td class="center">';
549 $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
550 if (getDolGlobalString($constforvar) == $name) {
551 //print img_picto($langs->trans("Default"), 'on');
552 // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
553 print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
554 } else {
555 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.urlencode($module->scandir).'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
556 }
557 print '</td>';
558
559 // Info
560 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
561 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
562 if ($module->type == 'pdf') {
563 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
564 }
565 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
566
567 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
568 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
569 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
570
571 print '<td class="center">';
572 print $form->textwithpicto('', $htmltooltip, 1, 0);
573 print '</td>';
574
575 // Preview
576 print '<td class="center">';
577 if ($module->type == 'pdf') {
578 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
579 } else {
580 print img_object($langs->trans("PreviewNotAvailable"), 'generic');
581 }
582 print '</td>';
583
584 print "</tr>\n";
585 }
586 }
587 }
588 }
589 }
590 }
591 }
592 }
593
594 print '</table>';
595 }
596}
597
598if (empty($setupnotempty)) {
599 print '<br>'.$langs->trans("NothingToSetup");
600}
601
602// Page end
603print dol_get_fiche_end();
604
605llxFooter();
606$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.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
Classe permettant la generation de composants html autre Only common components are here.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
knowledgemanagementAdminPrepareHead()
Prepare admin pages header.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:124
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.