ecm.php 3.0 KB

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