setup.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
  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/asset/admin/setup.php
  20. * \ingroup assets
  21. * \brief Assets setup page.
  22. */
  23. require '../../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
  25. require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
  26. global $langs, $user;
  27. // Load translation files required by the page
  28. $langs->loadLangs(array("admin", "assets"));
  29. // Access control
  30. if (!$user->admin) {
  31. accessforbidden();
  32. }
  33. // Parameters
  34. $action = GETPOST('action', 'aZ09');
  35. $backtopage = GETPOST('backtopage', 'alpha');
  36. $arrayofparameters = array('FIXEDASSETS_MYPARAM1'=>array('css'=>'minwidth200'), 'FIXEDASSETS_MYPARAM2'=>array('css'=>'minwidth500'));
  37. /*
  38. * Actions
  39. */
  40. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  41. /*
  42. * View
  43. */
  44. llxHeader('', $langs->trans("AssetsSetup"));
  45. $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  46. print load_fiche_titre($langs->trans("AssetsSetup"), $linkback, 'title_setup');
  47. $head = asset_admin_prepare_head();
  48. print dol_get_fiche_head($head, 'settings', $langs->trans("Assets"), -1, 'generic');
  49. if ($action == 'edit') {
  50. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  51. print '<input type="hidden" name="token" value="'.newToken().'">';
  52. print '<input type="hidden" name="action" value="update">';
  53. print '<table class="noborder centpercent">';
  54. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
  55. foreach ($arrayofparameters as $key => $val) {
  56. print '<tr class="oddeven"><td>';
  57. print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
  58. print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
  59. }
  60. print '</table>';
  61. print '<br><div class="center">';
  62. print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
  63. print '</div>';
  64. print '</form>';
  65. print '<br>';
  66. } else {
  67. print '<table class="noborder centpercent">';
  68. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
  69. foreach ($arrayofparameters as $key => $val) {
  70. print '<tr class="oddeven"><td>';
  71. print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
  72. print '</td><td>'.$conf->global->$key.'</td></tr>';
  73. }
  74. print '</table>';
  75. print '<div class="tabsAction">';
  76. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
  77. print '</div>';
  78. }
  79. print dol_get_fiche_end();
  80. // End of page
  81. llxFooter();
  82. $db->close();