website_options.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. // Load Dolibarr environment
  23. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  31. require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
  32. // Load translation files required by the page
  33. $langs->loadLangs(array('errors', 'admin', 'companies', 'website'));
  34. $action = GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view';
  35. $confirm = GETPOST('confirm', 'alpha');
  36. $backtopage = GETPOST('backtopage', 'alpha');
  37. // Load variable for pagination
  38. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  39. $sortfield = GETPOST('sortfield', 'aZ09comma');
  40. $sortorder = GETPOST('sortorder', 'aZ09comma');
  41. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  42. if (empty($page) || $page == -1) {
  43. $page = 0;
  44. } // 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. $status = 1;
  52. $rowid = GETPOST('rowid', 'alpha');
  53. if (!$user->admin || !isModEnabled('website')) {
  54. accessforbidden();
  55. }
  56. // Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
  57. /*
  58. $useFormSetup = 1;
  59. if (!class_exists('FormSetup')) {
  60. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
  61. }
  62. $formSetup = new FormSetup($db);
  63. $item = $formSetup->newItem('NO_PARAM_JUST_TEXT');
  64. */
  65. /*
  66. * Actions
  67. */
  68. include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
  69. /*
  70. * View
  71. */
  72. $form = new Form($db);
  73. $formadmin = new FormAdmin($db);
  74. llxHeader('', $langs->trans("WebsiteSetup"));
  75. $titre = $langs->trans("WebsiteSetup");
  76. $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
  77. print load_fiche_titre($titre, $linkback, 'title_setup');
  78. // Onglets
  79. $head = array();
  80. $h = 0;
  81. $head[$h][0] = DOL_URL_ROOT."/admin/website.php";
  82. $head[$h][1] = $langs->trans("WebSites");
  83. $head[$h][2] = 'website';
  84. $h++;
  85. $head[$h][0] = DOL_URL_ROOT."/admin/website_options.php";
  86. $head[$h][1] = $langs->trans("Options");
  87. $head[$h][2] = 'options';
  88. $h++;
  89. print dol_get_fiche_head($head, 'options', '', -1);
  90. print '<div class="div-table-responsive-no-min">';
  91. print '<table class="noborder centpercent">';
  92. print '<tr class="liste_titre">';
  93. print '<td>'.$langs->trans("Parameter").'</td>';
  94. print '<td align="center" width="20">&nbsp;</td>';
  95. print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
  96. print '</tr>';
  97. // Mail required for users
  98. print '<tr class="oddeven">';
  99. print '<td>';
  100. print $form->textwithpicto($langs->trans('WEBSITE_USE_WEBSITE_ACCOUNTS'), $langs->trans('WEBSITE_USE_WEBSITE_ACCOUNTSTooltip'));
  101. print '</td>';
  102. print '<td align="center" width="20">&nbsp;</td>';
  103. print '<td align="center" width="100">';
  104. if (!empty($conf->use_javascript_ajax)) {
  105. print ajax_constantonoff('WEBSITE_USE_WEBSITE_ACCOUNTS');
  106. } else {
  107. if (!getDolGlobalString('WEBSITE_USE_WEBSITE_ACCOUNTS')) {
  108. print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WEBSITE_USE_WEBSITE_ACCOUNTS&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
  109. } else {
  110. print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_WEBSITE_USE_WEBSITE_ACCOUNTS&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
  111. }
  112. }
  113. print '</td></tr>';
  114. print '</table>';
  115. if (empty($conf->use_javascript_ajax)) {
  116. print '<div class="tabsAction">';
  117. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
  118. print '</div>';
  119. }
  120. print dol_get_fiche_end();
  121. // End of page
  122. llxFooter();
  123. $db->close();