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 19/** 20 * \file knowledgemanagement/admin/setup.php 21 * \ingroup knowledgemanagement 22 * \brief KnowledgeManagement setup page. 23 */ 24 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 41$value = GETPOST('value', 'alpha'); 42$label = GETPOST('label', 'alpha'); 43$scandir = GETPOST('scan_dir', 'alpha'); 44$type = 'knowledgemanagement'; 45 46$arrayofparameters = array( 47 'KNOWLEDGEMANAGEMENT_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>0), 48 //'KNOWLEDGEMANAGEMENT_MYPARAM2'=>array('type'=>'textarea','enabled'=>1), 49 //'KNOWLEDGEMANAGEMENT_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), 50 //'KNOWLEDGEMANAGEMENT_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1), 51 //'KNOWLEDGEMANAGEMENT_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1), 52 //'KNOWLEDGEMANAGEMENT_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1), 53); 54 55$error = 0; 56$setupnotempty = 0; 57 58// Access control 59if (!$user->admin) { 60 accessforbidden(); 61} 62 63 64/* 65 * Actions 66 */ 67 68if ((float) DOL_VERSION >= 6) { 69 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; 70} 71 72if ($action == 'updateMask') { 73 $maskconstorder = GETPOST('maskconstorder', 'alpha'); 74 $maskorder = GETPOST('maskorder', 'alpha'); 75 76 if ($maskconstorder) { 77 $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); 78 if (!($res > 0)) { 79 $error++; 80 } 81 } 82 83 if (!$error) { 84 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); 85 } else { 86 setEventMessages($langs->trans("Error"), null, 'errors'); 87 } 88} elseif ($action == 'specimen') { 89 $modele = GETPOST('module', 'alpha'); 90 $tmpobjectkey = GETPOST('object'); 91 92 $tmpobject = new $tmpobjectkey($db); 93 $tmpobject->initAsSpecimen(); 94 95 // Search template files 96 $file = ''; $classname = ''; $filefound = 0; 97 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); 98 foreach ($dirmodels as $reldir) { 99 $file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); 100 if (file_exists($file)) { 101 $filefound = 1; 102 $classname = "pdf_".$modele; 103 break; 104 } 105 } 106 107 if ($filefound) { 108 require_once $file; 109 110 $module = new $classname($db); 111 112 if ($module->write_file($tmpobject, $langs) > 0) { 113 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); 114 return; 115 } else { 116 setEventMessages($module->error, null, 'errors'); 117 dol_syslog($module->error, LOG_ERR); 118 } 119 } else { 120 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); 121 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); 122 } 123} elseif ($action == 'setmod') { 124 // TODO Check if numbering module chosen can be activated by calling method canBeActivated 125 $tmpobjectkey = GETPOST('object'); 126 if (!empty($tmpobjectkey)) { 127 $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey)."_ADDON"; 128 dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); 129 } 130} elseif ($action == 'set') { 131 // Activate a model 132 $ret = addDocumentModel($value, $type, $label, $scandir); 133} elseif ($action == 'del') { 134 $ret = delDocumentModel($value, $type); 135 if ($ret > 0) { 136 $tmpobjectkey = GETPOST('object'); 137 if (!empty($tmpobjectkey)) { 138 $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; 139 if ($conf->global->$constforval == "$value") { 140 dolibarr_del_const($db, $constforval, $conf->entity); 141 } 142 } 143 } 144} elseif ($action == 'setdoc') { 145 // Set or unset default model 146 $tmpobjectkey = GETPOST('object'); 147 if (!empty($tmpobjectkey)) { 148 $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; 149 if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) { 150 // The constant that was read before the new set 151 // We therefore requires a variable to have a coherent view 152 $conf->global->$constforval = $value; 153 } 154 155 // We disable/enable the document template (into llx_document_model table) 156 $ret = delDocumentModel($value, $type); 157 if ($ret > 0) { 158 $ret = addDocumentModel($value, $type, $label, $scandir); 159 } 160 } 161} elseif ($action == 'unsetdoc') { 162 $tmpobjectkey = GETPOST('object'); 163 if (!empty($tmpobjectkey)) { 164 $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; 165 dolibarr_del_const($db, $constforval, $conf->entity); 166 } 167} 168 169 170 171/* 172 * View 173 */ 174 175$form = new Form($db); 176 177$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); 178 179$page_name = "KnowledgeManagementSetup"; 180llxHeader('', $langs->trans($page_name)); 181 182// Subheader 183$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>'; 184 185print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); 186 187// Configuration header 188$head = knowledgemanagementAdminPrepareHead(); 189print dol_get_fiche_head($head, 'setup', $langs->trans('ModuleKnowledgeManagementName'), -1, "knowledgemanagement"); 190 191// Setup page goes here 192echo '<span class="opacitymedium">'.$langs->trans("KnowledgeManagementSetupPage").'</span><br><br>'; 193 194 195if ($action == 'edit') { 196 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; 197 print '<input type="hidden" name="token" value="'.newToken().'">'; 198 print '<input type="hidden" name="action" value="update">'; 199 200 print '<table class="noborder centpercent">'; 201 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; 202 203 foreach ($arrayofparameters as $constname => $val) { 204 if ($val['enabled']==1) { 205 $setupnotempty++; 206 print '<tr class="oddeven"><td>'; 207 $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); 208 print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>'; 209 print '</td><td>'; 210 211 if ($val['type'] == 'textarea') { 212 print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n"; 213 print $conf->global->{$constname}; 214 print "</textarea>\n"; 215 } elseif ($val['type']== 'html') { 216 require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; 217 $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); 218 $doleditor->Create(); 219 } elseif ($val['type'] == 'yesno') { 220 print $form->selectyesno($constname, $conf->global->{$constname}, 1); 221 } elseif (preg_match('/emailtemplate:/', $val['type'])) { 222 include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; 223 $formmail = new FormMail($db); 224 225 $tmp = explode(':', $val['type']); 226 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang 227 //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, ''); 228 $arrayofmessagename = array(); 229 if (is_array($formmail->lines_model)) { 230 foreach ($formmail->lines_model as $modelmail) { 231 //var_dump($modelmail); 232 $moreonlabel = ''; 233 if (!empty($arrayofmessagename[$modelmail->label])) { 234 $moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>'; 235 } 236 // The 'label' is the key that is unique if we exclude the language 237 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; 238 } 239 } 240 print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1); 241 } elseif (preg_match('/category:/', $val['type'])) { 242 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; 243 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; 244 $formother = new FormOther($db); 245 246 $tmp = explode(':', $val['type']); 247 print img_picto('', 'category', 'class="pictofixedwidth"'); 248 print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); 249 } elseif (preg_match('/thirdparty_type/', $val['type'])) { 250 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; 251 $formcompany = new FormCompany($db); 252 print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname); 253 } else { 254 print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">'; 255 } 256 print '</td></tr>'; 257 } 258 } 259 print '</table>'; 260 261 print '<br><div class="center">'; 262 print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">'; 263 print '</div>'; 264 265 print '</form>'; 266 print '<br>'; 267} else { 268 if (!empty($arrayofparameters)) { 269 print '<table class="noborder centpercent">'; 270 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; 271 272 foreach ($arrayofparameters as $constname => $val) { 273 if ($val['enabled']==1) { 274 $setupnotempty++; 275 print '<tr class="oddeven"><td>'; 276 $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); 277 print $form->textwithpicto($langs->trans($constname), $tooltiphelp); 278 print '</td><td>'; 279 280 if ($val['type'] == 'textarea') { 281 print dol_nl2br($conf->global->{$constname}); 282 } elseif ($val['type']== 'html') { 283 print $conf->global->{$constname}; 284 } elseif ($val['type'] == 'yesno') { 285 print ajax_constantonoff($constname); 286 } elseif (preg_match('/emailtemplate:/', $val['type'])) { 287 include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; 288 $formmail = new FormMail($db); 289 290 $tmp = explode(':', $val['type']); 291 292 $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); 293 if ($template<0) { 294 setEventMessages(null, $formmail->errors, 'errors'); 295 } 296 print $langs->trans($template->label); 297 } elseif (preg_match('/category:/', $val['type'])) { 298 $c = new Categorie($db); 299 $result = $c->fetch($conf->global->{$constname}); 300 if ($result < 0) { 301 setEventMessages(null, $c->errors, 'errors'); 302 } 303 $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text 304 $toprint = array(); 305 foreach ($ways as $way) { 306 $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>'; 307 } 308 print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; 309 } elseif (preg_match('/thirdparty_type/', $val['type'])) { 310 if ($conf->global->{$constname}==2) { 311 print $langs->trans("Prospect"); 312 } elseif ($conf->global->{$constname}==3) { 313 print $langs->trans("ProspectCustomer"); 314 } elseif ($conf->global->{$constname}==1) { 315 print $langs->trans("Customer"); 316 } elseif ($conf->global->{$constname}==0) { 317 print $langs->trans("NorProspectNorCustomer"); 318 } 319 } else { 320 print $conf->global->{$constname}; 321 } 322 print '</td></tr>'; 323 } 324 } 325 326 print '</table>'; 327 328 print '<div class="tabsAction">'; 329 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; 330 print '</div>'; 331 } else { 332 //print '<br>'.$langs->trans("NothingToSetup"); 333 } 334} 335 336 337$moduledir = 'knowledgemanagement'; 338$myTmpObjects = array(); 339$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); 340 341 342foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { 343 if ($myTmpObjectKey == 'MyObject') { 344 continue; 345 } 346 if ($myTmpObjectArray['includerefgeneration']) { 347 /* 348 * Orders Numbering model 349 */ 350 $setupnotempty++; 351 352 print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); 353 354 print '<table class="noborder centpercent">'; 355 print '<tr class="liste_titre">'; 356 print '<td>'.$langs->trans("Name").'</td>'; 357 print '<td>'.$langs->trans("Description").'</td>'; 358 print '<td class="nowrap">'.$langs->trans("Example").'</td>'; 359 print '<td class="center" width="60">'.$langs->trans("Status").'</td>'; 360 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>'; 361 print '</tr>'."\n"; 362 363 clearstatcache(); 364 365 foreach ($dirmodels as $reldir) { 366 $dir = dol_buildpath($reldir."core/modules/".$moduledir); 367 368 if (is_dir($dir)) { 369 $handle = opendir($dir); 370 if (is_resource($handle)) { 371 while (($file = readdir($handle)) !== false) { 372 if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { 373 $file = substr($file, 0, dol_strlen($file) - 4); 374 375 require_once $dir.'/'.$file.'.php'; 376 377 $module = new $file($db); 378 379 // Show modules according to features level 380 if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { 381 continue; 382 } 383 if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { 384 continue; 385 } 386 387 if ($module->isEnabled()) { 388 dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php'); 389 390 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n"; 391 print $module->info(); 392 print '</td>'; 393 394 // Show example of numbering model 395 print '<td class="nowrap">'; 396 $tmp = $module->getExample(); 397 if (preg_match('/^Error/', $tmp)) { 398 $langs->load("errors"); 399 print '<div class="error">'.$langs->trans($tmp).'</div>'; 400 } elseif ($tmp == 'NotConfigured') { 401 print $langs->trans($tmp); 402 } else { 403 print $tmp; 404 } 405 print '</td>'."\n"; 406 407 print '<td class="center">'; 408 $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON'; 409 if ($conf->global->$constforvar == $file) { 410 print img_picto($langs->trans("Activated"), 'switch_on'); 411 } else { 412 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">'; 413 print img_picto($langs->trans("Disabled"), 'switch_off'); 414 print '</a>'; 415 } 416 print '</td>'; 417 418 $mytmpinstance = new $myTmpObjectKey($db); 419 $mytmpinstance->initAsSpecimen(); 420 421 // Info 422 $htmltooltip = ''; 423 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; 424 425 $nextval = $module->getNextValue($mytmpinstance); 426 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval 427 $htmltooltip .= ''.$langs->trans("NextValue").': '; 428 if ($nextval) { 429 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { 430 $nextval = $langs->trans($nextval); 431 } 432 $htmltooltip .= $nextval.'<br>'; 433 } else { 434 $htmltooltip .= $langs->trans($module->error).'<br>'; 435 } 436 } 437 438 print '<td class="center">'; 439 print $form->textwithpicto('', $htmltooltip, 1, 0); 440 print '</td>'; 441 442 print "</tr>\n"; 443 } 444 } 445 } 446 closedir($handle); 447 } 448 } 449 } 450 print "</table><br>\n"; 451 } 452 453 if ($myTmpObjectArray['includedocgeneration']) { 454 /* 455 * Document templates generators 456 */ 457 $setupnotempty++; 458 $type = strtolower($myTmpObjectKey); 459 460 print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', ''); 461 462 // Load array def with activated templates 463 $def = array(); 464 $sql = "SELECT nom"; 465 $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; 466 $sql .= " WHERE type = '".$db->escape($type)."'"; 467 $sql .= " AND entity = ".$conf->entity; 468 $resql = $db->query($sql); 469 if ($resql) { 470 $i = 0; 471 $num_rows = $db->num_rows($resql); 472 while ($i < $num_rows) { 473 $array = $db->fetch_array($resql); 474 array_push($def, $array[0]); 475 $i++; 476 } 477 } else { 478 dol_print_error($db); 479 } 480 481 print "<table class=\"noborder\" width=\"100%\">\n"; 482 print "<tr class=\"liste_titre\">\n"; 483 print '<td>'.$langs->trans("Name").'</td>'; 484 print '<td>'.$langs->trans("Description").'</td>'; 485 print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n"; 486 print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n"; 487 print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>'; 488 print '<td class="center" width="38">'.$langs->trans("Preview").'</td>'; 489 print "</tr>\n"; 490 491 clearstatcache(); 492 493 foreach ($dirmodels as $reldir) { 494 foreach (array('', '/doc') as $valdir) { 495 $realpath = $reldir."core/modules/".$moduledir.$valdir; 496 $dir = dol_buildpath($realpath); 497 498 if (is_dir($dir)) { 499 $handle = opendir($dir); 500 if (is_resource($handle)) { 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 516 $modulequalified = 1; 517 if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { 518 $modulequalified = 0; 519 } 520 if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { 521 $modulequalified = 0; 522 } 523 524 if ($modulequalified) { 525 print '<tr class="oddeven"><td width="100">'; 526 print (empty($module->name) ? $name : $module->name); 527 print "</td><td>\n"; 528 if (method_exists($module, 'info')) { 529 print $module->info($langs); 530 } else { 531 print $module->description; 532 } 533 print '</td>'; 534 535 // Active 536 if (in_array($name, $def)) { 537 print '<td class="center">'."\n"; 538 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.$name.'">'; 539 print img_picto($langs->trans("Enabled"), 'switch_on'); 540 print '</a>'; 541 print '</td>'; 542 } else { 543 print '<td class="center">'."\n"; 544 print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; 545 print "</td>"; 546 } 547 548 // Default 549 print '<td class="center">'; 550 $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON'; 551 if ($conf->global->$constforvar == $name) { 552 //print img_picto($langs->trans("Default"), 'on'); 553 // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset 554 print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; 555 } else { 556 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; 557 } 558 print '</td>'; 559 560 // Info 561 $htmltooltip = ''.$langs->trans("Name").': '.$module->name; 562 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); 563 if ($module->type == 'pdf') { 564 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; 565 } 566 $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; 567 568 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; 569 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); 570 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); 571 572 print '<td class="center">'; 573 print $form->textwithpicto('', $htmltooltip, 1, 0); 574 print '</td>'; 575 576 // Preview 577 print '<td class="center">'; 578 if ($module->type == 'pdf') { 579 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>'; 580 } else { 581 print img_object($langs->trans("PreviewNotAvailable"), 'generic'); 582 } 583 print '</td>'; 584 585 print "</tr>\n"; 586 } 587 } 588 } 589 } 590 } 591 } 592 } 593 } 594 595 print '</table>'; 596 } 597} 598 599if (empty($setupnotempty)) { 600 print '<br>'.$langs->trans("NothingToSetup"); 601} 602 603// Page end 604print dol_get_fiche_end(); 605 606llxFooter(); 607$db->close(); 608