dolibarr  20.0.0-beta
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 // Load Dolibarr environment
26 require '../main.inc.php';
27 
28 // Load translation files required by the page
29 $langs->loadLangs(array('admin', 'companies'));
30 
31 $action = '';
32 
33 if (!$user->admin) {
35 }
36 
37 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
38 $hookmanager->initHooks(array('homesetup'));
39 
40 
41 /*
42  * View
43  */
44 
45 $form = new Form($db);
46 
47 $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
48 llxHeader('', $langs->trans("Setup"), $wikihelp);
49 
50 
51 print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
52 
53 
54 if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
55  $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
56  if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
57  $i = 0;
58  $reg = array();
59  while (preg_match('/__\‍(([a-zA-Z|@]+)\‍)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) {
60  $tmp = explode('|', $reg[1]);
61  if (!empty($tmp[1])) {
62  $langs->load($tmp[1]);
63  }
64  $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\‍('.preg_quote($reg[1]).'\‍)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE);
65  $i++;
66  }
67 
68  print "\n<!-- Start of welcome text for setup page -->\n";
69  print '<table width="100%" class="notopnoleftnoright"><tr><td>';
70  print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
71  print '</td></tr></table><br>';
72  print "\n<!-- End of welcome text for setup page -->\n";
73  }
74 }
75 
76 print '<span class="opacitymedium hideonsmartphone">';
77 print $langs->trans("SetupDescription1").' ';
78 print $langs->trans("AreaForAdminOnly").' ';
79 print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
80 print "<br><br>";
81 print '</span>';
82 
83 print '<br>';
84 
85 // Show info setup company
86 if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') || getDolGlobalString('MAIN_INFO_SOCIETE_SETUP_TODO_WARNING')) {
87  $setupcompanynotcomplete = 1;
88 }
89 
90 print '<section class="setupsection">';
91 
92 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"));
93 print '<br><br>';
94 print $langs->trans("SetupDescription3b");
95 if (!empty($setupcompanynotcomplete)) {
96  $langs->load("errors");
97  $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
98  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>';
99 }
100 
101 print '</section>';
102 
103 print '<br>';
104 print '<br>';
105 
106 print '<section class="setupsection">';
107 
108 $nbmodulesnotautoenabled = count($conf->modules);
109 if (in_array('fckeditor', $conf->modules)) {
110  $nbmodulesnotautoenabled--;
111 }
112 if (in_array('export', $conf->modules)) {
113  $nbmodulesnotautoenabled--;
114 }
115 if (in_array('import', $conf->modules)) {
116  $nbmodulesnotautoenabled--;
117 }
118 
119 // Show info setup module
120 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"));
121 print '<br><br>'.$langs->trans("SetupDescription4b");
122 if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
123  $langs->load("errors");
124  $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
125  print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
126 }
127 
128 print '</section>';
129 
130 print '<br>';
131 print '<br>';
132 print '<br>';
133 
134 // Add hook to add information
135 $parameters = array();
136 $object = new stdClass();
137 $reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
138 print $hookmanager->resPrint;
139 if (empty($reshook)) {
140  // Show into other
141  //print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
142  print '<br class="hideonsmartphone">';
143 
144  // Show logo
145  print '<div class="center"><div class="logo_setup"></div></div>';
146 }
147 
148 // End of page
149 llxFooter();
150 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
if(GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) if(GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
Definition: agenda_xcal.php:90
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
llxFooter()
Footer empty.
Definition: index.php:72
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:64
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.