index.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. require '../main.inc.php';
  24. // Load translation files required by the page
  25. $langs->loadLangs(array('admin', 'companies'));
  26. if (!$user->admin) {
  27. accessforbidden();
  28. }
  29. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  30. $hookmanager->initHooks(array('homesetup'));
  31. /*
  32. * View
  33. */
  34. $form = new Form($db);
  35. $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
  36. llxHeader('', $langs->trans("Setup"), $wikihelp);
  37. print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
  38. if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
  39. $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
  40. if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
  41. $i = 0;
  42. $reg = array();
  43. while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) {
  44. $tmp = explode('|', $reg[1]);
  45. if (!empty($tmp[1])) {
  46. $langs->load($tmp[1]);
  47. }
  48. $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE);
  49. $i++;
  50. }
  51. print "\n<!-- Start of welcome text for setup page -->\n";
  52. print '<table width="100%" class="notopnoleftnoright"><tr><td>';
  53. print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
  54. print '</td></tr></table><br>';
  55. print "\n<!-- End of welcome text for setup page -->\n";
  56. }
  57. }
  58. print '<span class="opacitymedium hideonsmartphone">';
  59. print $langs->trans("SetupDescription1").' ';
  60. print $langs->trans("AreaForAdminOnly").' ';
  61. print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
  62. print "<br><br>";
  63. print '</span>';
  64. print '<br>';
  65. // Show info setup company
  66. if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
  67. $setupcompanynotcomplete = 1;
  68. }
  69. print '<section class="setupsection">';
  70. 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"));
  71. print '<br><br>';
  72. print $langs->trans("SetupDescription3b");
  73. if (!empty($setupcompanynotcomplete)) {
  74. $langs->load("errors");
  75. $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
  76. 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>';
  77. }
  78. print '</section>';
  79. print '<br>';
  80. print '<br>';
  81. print '<section class="setupsection">';
  82. // Show info setup module
  83. 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"));
  84. print '<br><br>'.$langs->trans("SetupDescription4b");
  85. if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
  86. $langs->load("errors");
  87. $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
  88. print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
  89. }
  90. print '</section>';
  91. print '<br>';
  92. print '<br>';
  93. print '<br>';
  94. // Add hook to add information
  95. $parameters = array();
  96. $reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  97. print $hookmanager->resPrint;
  98. if (empty($reshook)) {
  99. // Show into other
  100. print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
  101. print '<br class="hideonsmartphone">';
  102. // Show logo
  103. print '<div class="center"><div class="logo_setup"></div></div>';
  104. }
  105. // End of page
  106. llxFooter();
  107. $db->close();