website_options.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 <http://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) accessforbidden();
  38. $status = 1;
  39. // Load variable for pagination
  40. $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
  41. $sortfield = GETPOST('sortfield','alpha');
  42. $sortorder = GETPOST('sortorder','alpha');
  43. $page = GETPOST('page','int');
  44. if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
  45. $offset = $limit * $page;
  46. $pageprev = $page - 1;
  47. $pagenext = $page + 1;
  48. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  49. $hookmanager->initHooks(array('admin'));
  50. $arrayofparameters=array('WEBSITE_USE_WEBSITE_ACCOUNTS'=>array('css'=>'minwidth200'));
  51. /*
  52. * Actions
  53. */
  54. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  55. /*
  56. * View
  57. */
  58. $form = new Form($db);
  59. $formadmin=new FormAdmin($db);
  60. llxHeader('', $langs->trans("WebsiteSetup"));
  61. $titre=$langs->trans("WebsiteSetup");
  62. $linkback='<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
  63. print load_fiche_titre($titre,$linkback,'title_setup');
  64. // Onglets
  65. $head=array();
  66. $h = 0;
  67. $head[$h][0] = DOL_URL_ROOT."/admin/website.php";
  68. $head[$h][1] = $langs->trans("WebSites");
  69. $head[$h][2] = 'website';
  70. $h++;
  71. $head[$h][0] = DOL_URL_ROOT."/admin/website_options.php";
  72. $head[$h][1] = $langs->trans("Options");
  73. $head[$h][2] = 'options';
  74. $h++;
  75. dol_fiche_head($head, 'options', '', -1);
  76. if ($action == 'edit')
  77. {
  78. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  79. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  80. print '<input type="hidden" name="action" value="update">';
  81. print '<table class="noborder" width="100%">';
  82. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
  83. foreach($arrayofparameters as $key => $val)
  84. {
  85. print '<tr class="oddeven"><td>';
  86. print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
  87. print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css'])?'minwidth200':$val['css']).'" value="' . $conf->global->$key . '"></td></tr>';
  88. }
  89. print '</table>';
  90. print '<br><div class="center">';
  91. print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
  92. print '</div>';
  93. print '</form>';
  94. print '<br>';
  95. }
  96. else
  97. {
  98. print '<table class="noborder" width="100%">';
  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. {
  102. print '<tr class="oddeven"><td>';
  103. print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip'));
  104. print '</td><td>' . $conf->global->$key . '</td></tr>';
  105. }
  106. print '</table>';
  107. print '<div class="tabsAction">';
  108. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
  109. print '</div>';
  110. }
  111. dol_fiche_end();
  112. // End of page
  113. llxFooter();
  114. $db->close();