index.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 <http://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. $wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
  33. llxHeader('',$langs->trans("Setup"),$wikihelp);
  34. $form = new Form($db);
  35. print load_fiche_titre($langs->trans("SetupArea"),'','title_setup.png');
  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 $langs->trans("SetupDescription1").' ';
  57. print $langs->trans("AreaForAdminOnly").' ';
  58. print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."<br><br>";
  59. print '<br>';
  60. // Show info setup company
  61. if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
  62. 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"));
  63. if (! empty($setupcompanynotcomplete))
  64. {
  65. $langs->load("errors");
  66. $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
  67. 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>';
  68. }
  69. print '<br>';
  70. print '<br>';
  71. print '<br>';
  72. // Show info setup module
  73. print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
  74. /*
  75. $nbofactivatedmodules=count($conf->modules);
  76. $moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules));
  77. if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
  78. print '<br>'.$moreinfo;
  79. */
  80. 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
  81. {
  82. $langs->load("errors");
  83. $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
  84. print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
  85. }
  86. print '<br>';
  87. print '<br>';
  88. print '<br>';
  89. print '<br>';
  90. // Add hook to add information
  91. $parameters=array();
  92. $reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
  93. print $hookmanager->resPrint;
  94. if (empty($reshook))
  95. {
  96. // Show into other
  97. print $langs->trans("SetupDescription5")."<br>";
  98. print "<br>";
  99. // Show logo
  100. print '<div class="center"><div class="logo_setup"></div></div>';
  101. }
  102. // End of page
  103. llxFooter();
  104. $db->close();