ecm.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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/admin.lib.php';
  25. // Load translation files required by the page
  26. $langs->load("admin");
  27. if (!$user->admin) accessforbidden();
  28. /*
  29. * Action
  30. */
  31. if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
  32. {
  33. $code = $reg[1];
  34. if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
  35. {
  36. header("Location: ".$_SERVER["PHP_SELF"]);
  37. exit;
  38. }
  39. else
  40. {
  41. dol_print_error($db);
  42. }
  43. }
  44. if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
  45. {
  46. $code = $reg[1];
  47. if (dolibarr_del_const($db, $code, $conf->entity) > 0)
  48. {
  49. header("Location: ".$_SERVER["PHP_SELF"]);
  50. exit;
  51. }
  52. else
  53. {
  54. dol_print_error($db);
  55. }
  56. }
  57. /*
  58. * View
  59. */
  60. $help_url = '';
  61. llxHeader('', $langs->trans("ECMSetup"), $help_url);
  62. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
  63. print load_fiche_titre($langs->trans("ECMSetup"), $linkback, 'title_setup');
  64. print '<br>';
  65. print '<table class="noborder centpercent">';
  66. print '<tr class="liste_titre">';
  67. print '<td>'.$langs->trans("Description").'</td>';
  68. print '<td class="center" width="20">&nbsp;</td>';
  69. print '<td class="center" width="100">'.$langs->trans("Value").'</td>'."\n";
  70. print '</tr>';
  71. $form = new Form($db);
  72. // Mail required for members
  73. print '<tr class="oddeven">';
  74. print '<td>'.$langs->trans("ECMAutoTree").'</td>';
  75. print '<td class="center" width="20">&nbsp;</td>';
  76. print '<td class="center" width="100">';
  77. if ($conf->use_javascript_ajax)
  78. {
  79. print ajax_constantonoff('ECM_AUTO_TREE_ENABLED');
  80. }
  81. else
  82. {
  83. if (empty($conf->global->ECM_AUTO_TREE_ENABLED))
  84. {
  85. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  86. }
  87. elseif (!empty($conf->global->USER_MAIL_REQUIRED))
  88. {
  89. print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
  90. }
  91. }
  92. print '</td></tr>';
  93. print '</table>';
  94. // End of page
  95. llxFooter();
  96. $db->close();