ecm.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  3. * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
  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. * \file htdocs/admin/ecm.php
  20. * \ingroup core
  21. * \brief Page to setup ECM (GED) module
  22. */
  23. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. // Load translation files required by the page
  27. $langs->load("admin");
  28. if (!$user->admin) {
  29. accessforbidden();
  30. }
  31. /*
  32. * Action
  33. */
  34. if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
  35. $code = $reg[1];
  36. if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
  37. header("Location: ".$_SERVER["PHP_SELF"]);
  38. exit;
  39. } else {
  40. dol_print_error($db);
  41. }
  42. }
  43. if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
  44. $code = $reg[1];
  45. if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
  46. header("Location: ".$_SERVER["PHP_SELF"]);
  47. exit;
  48. } else {
  49. dol_print_error($db);
  50. }
  51. }
  52. /*
  53. * View
  54. */
  55. $help_url = '';
  56. llxHeader('', $langs->trans("ECMSetup"), $help_url);
  57. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  58. print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup');
  59. print '<br>';
  60. $head = ecm_admin_prepare_head();
  61. print dol_get_fiche_head($head, 'ecm', '', -1, '');
  62. print '<table class="noborder centpercent">';
  63. print '<tr class="liste_titre">';
  64. print '<td>'.$langs->trans("Description").'</td>';
  65. print '<td class="center" width="20">&nbsp;</td>';
  66. print '<td class="center" width="100">'.$langs->trans("Value").'</td>'."\n";
  67. print '</tr>';
  68. $form = new Form($db);
  69. // Mail required for members
  70. print '<tr class="oddeven">';
  71. print '<td>'.$langs->trans("ECMAutoTree").'</td>';
  72. print '<td class="center" width="20">&nbsp;</td>';
  73. print '<td class="center" width="100">';
  74. if ($conf->use_javascript_ajax) {
  75. print ajax_constantonoff('ECM_AUTO_TREE_ENABLED');
  76. } else {
  77. if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
  78. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  79. } elseif (!empty($conf->global->USER_MAIL_REQUIRED)) {
  80. print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
  81. }
  82. }
  83. print '</td></tr>';
  84. print '</table>';
  85. // End of page
  86. llxFooter();
  87. $db->close();