1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) 2019 Alxarafe <[email protected]> |
3
|
|
|
* |
4
|
|
|
* This program is free software; you can redistribute it and/or modify |
5
|
|
|
* it under the terms of the GNU General Public License as published by |
6
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
7
|
|
|
* (at your option) any later version. |
8
|
|
|
* |
9
|
|
|
* This program is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU General Public License for more details. |
13
|
|
|
* |
14
|
|
|
* You should have received a copy of the GNU General Public License |
15
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
16
|
|
|
*/ |
17
|
|
|
namespace Alixar\Base; |
18
|
|
|
|
19
|
|
|
use Alxarafe\Helpers\Debug; |
20
|
|
|
use Alixar\Helpers\Globals; |
21
|
|
|
use Alixar\Helpers\DolUtils; |
22
|
|
|
use Alixar\Helpers\AjaxLib; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* This class contains the methods and attributes common to all Alixar view |
26
|
|
|
* |
27
|
|
|
* @author Alxarafe |
28
|
|
|
*/ |
29
|
|
|
class AlixarView extends \Alixar\Base\AlixarBasicView |
30
|
|
|
{ |
31
|
|
|
|
32
|
|
|
public function __construct($ctrl) |
33
|
|
|
{ |
34
|
|
|
parent::__construct($ctrl); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function getTopMenu() |
38
|
|
|
{ |
39
|
|
|
$ret[] = [ |
|
|
|
|
40
|
|
|
'text' => '<i class="fa fa-cog fa-fw"></i> Config', |
41
|
|
|
'href' => '?call=EditConfig', |
42
|
|
|
]; |
43
|
|
|
$ret[] = [ |
44
|
|
|
'text' => '<i class="fa fa-database fa-fw"></i> Database', |
45
|
|
|
'href' => 'index.html', |
46
|
|
|
'options' => [ |
47
|
|
|
[ |
48
|
|
|
'text' => '<i class="fa fa-address-book fa-fw"></i> People', |
49
|
|
|
'href' => '?call=People' |
50
|
|
|
], |
51
|
|
|
[ |
52
|
|
|
'text' => '<i class="fa fa-automobile fa-fw"></i> Vehicles', |
53
|
|
|
'href' => '?call=Vehicles', |
54
|
|
|
'options' => [ |
55
|
|
|
'text' => '<i class="fa fa-address-book fa-fw"></i> People', |
56
|
|
|
'href' => '?call=People' |
57
|
|
|
] |
58
|
|
|
] |
59
|
|
|
] |
60
|
|
|
]; |
61
|
|
|
|
62
|
|
|
return $ret; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function getLeftMenu(): array |
66
|
|
|
{ |
67
|
|
|
$ret[] = [ |
|
|
|
|
68
|
|
|
'text' => '<i class="fa fa-cog fa-fw"></i> Config', |
69
|
|
|
'href' => '?call=EditConfig', |
70
|
|
|
]; |
71
|
|
|
$ret[] = [ |
72
|
|
|
'text' => '<i class="fa fa-database fa-fw"></i> Database', |
73
|
|
|
'href' => 'index.html', |
74
|
|
|
'options' => [ |
75
|
|
|
[ |
76
|
|
|
'text' => '<i class="fa fa-address-book fa-fw"></i> People', |
77
|
|
|
'href' => '?call=People' |
78
|
|
|
], |
79
|
|
|
[ |
80
|
|
|
'text' => '<i class="fa fa-automobile fa-fw"></i> Vehicles', |
81
|
|
|
'href' => '?call=Vehicles', |
82
|
|
|
'options' => [ |
83
|
|
|
'text' => '<i class="fa fa-address-book fa-fw"></i> People', |
84
|
|
|
'href' => '?call=People' |
85
|
|
|
] |
86
|
|
|
] |
87
|
|
|
] |
88
|
|
|
]; |
89
|
|
|
|
90
|
|
|
return $ret; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Show HTML header HTML + BODY + Top menu + left menu + DIV |
95
|
|
|
* |
96
|
|
|
* @param string $this->head Optionnal head lines |
97
|
|
|
* @param string $this->title HTML title |
98
|
|
|
* @param string $this->help_url Url links to help page |
99
|
|
|
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage |
100
|
|
|
* For other external page: http://server/url |
101
|
|
|
* @param string $this->target Target to use on links |
102
|
|
|
* @param int $this->disablejs More content into html header |
103
|
|
|
* @param int $this->disablehead More content into html header |
104
|
|
|
* @param array $this->arrayofjs Array of complementary js files |
105
|
|
|
* @param array $this->arrayofcss Array of complementary css files |
106
|
|
|
* @param string $this->morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) |
107
|
|
|
* @param string $this->morecssonbody More CSS on body tag. |
108
|
|
|
* @param string $this->replacemainareaby Replace call to main_area() by a print of this string |
109
|
|
|
* @return void |
110
|
|
|
*/ |
111
|
|
|
function llxHeader($_head = '', $_title = '', $_help_url = '', $_target = '', $_disablejs = 0, $_disablehead = 0, $_arrayofjs = '', $_arrayofcss = '', $_morequerystring = '', $_morecssonbody = '', $_replacemainareaby = '') |
112
|
|
|
{ |
113
|
|
|
$this->head = $_head; |
114
|
|
|
$this->title = $_title; |
115
|
|
|
$this->help_url = $_help_url; |
116
|
|
|
$this->target = $_target; |
117
|
|
|
$this->disablejs = $_disablejs; |
118
|
|
|
$this->disablehead = $_disablehead; |
119
|
|
|
$this->arrayofjs = $_arrayofjs; |
120
|
|
|
$this->arrayofcss = $_arrayofcss; |
121
|
|
|
$this->morequerystring = $_morequerystring; |
122
|
|
|
$this->morecssonbody = $_morecssonbody; |
123
|
|
|
$this->replacemainareaby = $_replacemainareaby; |
124
|
|
|
|
125
|
|
|
// html header |
126
|
|
|
$this->top_htmlhead(/* $this->head, $this->title, $this->disablejs, $this->disablehead, $this->arrayofjs, $this->arrayofcss */); |
127
|
|
|
|
128
|
|
|
print '<body id="mainbody"' . ($this->morecssonbody ? ' class="' . $this->morecssonbody . '"' : '') . '>' . "\n"; |
129
|
|
|
|
130
|
|
|
// top menu and left menu area |
131
|
|
|
if (empty(Globals::$conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) { |
132
|
|
|
$this->top_menu(/* $this->head, $this->title, $this->target, $this->disablejs, $this->disablehead, $this->arrayofjs, $this->arrayofcss, $this->morequerystring, $this->help_url */); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
if (empty(Globals::$conf->dol_hide_leftmenu)) { |
136
|
|
|
//$this->left_menu('', $this->help_url, '', '', 1, $this->title, 1); // $menumanager is retreived with a global $menumanager inside this function |
137
|
|
|
$this->left_menu('', /* $this->help_url, */ '', '', 1, /* $this->title, */ 1); // $menumanager is retreived with a global $menumanager inside this function |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
// main area |
141
|
|
|
if ($this->replacemainareaby) { |
142
|
|
|
print $this->replacemainareaby; |
143
|
|
|
return; |
144
|
|
|
} |
145
|
|
|
$this->main_area($this->title); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Show an HTML header + a BODY + The top menu bar |
150
|
|
|
* |
151
|
|
|
* @param string $this->head Lines in the HEAD |
152
|
|
|
* @param string $this->title Title of web page |
153
|
|
|
* @param string $this->target Target to use in menu links (Example: '' or '_top') |
154
|
|
|
* @param int $this->disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) |
155
|
|
|
* @param int $this->disablehead Do not output head section |
156
|
|
|
* @param array $this->arrayofjs Array of js files to add in header |
157
|
|
|
* @param array $this->arrayofcss Array of css files to add in header |
158
|
|
|
* @param string $this->morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) |
159
|
|
|
* @param string $helppagename Name of wiki page for help ('' by default). |
160
|
|
|
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage |
161
|
|
|
* For other external page: http://server/url |
162
|
|
|
* @return void |
163
|
|
|
*/ |
164
|
|
|
function top_menu(/* $this->head, $this->title = '', $this->target = '', $this->disablejs = 0, $this->disablehead = 0, $this->arrayofjs = '', $this->arrayofcss = '', $this->morequerystring = '', $helppagename = '' */) |
165
|
|
|
{ |
166
|
|
|
// global Globals::$user, Globals::$conf, Globals::$langs, $db; |
167
|
|
|
// global $dolibarr_main_authentication, $dolibarr_main_demo; |
168
|
|
|
// global Globals::$hookManager, $menumanager; |
169
|
|
|
|
170
|
|
|
$searchform = ''; |
171
|
|
|
$bookmarks = ''; |
172
|
|
|
|
173
|
|
|
// Instantiate hooks of thirdparty module |
174
|
|
|
Globals::$hookManager->initHooks(array('toprightmenu')); |
175
|
|
|
|
176
|
|
|
$toprightmenu = ''; |
177
|
|
|
|
178
|
|
|
// For backward compatibility with old modules |
179
|
|
|
if (empty(Globals::$conf->headerdone)) { |
180
|
|
|
$this->top_htmlhead(/* $this->head, $this->title, $this->disablejs, $this->disablehead, $this->arrayofjs, $this->arrayofcss */); |
181
|
|
|
print '<body id="mainbody">'; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/* |
185
|
|
|
* Top menu |
186
|
|
|
*/ |
187
|
|
|
if ((empty(Globals::$conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { |
188
|
|
|
print "\n" . '<!-- Start top horizontal -->' . "\n"; |
189
|
|
|
|
190
|
|
|
print '<div class="side-nav-vert' . (DolUtils::GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '') . '"><div id="id-top">'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible. |
191
|
|
|
// Show menu entries |
192
|
|
|
print '<div id="tmenu_tooltip' . (empty(Globals::$conf->global->MAIN_MENU_INVERT) ? '' : 'invert') . '" class="tmenu">' . "\n"; |
193
|
|
|
Globals::$menuManager->atarget = $this->target; |
194
|
|
|
Globals::$menuManager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n |
195
|
|
|
print "</div>\n"; |
196
|
|
|
|
197
|
|
|
// Define link to login card |
198
|
|
|
$appli = constant('DOL_APPLICATION_TITLE'); |
199
|
|
|
if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) { |
200
|
|
|
$appli = Globals::$conf->global->MAIN_APPLICATION_TITLE; |
201
|
|
|
if (preg_match('/\d\.\d/', $appli)) { |
202
|
|
|
if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
203
|
|
|
$appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
204
|
|
|
} else |
205
|
|
|
$appli .= " " . DOL_VERSION; |
206
|
|
|
} else |
207
|
|
|
$appli .= " " . DOL_VERSION; |
208
|
|
|
|
209
|
|
|
if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL)) |
210
|
|
|
$appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL; |
211
|
|
|
|
212
|
|
|
$logouttext = ''; |
213
|
|
|
if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
214
|
|
|
//$logouthtmltext=$appli.'<br>'; |
215
|
|
|
$logouthtmltext = ''; |
216
|
|
|
if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { { |
217
|
|
|
$logouthtmltext .= Globals::$langs->trans("Logout") . '<br>'; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
//$logouttext .='<a accesskey="l" href="'.DOL_BASE_URI.'/user/logout.php">'; |
221
|
|
|
$logouttext .= '<a accesskey="l" href="' . BASE_URI . '?controller=user&method=logout">'; |
222
|
|
|
//$logouttext .= img_picto(Globals::$langs->trans('Logout').":".Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); |
223
|
|
|
$logouttext .= '<span class="fa fa-sign-out atoplogin"></span>'; |
224
|
|
|
$logouttext .= '</a>'; |
225
|
|
|
} else { |
226
|
|
|
$logouthtmltext .= Globals::$langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); |
227
|
|
|
$logouttext .= img_picto(Globals::$langs->trans('Logout') . ":" . Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); |
228
|
|
|
} |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
print '<div class="login_block">' . "\n"; |
232
|
|
|
|
233
|
|
|
// Add login user link |
234
|
|
|
$toprightmenu .= '<div class="login_block_user">'; |
235
|
|
|
|
236
|
|
|
// Login name with photo and tooltip |
237
|
|
|
$mode = -1; |
238
|
|
|
$toprightmenu .= '<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">'; |
239
|
|
|
$toprightmenu .= Globals::$user->getNomUrl($mode, '', 1, 0, 11, 0, (Globals::$user->firstname ? 'firstname' : -1), 'atoplogin'); |
240
|
|
|
$toprightmenu .= '</div></div>'; |
241
|
|
|
|
242
|
|
|
$toprightmenu .= '</div>' . "\n"; |
243
|
|
|
|
244
|
|
|
$toprightmenu .= '<div class="login_block_other">'; |
245
|
|
|
|
246
|
|
|
// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>') |
247
|
|
|
$parameters = array(); |
248
|
|
|
$result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks |
249
|
|
|
if (is_numeric($result)) { |
250
|
|
|
if ($result == 0) |
251
|
|
|
$toprightmenu .= Globals::$hookManager->resPrint; // add |
252
|
|
|
else |
253
|
|
|
$toprightmenu = Globals::$hookManager->resPrint; // replace |
254
|
|
|
} |
255
|
|
|
else { |
256
|
|
|
$toprightmenu .= $result; // For backward compatibility |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
// Link to module builder |
260
|
|
|
if (!empty(Globals::$conf->modulebuilder->enabled)) { |
261
|
|
|
//$text = '<a href="' . DOL_BASE_URI . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
262
|
|
|
$text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
263
|
|
|
//$text.= img_picto(":".Globals::$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"'); |
264
|
|
|
$text .= '<span class="fa fa-bug atoplogin"></span>'; |
265
|
|
|
$text .= '</a>'; |
266
|
|
|
$toprightmenu .= @Form::textwithtooltip('', Globals::$langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2); |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
// Link to print main content area |
270
|
|
|
if (empty(Globals::$conf->global->MAIN_PRINT_DISABLELINK) && empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && Globals::$conf->browser->layout != 'phone') { |
271
|
|
|
$qs = DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]); |
272
|
|
|
|
273
|
|
|
if (is_array($_POST)) { |
274
|
|
|
foreach ($_POST as $key => $value) { |
275
|
|
|
if ($key !== 'action' && $key !== 'password' && !is_array($value)) { |
276
|
|
|
$qs .= '&' . $key . '=' . urlencode($value); |
277
|
|
|
} |
278
|
|
|
} |
279
|
|
|
} |
280
|
|
|
$qs .= (($qs && $this->morequerystring) ? '&' : '') . $this->morequerystring; |
281
|
|
|
$text = '<a href="' . DolUtils::dol_escape_htmltag($_SERVER["PHP_SELF"]) . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">'; |
282
|
|
|
//$text.= img_picto(":".Globals::$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"'); |
283
|
|
|
$text .= '<span class="fa fa-print atoplogin"></span>'; |
284
|
|
|
$text .= '</a>'; |
285
|
|
|
$toprightmenu .= @Form::textwithtooltip('', Globals::$langs->trans("PrintContentArea"), 2, 1, $text, 'login_block_elem', 2); |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
// Link to Dolibarr wiki pages |
289
|
|
|
if (empty(Globals::$conf->global->MAIN_HELP_DISABLELINK) && empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
290
|
|
|
Globals::$langs->load("help"); |
291
|
|
|
|
292
|
|
|
$helpbaseurl = ''; |
293
|
|
|
$helppage = ''; |
294
|
|
|
$mode = ''; |
295
|
|
|
|
296
|
|
|
if (empty($helppagename)) { |
|
|
|
|
297
|
|
|
$helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; |
298
|
|
|
} |
299
|
|
|
// Get helpbaseurl, helppage and mode from helppagename and langs |
300
|
|
|
$arrayres = $this->getHelpParamFor($helppagename, Globals::$langs); |
301
|
|
|
$helpbaseurl = $arrayres['helpbaseurl']; |
302
|
|
|
$helppage = $arrayres['helppage']; |
303
|
|
|
$mode = $arrayres['mode']; |
304
|
|
|
|
305
|
|
|
// Link to help pages |
306
|
|
|
if ($helpbaseurl && $helppage) { |
307
|
|
|
$text = ''; |
308
|
|
|
if (!empty(Globals::$conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) { |
309
|
|
|
Globals::$langs->load('admin'); |
310
|
|
|
$appli .= '<br>' . Globals::$langs->trans("Database") . ': ' . $db->database_name; |
|
|
|
|
311
|
|
|
} |
312
|
|
|
$this->title = $appli . '<br>'; |
313
|
|
|
$this->title .= Globals::$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage'); |
314
|
|
|
if ($mode == 'wiki') { |
315
|
|
|
$this->title .= ' - ' . Globals::$langs->trans("PageWiki") . ' "' . DolUtils::dol_escape_htmltag(strtr($helppage, '_', ' ')) . '"'; |
316
|
|
|
} |
317
|
|
|
$text .= '<a class="help" target="_blank" rel="noopener" href="'; |
318
|
|
|
if ($mode == 'wiki') { |
319
|
|
|
$text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage))); |
320
|
|
|
} else { |
321
|
|
|
$text .= sprintf($helpbaseurl, $helppage); |
322
|
|
|
} |
323
|
|
|
$text .= '">'; |
324
|
|
|
//$text.=img_picto('', 'helpdoc_top').' '; |
325
|
|
|
$text .= '<span class="fa fa-question-circle atoplogin"></span>'; |
326
|
|
|
//$toprightmenu.=Globals::$langs->trans($mode == 'wiki' ? 'OnlineHelp': 'Help'); |
327
|
|
|
//if ($mode == 'wiki') $text.=' ('.dol_trunc(strtr($helppage,'_',' '),8).')'; |
328
|
|
|
$text .= '</a>'; |
329
|
|
|
//$toprightmenu.='</div>'."\n"; |
330
|
|
|
$toprightmenu .= @Form::textwithtooltip('', $this->title, 2, 1, $text, 'login_block_elem', 2); |
331
|
|
|
} |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
// Logout link |
335
|
|
|
$toprightmenu .= @Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem', 2); |
336
|
|
|
|
337
|
|
|
$toprightmenu .= '</div>'; |
338
|
|
|
|
339
|
|
|
print $toprightmenu; |
340
|
|
|
|
341
|
|
|
print "</div>\n"; // end div class="login_block" |
342
|
|
|
|
343
|
|
|
print '</div></div>'; |
344
|
|
|
|
345
|
|
|
print '<div style="clear: both;"></div>'; |
346
|
|
|
print "<!-- End top horizontal menu -->\n\n"; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) { |
350
|
|
|
print '<!-- Begin div id-container --><div id="id-container" class="id-container' . (isset($morecss) && $morecss ? ' ' . $morecss : '') . '">'; |
|
|
|
|
351
|
|
|
} |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* Show left menu bar |
356
|
|
|
* |
357
|
|
|
* @param array $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprectaed and must be provided to ''. |
358
|
|
|
* @param string $helppagename Name of wiki page for help ('' by default). |
359
|
|
|
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage |
360
|
|
|
* For other external page: http://server/url |
361
|
|
|
* @param string $notused Deprecated. Used in past to add content into left menu. Hooks can be used now. |
362
|
|
|
* @param array $menu_array_after Table of menu entries to show after entries of menu handler |
363
|
|
|
* @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules. |
364
|
|
|
* @param string $this->title Title of web page |
365
|
|
|
* @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) |
366
|
|
|
* @return void |
367
|
|
|
*/ |
368
|
|
|
function left_menu($menu_array_before, /* $helppagename = '', */ $notused = '', $menu_array_after = '', $leftmenuwithoutmainarea = 0, /* $this->title = '', */ $acceptdelayedhtml = 0) |
369
|
|
|
{ |
370
|
|
|
$searchform = ''; |
371
|
|
|
$bookmarks = ''; |
372
|
|
|
|
373
|
|
|
$helppagename = $this->help_url; |
374
|
|
|
|
375
|
|
|
if (!empty($menu_array_before)) { |
376
|
|
|
dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING); |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
if (empty(Globals::$conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { |
380
|
|
|
// Instantiate hooks of thirdparty module |
381
|
|
|
Globals::$hookManager->initHooks(array('searchform', 'leftblock')); |
382
|
|
|
|
383
|
|
|
print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n"; |
384
|
|
|
|
385
|
|
|
if (Globals::$conf->browser->layout == 'phone') { |
386
|
|
|
Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? |
387
|
|
|
} |
388
|
|
|
print "\n"; |
389
|
|
|
|
390
|
|
|
//if (!is_object($form)) { |
391
|
|
|
$form = new Form(/* $db */); |
392
|
|
|
//} |
393
|
|
|
$selected = -1; |
394
|
|
|
$usedbyinclude = 1; |
395
|
|
|
|
396
|
|
|
//include_once DOL_BASE_PATH . '/core/ajax/selectsearchbox.php'; // This set $arrayresult |
397
|
|
|
$arrayresult = AjaxLib::selectSearchBox(); |
398
|
|
|
|
399
|
|
|
if (Globals::$conf->use_javascript_ajax && empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) { |
400
|
|
|
//$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_BASE_URI.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, Globals::$langs->trans("Search"), 1); |
401
|
|
|
$searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, '', 1, 0, (empty(Globals::$conf->global->MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY) ? 1 : 0), 'vmenusearchselectcombo', 1, Globals::$langs->trans("Search"), 1); |
402
|
|
|
} else { |
403
|
|
|
foreach ($arrayresult as $key => $val) { |
404
|
|
|
//$searchform.=printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth100', 'sall', $val['shortcut'], 'searchleft', img_picto('',$val['img'])); |
405
|
|
|
$searchform .= printSearchForm($val['url'], $val['url'], $val['label'], 'maxwidth125', 'sall', $val['shortcut'], 'searchleft', img_picto('', $val['img'], '', false, 1, 1)); |
406
|
|
|
} |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
// Execute hook printSearchForm |
410
|
|
|
$parameters = array('searchform' => $searchform); |
411
|
|
|
|
412
|
|
|
$reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks |
413
|
|
|
if (empty($reshook)) { |
414
|
|
|
$searchform .= Globals::$hookManager->resPrint; |
415
|
|
|
} else |
416
|
|
|
$searchform = Globals::$hookManager->resPrint; |
417
|
|
|
|
418
|
|
|
// Force special value for $searchform |
419
|
|
|
if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty(Globals::$conf->use_javascript_ajax)) { |
420
|
|
|
$urltosearch = DOL_BASE_URI . '/core/search_page.php?showtitlebefore=1'; |
421
|
|
|
$searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" alt="' . DolUtils::dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")) . '">' . Globals::$langs->trans("Search") . '...</a></div></div>'; |
422
|
|
|
} elseif (Globals::$conf->use_javascript_ajax && !empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) { |
423
|
|
|
$searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="' . DolUtils::dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")) . '">' . Globals::$langs->trans("Search") . '...</a></div><div id="divsearchforms2" style="display: none">' . $searchform . '</div>'; |
424
|
|
|
$searchform .= '<script type="text/javascript"> |
425
|
|
|
jQuery(document).ready(function () { |
426
|
|
|
jQuery("#divsearchforms1").click(function(){ |
427
|
|
|
jQuery("#divsearchforms2").toggle(); |
428
|
|
|
}); |
429
|
|
|
}); |
430
|
|
|
</script>' . "\n"; |
431
|
|
|
$searchform .= '</div>'; |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
// Define $bookmarks |
435
|
|
|
if (!empty(Globals::$conf->bookmark->enabled) && Globals::$user->rights->bookmark->lire) { |
436
|
|
|
include_once DOL_BASE_PATH . '/bookmarks/bookmarks.lib.php'; |
437
|
|
|
Globals::$langs->load("bookmarks"); |
438
|
|
|
|
439
|
|
|
$bookmarks = printBookmarksList($db, Globals::$langs); |
|
|
|
|
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
// Left column |
443
|
|
|
print '<!-- Begin left menu -->' . "\n"; |
444
|
|
|
|
445
|
|
|
print '<div class="vmenu"' . (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"') . '>' . "\n\n"; |
446
|
|
|
|
447
|
|
|
// Show left menu with other forms |
448
|
|
|
Globals::$menuManager->menu_array = $menu_array_before; |
449
|
|
|
Globals::$menuManager->menu_array_after = $menu_array_after; |
450
|
|
|
Globals::$menuManager->showmenu('left', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // output menu_array and menu found in database |
451
|
|
|
// Dolibarr version + help + bug report link |
452
|
|
|
print "\n"; |
453
|
|
|
print "<!-- Begin Help Block-->\n"; |
454
|
|
|
print '<div id="blockvmenuhelp" class="blockvmenuhelp">' . "\n"; |
455
|
|
|
|
456
|
|
|
// Version |
457
|
|
|
if (empty(Globals::$conf->global->MAIN_HIDE_VERSION)) { // Version is already on help picto and on login page. |
458
|
|
|
$doliurl = 'https://www.dolibarr.org'; |
459
|
|
|
//local communities |
460
|
|
|
if (preg_match('/fr/i', Globals::$langs->defaultlang)) { |
461
|
|
|
$doliurl = 'https://www.dolibarr.fr'; |
462
|
|
|
} |
463
|
|
|
if (preg_match('/es/i', Globals::$langs->defaultlang)) { |
464
|
|
|
$doliurl = 'https://www.dolibarr.es'; |
465
|
|
|
} |
466
|
|
|
if (preg_match('/de/i', Globals::$langs->defaultlang)) { |
467
|
|
|
$doliurl = 'https://www.dolibarr.de'; |
468
|
|
|
} |
469
|
|
|
if (preg_match('/it/i', Globals::$langs->defaultlang)) { |
470
|
|
|
$doliurl = 'https://www.dolibarr.it'; |
471
|
|
|
} |
472
|
|
|
if (preg_match('/gr/i', Globals::$langs->defaultlang)) { |
473
|
|
|
$doliurl = 'https://www.dolibarr.gr'; |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
$appli = constant('DOL_APPLICATION_TITLE'); |
477
|
|
|
if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) { |
478
|
|
|
$appli = Globals::$conf->global->MAIN_APPLICATION_TITLE; |
479
|
|
|
$doliurl = ''; |
480
|
|
|
if (preg_match('/\d\.\d/', $appli)) { |
481
|
|
|
if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) { |
482
|
|
|
$appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
483
|
|
|
} |
484
|
|
|
} else { |
485
|
|
|
$appli .= " " . DOL_VERSION; |
486
|
|
|
} |
487
|
|
|
} else { |
488
|
|
|
$appli .= " " . DOL_VERSION; |
489
|
|
|
} |
490
|
|
|
print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">'; |
491
|
|
|
if ($doliurl) { |
492
|
|
|
print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">'; |
493
|
|
|
} else { |
494
|
|
|
print '<span class="help">'; |
495
|
|
|
} |
496
|
|
|
print $appli; |
497
|
|
|
if ($doliurl) { |
498
|
|
|
print '</a>'; |
499
|
|
|
} else { |
500
|
|
|
print '</span>'; |
501
|
|
|
} |
502
|
|
|
print '</div>' . "\n"; |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
// Link to bugtrack |
506
|
|
|
if (!empty(Globals::$conf->global->MAIN_BUGTRACK_ENABLELINK)) { |
507
|
|
|
require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php'; |
508
|
|
|
|
509
|
|
|
$bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new'; |
510
|
|
|
$bugbaseurl .= '?title='; |
511
|
|
|
$bugbaseurl .= urlencode("Bug: "); |
512
|
|
|
$bugbaseurl .= '&body='; |
513
|
|
|
$bugbaseurl .= urlencode("# Bug\n"); |
514
|
|
|
$bugbaseurl .= urlencode("\n"); |
515
|
|
|
$bugbaseurl .= urlencode("## Environment\n"); |
516
|
|
|
$bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n"); |
517
|
|
|
$bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n"); |
518
|
|
|
$bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n"); |
519
|
|
|
$bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n"); |
520
|
|
|
$bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n"); |
521
|
|
|
$bugbaseurl .= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n"); |
522
|
|
|
$bugbaseurl .= urlencode("\n"); |
523
|
|
|
$bugbaseurl .= urlencode("## Report\n"); |
524
|
|
|
print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">'; |
525
|
|
|
print '<a class="help" target="_blank" rel="noopener" href="' . $bugbaseurl . '">' . Globals::$langs->trans("FindBug") . '</a>'; |
526
|
|
|
print '</div>'; |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
print "</div>\n"; |
530
|
|
|
print "<!-- End Help Block-->\n"; |
531
|
|
|
print "\n"; |
532
|
|
|
|
533
|
|
|
print "</div>\n"; |
534
|
|
|
print "<!-- End left menu -->\n"; |
535
|
|
|
print "\n"; |
536
|
|
|
|
537
|
|
|
// Execute hook printLeftBlock |
538
|
|
|
$parameters = array(); |
539
|
|
|
$reshook = Globals::$hookManager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks |
540
|
|
|
print Globals::$hookManager->resPrint; |
541
|
|
|
|
542
|
|
|
print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left" |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
print "\n"; |
546
|
|
|
print '<!-- Begin right area -->' . "\n"; |
547
|
|
|
|
548
|
|
|
if (empty($leftmenuwithoutmainarea)) { |
549
|
|
|
main_area($this->title); |
550
|
|
|
} |
551
|
|
|
} |
552
|
|
|
|
553
|
|
|
/** |
554
|
|
|
* Begin main area |
555
|
|
|
* |
556
|
|
|
* @param string $this->title Title |
557
|
|
|
* @return void |
558
|
|
|
*/ |
559
|
|
|
function main_area(/* $this->title = '' */) |
560
|
|
|
{ |
561
|
|
|
// global Globals::$conf, Globals::$langs; |
562
|
|
|
|
563
|
|
|
if (empty(Globals::$conf->dol_hide_leftmenu)) { |
564
|
|
|
print '<div id="id-right">'; |
565
|
|
|
} |
566
|
|
|
|
567
|
|
|
print "\n"; |
568
|
|
|
|
569
|
|
|
print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n"; |
570
|
|
|
|
571
|
|
|
if (!empty(Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { |
572
|
|
|
print info_admin(Globals::$langs->trans("WarningYouAreInMaintenanceMode", Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)); |
573
|
|
|
} |
574
|
|
|
} |
575
|
|
|
|
576
|
|
|
/** |
577
|
|
|
* Return helpbaseurl, helppage and mode |
578
|
|
|
* |
579
|
|
|
* @param string $helppagename Page name ('EN:xxx,ES:eee,FR:fff...' or 'http://localpage') |
580
|
|
|
* @param Translate Globals::$langs Language |
581
|
|
|
* @return array Array of help urls |
582
|
|
|
*/ |
583
|
|
|
function getHelpParamFor($helppagename, $langs) |
584
|
|
|
{ |
585
|
|
|
$helpbaseurl = ''; |
586
|
|
|
$helppage = ''; |
587
|
|
|
$mode = ''; |
588
|
|
|
|
589
|
|
|
if (preg_match('/^http/i', $helppagename)) { |
590
|
|
|
// If complete URL |
591
|
|
|
$helpbaseurl = '%s'; |
592
|
|
|
$helppage = $helppagename; |
593
|
|
|
$mode = 'local'; |
594
|
|
|
} else { |
595
|
|
|
// If WIKI URL |
596
|
|
|
if (preg_match('/^es/i', Globals::$langs->defaultlang)) { |
597
|
|
|
$helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
598
|
|
|
if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) |
599
|
|
|
$helppage = $reg[1]; |
600
|
|
|
} |
601
|
|
|
if (preg_match('/^fr/i', Globals::$langs->defaultlang)) { |
602
|
|
|
$helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
603
|
|
|
if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) |
604
|
|
|
$helppage = $reg[1]; |
605
|
|
|
} |
606
|
|
|
if (empty($helppage)) { // If help page not already found |
607
|
|
|
$helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
608
|
|
|
if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) |
609
|
|
|
$helppage = $reg[1]; |
610
|
|
|
} |
611
|
|
|
$mode = 'wiki'; |
612
|
|
|
} |
613
|
|
|
return array('helpbaseurl' => $helpbaseurl, 'helppage' => $helppage, 'mode' => $mode); |
614
|
|
|
} |
615
|
|
|
|
616
|
|
|
/** |
617
|
|
|
* Show a search area. |
618
|
|
|
* Used when the javascript quick search is not used. |
619
|
|
|
* |
620
|
|
|
* @param string $urlaction Url post |
621
|
|
|
* @param string $urlobject Url of the link under the search box |
622
|
|
|
* @param string $this->title Title search area |
623
|
|
|
* @param string $htmlmorecss Add more css |
624
|
|
|
* @param string $htmlinputname Field Name input form |
625
|
|
|
* @param string $accesskey Accesskey |
626
|
|
|
* @param string $prefhtmlinputname Complement for id to avoid multiple same id in the page |
627
|
|
|
* @param string $img Image to use |
628
|
|
|
* @param string $showtitlebefore Show title before input text instead of into placeholder. This can be set when output is dedicated for text browsers. |
629
|
|
|
* @return string |
630
|
|
|
*/ |
631
|
|
|
function printSearchForm($urlaction, $urlobject, $this_title, $htmlmorecss, $htmlinputname, $accesskey = '', $prefhtmlinputname = '', $img = '', $showtitlebefore = 0) |
632
|
|
|
{ |
633
|
|
|
// global Globals::$conf, Globals::$langs, Globals::$user; |
634
|
|
|
|
635
|
|
|
$ret = ''; |
636
|
|
|
$ret .= '<form action="' . $urlaction . '" method="post" class="searchform">'; |
637
|
|
|
$ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
638
|
|
|
$ret .= '<input type="hidden" name="mode" value="search">'; |
639
|
|
|
$ret .= '<input type="hidden" name="savelogin" value="' . DolUtils::dol_escape_htmltag(Globals::$user->login) . '">'; |
640
|
|
|
if ($showtitlebefore) { |
641
|
|
|
$ret .= $this->title . ' '; |
642
|
|
|
} |
643
|
|
|
$ret .= '<input type="text" class="flat ' . $htmlmorecss . '"'; |
644
|
|
|
$ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"'; |
645
|
|
|
$ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : ''); |
646
|
|
|
$ret .= ' placeholder="' . strip_tags($this->title) . '"'; |
647
|
|
|
$ret .= ' name="' . $htmlinputname . '" id="' . $prefhtmlinputname . $htmlinputname . '" />'; |
648
|
|
|
//$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.Globals::$langs->trans("Go").'">'; |
649
|
|
|
$ret .= '<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">'; |
650
|
|
|
$ret .= '<span class="fa fa-search"></span>'; |
651
|
|
|
$ret .= '</button>'; |
652
|
|
|
$ret .= "</form>\n"; |
653
|
|
|
return $ret; |
654
|
|
|
} |
655
|
|
|
|
656
|
|
|
/** |
657
|
|
|
* Show HTML footer |
658
|
|
|
* Close div /DIV class=fiche + /DIV id-right + /DIV id-container + /BODY + /HTML. |
659
|
|
|
* If global var $delayedhtmlcontent was filled, we output it just before closing the body. |
660
|
|
|
* |
661
|
|
|
* @param string $comment A text to add as HTML comment into HTML generated page |
662
|
|
|
* @param string $zone 'private' (for private pages) or 'public' (for public pages) |
663
|
|
|
* @param int $disabledoutputofmessages Clear all messages stored into session without diplaying them |
664
|
|
|
* @return void |
665
|
|
|
*/ |
666
|
|
|
function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0) |
667
|
|
|
{ |
668
|
|
|
// global Globals::$conf, Globals::$langs, Globals::$user, $object; |
669
|
|
|
// global $delayedhtmlcontent; |
670
|
|
|
// global $contextpage, $page, $limit; |
671
|
|
|
|
672
|
|
|
$ext = 'layout=' . Globals::$conf->browser->layout . '&version=' . urlencode(DOL_VERSION); |
673
|
|
|
|
674
|
|
|
// Global html output events ($mesgs, $errors, $warnings) |
675
|
|
|
DolUtils::dol_htmloutput_events($disabledoutputofmessages); |
676
|
|
|
|
677
|
|
|
// Code for search criteria persistence. |
678
|
|
|
// Globals::$user->lastsearch_values was set by the GETPOST when form field search_xxx exists |
679
|
|
|
if (is_object(Globals::$user) && !empty(Globals::$user->lastsearch_values_tmp) && is_array(Globals::$user->lastsearch_values_tmp)) { |
680
|
|
|
// Clean and save data |
681
|
|
|
foreach (Globals::$user->lastsearch_values_tmp as $key => $val) { |
682
|
|
|
unset($_SESSION['lastsearch_values_tmp_' . $key]); // Clean array to rebuild it just after |
683
|
|
|
if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button |
684
|
|
|
if (empty($val['sortfield'])) { |
685
|
|
|
unset($val['sortfield']); |
686
|
|
|
} |
687
|
|
|
if (empty($val['sortorder'])) { |
688
|
|
|
unset($val['sortorder']); |
689
|
|
|
} |
690
|
|
|
dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)"); |
691
|
|
|
$_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val); |
692
|
|
|
unset($_SESSION['lastsearch_values_' . $key]); |
693
|
|
|
} |
694
|
|
|
} |
695
|
|
|
} |
696
|
|
|
|
697
|
|
|
|
698
|
|
|
$relativepathstring = $_SERVER["PHP_SELF"]; |
699
|
|
|
// Clean $relativepathstring |
700
|
|
|
if (constant('DOL_BASE_URI')) |
701
|
|
|
$relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
702
|
|
|
$relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
703
|
|
|
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
704
|
|
|
if (preg_match('/list\.php$/', $relativepathstring)) { |
705
|
|
|
unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]); |
706
|
|
|
unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]); |
707
|
|
|
unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]); |
708
|
|
|
|
709
|
|
|
if (!empty($contextpage)) |
|
|
|
|
710
|
|
|
$_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage; |
711
|
|
|
if (!empty($page) && $page > 1) |
|
|
|
|
712
|
|
|
$_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page; |
713
|
|
|
if (!empty($limit) && $limit != Globals::$conf->limit) |
|
|
|
|
714
|
|
|
$_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit; |
715
|
|
|
|
716
|
|
|
unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]); |
717
|
|
|
unset($_SESSION['lastsearch_page_' . $relativepathstring]); |
718
|
|
|
unset($_SESSION['lastsearch_limit_' . $relativepathstring]); |
719
|
|
|
} |
720
|
|
|
|
721
|
|
|
// Core error message |
722
|
|
|
if (!empty(Globals::$conf->global->MAIN_CORE_ERROR)) { |
723
|
|
|
// Ajax version |
724
|
|
|
if (Globals::$conf->use_javascript_ajax) { |
725
|
|
|
$this->title = img_warning() . ' ' . Globals::$langs->trans('CoreErrorTitle'); |
726
|
|
|
print ajax_dialog($this->title, Globals::$langs->trans('CoreErrorMessage')); |
|
|
|
|
727
|
|
|
} |
728
|
|
|
// html version |
729
|
|
|
else { |
730
|
|
|
$msg = img_warning() . ' ' . Globals::$langs->trans('CoreErrorMessage'); |
731
|
|
|
print '<div class="error">' . $msg . '</div>'; |
732
|
|
|
} |
733
|
|
|
|
734
|
|
|
//define("MAIN_CORE_ERROR",0); // Constant was defined and we can't change value of a constant |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
print "\n\n"; |
738
|
|
|
|
739
|
|
|
print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche |
740
|
|
|
|
741
|
|
|
if (empty(Globals::$conf->dol_hide_leftmenu)) |
742
|
|
|
print '</div> <!-- End div id-right -->' . "\n"; // End div id-right |
743
|
|
|
|
744
|
|
|
if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) |
745
|
|
|
print '</div> <!-- End div id-container -->' . "\n"; // End div container |
746
|
|
|
|
747
|
|
|
print "\n"; |
748
|
|
|
if ($comment) |
749
|
|
|
print '<!-- ' . $comment . ' -->' . "\n"; |
750
|
|
|
|
751
|
|
|
DolUtils::printCommonFooter($zone); |
752
|
|
|
|
753
|
|
|
if (!empty($delayedhtmlcontent)) |
|
|
|
|
754
|
|
|
print $delayedhtmlcontent; |
755
|
|
|
|
756
|
|
|
if (!empty(Globals::$conf->use_javascript_ajax)) { |
757
|
|
|
print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n"; |
758
|
|
|
print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_foot.js&lang=' . Globals::$langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n"; |
759
|
|
|
} |
760
|
|
|
|
761
|
|
|
// Wrapper to add log when clicking on download or preview |
762
|
|
|
if (!empty(Globals::$conf->blockedlog->enabled) && is_object($object) && $object->id > 0 && $object->statut > 0) { |
|
|
|
|
763
|
|
|
if (in_array($object->element, array('facture'))) { // Restrict for the moment to element 'facture' |
764
|
|
|
print "\n<!-- JS CODE TO ENABLE log when making a download or a preview of a document -->\n"; |
765
|
|
|
|
766
|
|
|
?> |
767
|
|
|
<script type="text/javascript"> |
768
|
|
|
jQuery(document).ready(function () { |
769
|
|
|
$('a.documentpreview').click(function () { |
770
|
|
|
$.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>' |
771
|
|
|
, { |
772
|
|
|
id:<?php echo $object->id; ?> |
773
|
|
|
, element: '<?php echo $object->element ?>' |
774
|
|
|
, action: 'DOC_PREVIEW' |
775
|
|
|
} |
776
|
|
|
); |
777
|
|
|
}); |
778
|
|
|
$('a.documentdownload').click(function () { |
779
|
|
|
$.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>' |
780
|
|
|
, { |
781
|
|
|
id:<?php echo $object->id; ?> |
782
|
|
|
, element: '<?php echo $object->element ?>' |
783
|
|
|
, action: 'DOC_DOWNLOAD' |
784
|
|
|
} |
785
|
|
|
); |
786
|
|
|
}); |
787
|
|
|
}); |
788
|
|
|
</script> |
789
|
|
|
<?php |
790
|
|
|
} |
791
|
|
|
} |
792
|
|
|
|
793
|
|
|
// A div for the address popup |
794
|
|
|
print "\n<!-- A div to allow dialog popup -->\n"; |
795
|
|
|
print '<div id="dialogforpopup" style="display: none;"></div>' . "\n"; |
796
|
|
|
|
797
|
|
|
print "</body>\n"; |
798
|
|
|
|
799
|
|
|
print "<!-- Alixar debugBar footer -->"; |
800
|
|
|
print Debug::getRenderFooter(); // Includes Alixar debugBar footer |
801
|
|
|
|
802
|
|
|
print "</html>\n"; |
803
|
|
|
} |
804
|
|
|
} |
805
|
|
|
|