website_options.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/admin/website.php
  19. * \ingroup setup
  20. * \brief Page to administer web sites
  21. */
  22. require '../main.inc.php';
  23. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
  31. // Load translation files required by the page
  32. $langs->loadLangs(array('errors', 'admin', 'companies', 'website'));
  33. $action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view';
  34. $confirm = GETPOST('confirm', 'alpha');
  35. $backtopage = GETPOST('backtopage', 'alpha');
  36. $rowid = GETPOST('rowid', 'alpha');
  37. if (!$user->admin) {
  38. accessforbidden();
  39. }
  40. $status = 1;
  41. // Load variable for pagination
  42. $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
  43. $sortfield = GETPOST('sortfield', 'aZ09comma');
  44. $sortorder = GETPOST('sortorder', 'aZ09comma');
  45. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  46. if (empty($page) || $page == -1) {
  47. $page = 0;
  48. } // If $page is not defined, or '' or -1
  49. $offset = $limit * $page;
  50. $pageprev = $page - 1;
  51. $pagenext = $page + 1;
  52. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  53. $hookmanager->initHooks(array('admin'));
  54. $arrayofparameters = array('WEBSITE_USE_WEBSITE_ACCOUNTS'=>array('css'=>'minwidth200'));
  55. /*
  56. * Actions
  57. */
  58. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  59. /*
  60. * View
  61. */
  62. $form = new Form($db);
  63. $formadmin = new FormAdmin($db);
  64. llxHeader('', $langs->trans("WebsiteSetup"));
  65. $titre = $langs->trans("WebsiteSetup");
  66. $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
  67. print load_fiche_titre($titre, $linkback, 'title_setup');
  68. // Onglets
  69. $head = array();
  70. $h = 0;
  71. $head[$h][0] = DOL_URL_ROOT."/admin/website.php";
  72. $head[$h][1] = $langs->trans("WebSites");
  73. $head[$h][2] = 'website';
  74. $h++;
  75. $head[$h][0] = DOL_URL_ROOT."/admin/website_options.php";
  76. $head[$h][1] = $langs->trans("Options");
  77. $head[$h][2] = 'options';
  78. $h++;
  79. print dol_get_fiche_head($head, 'options', '', -1);
  80. if ($action == 'edit') {
  81. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  82. print '<input type="hidden" name="token" value="'.newToken().'">';
  83. print '<input type="hidden" name="action" value="update">';
  84. print '<table class="noborder centpercent">';
  85. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
  86. foreach ($arrayofparameters as $key => $val) {
  87. print '<tr class="oddeven"><td>';
  88. print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
  89. print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
  90. }
  91. print '</table>';
  92. print '<br><div class="center">';
  93. print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
  94. print '</div>';
  95. print '</form>';
  96. print '<br>';
  97. } else {
  98. print '<table class="noborder centpercent">';
  99. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
  100. foreach ($arrayofparameters as $key => $val) {
  101. print '<tr class="oddeven"><td>';
  102. print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
  103. print '</td><td>'.$conf->global->$key.'</td></tr>';
  104. }
  105. print '</table>';
  106. print '<div class="tabsAction">';
  107. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
  108. print '</div>';
  109. }
  110. print dol_get_fiche_end();
  111. // End of page
  112. llxFooter();
  113. $db->close();