index.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/admin/index.php
  21. * \brief Home page of setup area
  22. */
  23. // Load Dolibarr environment
  24. require '../main.inc.php';
  25. // Load translation files required by the page
  26. $langs->loadLangs(array('admin', 'companies'));
  27. $action = '';
  28. if (!$user->admin) {
  29. accessforbidden();
  30. }
  31. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  32. $hookmanager->initHooks(array('homesetup'));
  33. /*
  34. * View
  35. */
  36. $form = new Form($db);
  37. $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
  38. llxHeader('', $langs->trans("Setup"), $wikihelp);
  39. print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
  40. if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
  41. $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
  42. if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
  43. $i = 0;
  44. $reg = array();
  45. while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) {
  46. $tmp = explode('|', $reg[1]);
  47. if (!empty($tmp[1])) {
  48. $langs->load($tmp[1]);
  49. }
  50. $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE);
  51. $i++;
  52. }
  53. print "\n<!-- Start of welcome text for setup page -->\n";
  54. print '<table width="100%" class="notopnoleftnoright"><tr><td>';
  55. print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
  56. print '</td></tr></table><br>';
  57. print "\n<!-- End of welcome text for setup page -->\n";
  58. }
  59. }
  60. print '<span class="opacitymedium hideonsmartphone">';
  61. print $langs->trans("SetupDescription1").' ';
  62. print $langs->trans("AreaForAdminOnly").' ';
  63. print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
  64. print "<br><br>";
  65. print '</span>';
  66. print '<br>';
  67. // Show info setup company
  68. if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') || getDolGlobalString('MAIN_INFO_SOCIETE_SETUP_TODO_WARNING')) {
  69. $setupcompanynotcomplete = 1;
  70. }
  71. print '<section class="setupsection">';
  72. print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
  73. print '<br><br>';
  74. print $langs->trans("SetupDescription3b");
  75. if (!empty($setupcompanynotcomplete)) {
  76. $langs->load("errors");
  77. $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
  78. print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit').'">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
  79. }
  80. print '</section>';
  81. print '<br>';
  82. print '<br>';
  83. print '<section class="setupsection">';
  84. $nbmodulesnotautoenabled = count($conf->modules);
  85. if (in_array('fckeditor', $conf->modules)) {
  86. $nbmodulesnotautoenabled--;
  87. }
  88. if (in_array('export', $conf->modules)) {
  89. $nbmodulesnotautoenabled--;
  90. }
  91. if (in_array('import', $conf->modules)) {
  92. $nbmodulesnotautoenabled--;
  93. }
  94. // Show info setup module
  95. print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
  96. print '<br><br>'.$langs->trans("SetupDescription4b");
  97. if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
  98. $langs->load("errors");
  99. $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
  100. print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
  101. }
  102. print '</section>';
  103. print '<br>';
  104. print '<br>';
  105. print '<br>';
  106. // Add hook to add information
  107. $parameters = array();
  108. $object = new stdClass();
  109. $reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  110. print $hookmanager->resPrint;
  111. if (empty($reshook)) {
  112. // Show into other
  113. //print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
  114. print '<br class="hideonsmartphone">';
  115. // Show logo
  116. print '<div class="center"><div class="logo_setup"></div></div>';
  117. }
  118. // End of page
  119. llxFooter();
  120. $db->close();