dolibarr  16.0.5
index.php
Go to the documentation of this file.
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 
25 require '../main.inc.php';
26 
27 // Load translation files required by the page
28 $langs->loadLangs(array('admin', 'companies'));
29 
30 if (!$user->admin) {
32 }
33 
34 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
35 $hookmanager->initHooks(array('homesetup'));
36 
37 
38 /*
39  * View
40  */
41 
42 $form = new Form($db);
43 
44 $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
45 llxHeader('', $langs->trans("Setup"), $wikihelp);
46 
47 
48 print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
49 
50 
51 if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
52  $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
53  if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
54  $i = 0;
55  $reg = array();
56  while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) {
57  $tmp = explode('|', $reg[1]);
58  if (!empty($tmp[1])) {
59  $langs->load($tmp[1]);
60  }
61  $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE);
62  $i++;
63  }
64 
65  print "\n<!-- Start of welcome text for setup page -->\n";
66  print '<table width="100%" class="notopnoleftnoright"><tr><td>';
67  print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
68  print '</td></tr></table><br>';
69  print "\n<!-- End of welcome text for setup page -->\n";
70  }
71 }
72 
73 print '<span class="opacitymedium hideonsmartphone">';
74 print $langs->trans("SetupDescription1").' ';
75 print $langs->trans("AreaForAdminOnly").' ';
76 print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
77 print "<br><br>";
78 print '</span>';
79 
80 print '<br>';
81 
82 // Show info setup company
83 if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
84  $setupcompanynotcomplete = 1;
85 }
86 
87 print '<section class="setupsection">';
88 
89 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"));
90 print '<br><br>';
91 print $langs->trans("SetupDescription3b");
92 if (!empty($setupcompanynotcomplete)) {
93  $langs->load("errors");
94  $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
95  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>';
96 }
97 
98 print '</section>';
99 
100 print '<br>';
101 print '<br>';
102 
103 print '<section class="setupsection">';
104 
105 // Show info setup module
106 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"));
107 print '<br><br>'.$langs->trans("SetupDescription4b");
108 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
109  $langs->load("errors");
110  $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
111  print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
112 }
113 
114 print '</section>';
115 
116 print '<br>';
117 print '<br>';
118 print '<br>';
119 
120 // Add hook to add information
121 $parameters = array();
122 $reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
123 print $hookmanager->resPrint;
124 if (empty($reshook)) {
125  // Show into other
126  print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
127  print '<br class="hideonsmartphone">';
128 
129  // Show logo
130  print '<div class="center"><div class="logo_setup"></div></div>';
131 }
132 
133 // End of page
134 llxFooter();
135 $db->close();
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4521
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
llxFooter
llxFooter()
Footer empty.
Definition: index.php:71
$wikihelp
if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
Definition: agenda_xcal.php:72
llxHeader
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
Definition: index.php:63
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_htmlentitiesbr
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
Definition: functions.lib.php:6991
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933