dolibarr  19.0.0-dev
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
26 require '../main.inc.php';
27 
28 global $langs, $user;
29 
30 // Libraries
31 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
32 require_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
60 if (!$user->admin) {
62 }
63 
64 
65 /*
66  * Actions
67  */
68 
69 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
70 
71 if ($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 = ''; $classname = ''; $filefound = 0;
96  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
97  foreach ($dirmodels as $reldir) {
98  $file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
99  if (file_exists($file)) {
100  $filefound = 1;
101  $classname = "pdf_".$modele;
102  break;
103  }
104  }
105 
106  if ($filefound) {
107  require_once $file;
108 
109  $module = new $classname($db);
110 
111  if ($module->write_file($tmpobject, $langs) > 0) {
112  header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
113  return;
114  } else {
115  setEventMessages($module->error, null, 'errors');
116  dol_syslog($module->error, LOG_ERR);
117  }
118  } else {
119  setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
120  dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
121  }
122 } elseif ($action == 'setmod') {
123  // TODO Check if numbering module chosen can be activated by calling method canBeActivated
124  $tmpobjectkey = GETPOST('object');
125  if (!empty($tmpobjectkey)) {
126  $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey)."_ADDON";
127  dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
128  }
129 } elseif ($action == 'set') {
130  // Activate a model
131  $ret = addDocumentModel($value, $type, $label, $scandir);
132 } elseif ($action == 'del') {
133  $ret = delDocumentModel($value, $type);
134  if ($ret > 0) {
135  $tmpobjectkey = GETPOST('object');
136  if (!empty($tmpobjectkey)) {
137  $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
138  if ($conf->global->$constforval == "$value") {
139  dolibarr_del_const($db, $constforval, $conf->entity);
140  }
141  }
142  }
143 } elseif ($action == 'setdoc') {
144  // Set or unset default model
145  $tmpobjectkey = GETPOST('object');
146  if (!empty($tmpobjectkey)) {
147  $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
148  if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
149  // The constant that was read before the new set
150  // We therefore requires a variable to have a coherent view
151  $conf->global->$constforval = $value;
152  }
153 
154  // We disable/enable the document template (into llx_document_model table)
155  $ret = delDocumentModel($value, $type);
156  if ($ret > 0) {
157  $ret = addDocumentModel($value, $type, $label, $scandir);
158  }
159  }
160 } elseif ($action == 'unsetdoc') {
161  $tmpobjectkey = GETPOST('object');
162  if (!empty($tmpobjectkey)) {
163  $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
164  dolibarr_del_const($db, $constforval, $conf->entity);
165  }
166 }
167 
168 
169 
170 /*
171  * View
172  */
173 
174 $form = new Form($db);
175 
176 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
177 
178 $page_name = "KnowledgeManagementSetup";
179 llxHeader('', $langs->trans($page_name));
180 
181 // Subheader
182 $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
183 
184 print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
185 
186 // Configuration header
188 print dol_get_fiche_head($head, 'setup', $langs->trans('ModuleKnowledgeManagementName'), -1, "knowledgemanagement");
189 
190 // Setup page goes here
191 echo '<span class="opacitymedium">'.$langs->trans("KnowledgeManagementSetupPage").'</span><br><br>';
192 
193 
194 if ($action == 'edit') {
195  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
196  print '<input type="hidden" name="token" value="'.newToken().'">';
197  print '<input type="hidden" name="action" value="update">';
198 
199  print '<table class="noborder centpercent">';
200  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
201 
202  foreach ($arrayofparameters as $constname => $val) {
203  if ($val['enabled']==1) {
204  $setupnotempty++;
205  print '<tr class="oddeven"><td>';
206  $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
207  print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
208  print '</td><td>';
209 
210  if ($val['type'] == 'textarea') {
211  print '<textarea class="flat" name="' . $constname . '" id="' . $constname . '" cols="50" rows="5" wrap="soft">' . "\n";
212  print getDolGlobalString($constname);
213  print "</textarea>\n";
214  } elseif ($val['type'] == 'html') {
215  require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
216  $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
217  $doleditor->Create();
218  } elseif ($val['type'] == 'yesno') {
219  print $form->selectyesno($constname, getDolGlobalString($constname), 1);
220  } elseif (preg_match('/emailtemplate:/', $val['type'])) {
221  include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
222  $formmail = new FormMail($db);
223 
224  $tmp = explode(':', $val['type']);
225  $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
226  //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
227  $arrayofmessagename = array();
228  if (is_array($formmail->lines_model)) {
229  foreach ($formmail->lines_model as $modelmail) {
230  //var_dump($modelmail);
231  $moreonlabel = '';
232  if (!empty($arrayofmessagename[$modelmail->label])) {
233  $moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
234  }
235  // The 'label' is the key that is unique if we exclude the language
236  $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\‍(|\‍)/', '', $modelmail->label)) . $moreonlabel;
237  }
238  }
239  print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
240  } elseif (preg_match('/category:/', $val['type'])) {
241  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
242  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
243  $formother = new FormOther($db);
244 
245  $tmp = explode(':', $val['type']);
246  print img_picto('', 'category', 'class="pictofixedwidth"');
247  print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
248  } elseif (preg_match('/thirdparty_type/', $val['type'])) {
249  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
250  $formcompany = new FormCompany($db);
251  print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname);
252  } else {
253  print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.getDolGlobalString($constname).'">';
254  }
255  print '</td></tr>';
256  }
257  }
258  print '</table>';
259 
260  print $form->buttonsSaveCancel("Save", '');
261 
262  print '</form>';
263  print '<br>';
264 } else {
265  if (!empty($arrayofparameters)) {
266  print '<table class="noborder centpercent">';
267  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
268 
269  foreach ($arrayofparameters as $constname => $val) {
270  if ($val['enabled']==1) {
271  $setupnotempty++;
272  print '<tr class="oddeven"><td>';
273  $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
274  print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
275  print '</td><td>';
276 
277  if ($val['type'] == 'textarea') {
278  print dol_nl2br(getDolGlobalString($constname));
279  } elseif ($val['type']== 'html') {
280  print getDolGlobalString($constname);
281  } elseif ($val['type'] == 'yesno') {
282  print ajax_constantonoff($constname);
283  } elseif (preg_match('/emailtemplate:/', $val['type'])) {
284  include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
285  $formmail = new FormMail($db);
286 
287  $tmp = explode(':', $val['type']);
288 
289  $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
290  if ($template<0) {
291  setEventMessages(null, $formmail->errors, 'errors');
292  }
293  print $langs->trans($template->label);
294  } elseif (preg_match('/category:/', $val['type'])) {
295  $c = new Categorie($db);
296  $result = $c->fetch(getDolGlobalInt($constname));
297  if ($result < 0) {
298  setEventMessages(null, $c->errors, 'errors');
299  }
300  $ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
301  $toprint = array();
302  foreach ($ways as $way) {
303  $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
304  }
305  print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
306  } elseif (preg_match('/thirdparty_type/', $val['type'])) {
307  if (getDolGlobalString($constname)==2) {
308  print $langs->trans("Prospect");
309  } elseif (getDolGlobalString($constname)==3) {
310  print $langs->trans("ProspectCustomer");
311  } elseif (getDolGlobalInt($constname)==1) {
312  print $langs->trans("Customer");
313  } elseif (getDolGlobalInt($constname)==0) {
314  print $langs->trans("NorProspectNorCustomer");
315  }
316  } else {
317  print getDolGlobalString($constname);
318  }
319  print '</td></tr>';
320  }
321  }
322 
323  print '</table>';
324 
325  print '<div class="tabsAction">';
326  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
327  print '</div>';
328  } else {
329  //print '<br>'.$langs->trans("NothingToSetup");
330  }
331 }
332 
333 
334 $moduledir = 'knowledgemanagement';
335 $myTmpObjects = array();
336 $myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
337 
338 
339 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
340  if ($myTmpObjectKey == 'MyObject') {
341  continue;
342  }
343  if ($myTmpObjectArray['includerefgeneration']) {
344  /*
345  * Orders Numbering model
346  */
347  $setupnotempty++;
348 
349  print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
350 
351  print '<table class="noborder centpercent">';
352  print '<tr class="liste_titre">';
353  print '<td>'.$langs->trans("Name").'</td>';
354  print '<td>'.$langs->trans("Description").'</td>';
355  print '<td class="nowrap">'.$langs->trans("Example").'</td>';
356  print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
357  print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
358  print '</tr>'."\n";
359 
360  clearstatcache();
361 
362  foreach ($dirmodels as $reldir) {
363  $dir = dol_buildpath($reldir."core/modules/".$moduledir);
364 
365  if (is_dir($dir)) {
366  $handle = opendir($dir);
367  if (is_resource($handle)) {
368  while (($file = readdir($handle)) !== false) {
369  if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
370  $file = substr($file, 0, dol_strlen($file) - 4);
371 
372  require_once $dir.'/'.$file.'.php';
373 
374  $module = new $file($db);
375 
376  // Show modules according to features level
377  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
378  continue;
379  }
380  if ($module->version == 'experimental' && $conf->global->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->name."</td><td>\n";
388  print $module->info();
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 '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
399  } else {
400  print $tmp;
401  }
402  print '</td>'."\n";
403 
404  print '<td class="center">';
405  $constforvar = 'KNOWLEDGEMANAGEMENT_'.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  $mytmpinstance = new $myTmpObjectKey($db);
416  $mytmpinstance->initAsSpecimen();
417 
418  // Info
419  $htmltooltip = '';
420  $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
421 
422  $nextval = $module->getNextValue($mytmpinstance);
423  if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
424  $htmltooltip .= ''.$langs->trans("NextValue").': ';
425  if ($nextval) {
426  if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
427  $nextval = $langs->trans($nextval);
428  }
429  $htmltooltip .= $nextval.'<br>';
430  } else {
431  $htmltooltip .= $langs->trans($module->error).'<br>';
432  }
433  }
434 
435  print '<td class="center">';
436  print $form->textwithpicto('', $htmltooltip, 1, 0);
437  print '</td>';
438 
439  print "</tr>\n";
440  }
441  }
442  }
443  closedir($handle);
444  }
445  }
446  }
447  print "</table><br>\n";
448  }
449 
450  if ($myTmpObjectArray['includedocgeneration']) {
451  /*
452  * Document templates generators
453  */
454  $setupnotempty++;
455  $type = strtolower($myTmpObjectKey);
456 
457  print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
458 
459  // Load array def with activated templates
460  $def = array();
461  $sql = "SELECT nom";
462  $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
463  $sql .= " WHERE type = '".$db->escape($type)."'";
464  $sql .= " AND entity = ".$conf->entity;
465  $resql = $db->query($sql);
466  if ($resql) {
467  $i = 0;
468  $num_rows = $db->num_rows($resql);
469  while ($i < $num_rows) {
470  $array = $db->fetch_array($resql);
471  array_push($def, $array[0]);
472  $i++;
473  }
474  } else {
475  dol_print_error($db);
476  }
477 
478  print "<table class=\"noborder\" width=\"100%\">\n";
479  print "<tr class=\"liste_titre\">\n";
480  print '<td>'.$langs->trans("Name").'</td>';
481  print '<td>'.$langs->trans("Description").'</td>';
482  print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
483  print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
484  print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
485  print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
486  print "</tr>\n";
487 
488  clearstatcache();
489 
490  foreach ($dirmodels as $reldir) {
491  foreach (array('', '/doc') as $valdir) {
492  $realpath = $reldir."core/modules/".$moduledir.$valdir;
493  $dir = dol_buildpath($realpath);
494 
495  if (is_dir($dir)) {
496  $handle = opendir($dir);
497  if (is_resource($handle)) {
498  while (($file = readdir($handle)) !== false) {
499  $filelist[] = $file;
500  }
501  closedir($handle);
502  arsort($filelist);
503 
504  foreach ($filelist as $file) {
505  if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
506  if (file_exists($dir.'/'.$file)) {
507  $name = substr($file, 4, dol_strlen($file) - 16);
508  $classname = substr($file, 0, dol_strlen($file) - 12);
509 
510  require_once $dir.'/'.$file;
511  $module = new $classname($db);
512 
513  $modulequalified = 1;
514  if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
515  $modulequalified = 0;
516  }
517  if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
518  $modulequalified = 0;
519  }
520 
521  if ($modulequalified) {
522  print '<tr class="oddeven"><td width="100">';
523  print (empty($module->name) ? $name : $module->name);
524  print "</td><td>\n";
525  if (method_exists($module, 'info')) {
526  print $module->info($langs);
527  } else {
528  print $module->description;
529  }
530  print '</td>';
531 
532  // Active
533  if (in_array($name, $def)) {
534  print '<td class="center">'."\n";
535  print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
536  print img_picto($langs->trans("Enabled"), 'switch_on');
537  print '</a>';
538  print '</td>';
539  } else {
540  print '<td class="center">'."\n";
541  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>';
542  print "</td>";
543  }
544 
545  // Default
546  print '<td class="center">';
547  $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
548  if (getDolGlobalString($constforvar) == $name) {
549  //print img_picto($langs->trans("Default"), 'on');
550  // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
551  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>';
552  } else {
553  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>';
554  }
555  print '</td>';
556 
557  // Info
558  $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
559  $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
560  if ($module->type == 'pdf') {
561  $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
562  }
563  $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
564 
565  $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
566  $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
567  $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
568 
569  print '<td class="center">';
570  print $form->textwithpicto('', $htmltooltip, 1, 0);
571  print '</td>';
572 
573  // Preview
574  print '<td class="center">';
575  if ($module->type == 'pdf') {
576  print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
577  } else {
578  print img_object($langs->trans("PreviewNotAvailable"), 'generic');
579  }
580  print '</td>';
581 
582  print "</tr>\n";
583  }
584  }
585  }
586  }
587  }
588  }
589  }
590  }
591 
592  print '</table>';
593  }
594 }
595 
596 if (empty($setupnotempty)) {
597  print '<br>'.$langs->trans("NothingToSetup");
598 }
599 
600 // Page end
601 print dol_get_fiche_end();
602 
603 llxFooter();
604 $db->close();
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
Definition: admin.lib.php:1918
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).
Definition: admin.lib.php:638
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:562
delDocumentModel($name, $type)
Delete document model used by doc generator.
Definition: admin.lib.php:1949
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='inline-block')
On/off button for constant.
Definition: ajax.lib.php:630
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
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.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
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.
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
getDolGlobalInt($key, $default=0)
Return 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)
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.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
knowledgemanagementAdminPrepareHead()
Prepare admin pages header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.