index.php 4.8 KB

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