ryxeo-glpi-git / inc / display.function.php @ b67d8923
Historique | Voir | Annoter | Télécharger (76,2 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: display.function.php 7763 2009-01-06 18:44:50Z moyo $
|
4 |
-------------------------------------------------------------------------
|
5 |
GLPI - Gestionnaire Libre de Parc Informatique
|
6 |
Copyright (C) 2003-2009 by the INDEPNET Development Team.
|
7 |
|
8 |
http://indepnet.net/ http://glpi-project.org
|
9 |
-------------------------------------------------------------------------
|
10 |
|
11 |
LICENSE
|
12 |
|
13 |
This file is part of GLPI.
|
14 |
|
15 |
GLPI is free software; you can redistribute it and/or modify
|
16 |
it under the terms of the GNU General Public License as published by
|
17 |
the Free Software Foundation; either version 2 of the License, or
|
18 |
(at your option) any later version.
|
19 |
|
20 |
GLPI is distributed in the hope that it will be useful,
|
21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
GNU General Public License for more details.
|
24 |
|
25 |
You should have received a copy of the GNU General Public License
|
26 |
along with GLPI; if not, write to the Free Software
|
27 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28 |
--------------------------------------------------------------------------
|
29 |
*/
|
30 |
|
31 |
// ----------------------------------------------------------------------
|
32 |
// Original Author of file:
|
33 |
// Purpose of file:
|
34 |
// ----------------------------------------------------------------------
|
35 |
|
36 |
if (!defined('GLPI_ROOT')){ |
37 |
die("Sorry. You can't access directly to this file"); |
38 |
} |
39 |
|
40 |
|
41 |
//******************************************************************************************************
|
42 |
//******************************************************************************************************
|
43 |
//*********** Fonctions d'affichage header footer helpdesk pager ***********************
|
44 |
//******************************************************************************************************
|
45 |
//******************************************************************************************************
|
46 |
|
47 |
/**
|
48 |
* Include common HTML headers
|
49 |
*
|
50 |
* @param $title title used for the page
|
51 |
* @return nothing
|
52 |
**/
|
53 |
function includeCommonHtmlHeader($title=''){ |
54 |
global $CFG_GLPI,$PLUGIN_HOOKS; |
55 |
|
56 |
// Send UTF8 Headers
|
57 |
header("Content-Type: text/html; charset=UTF-8"); |
58 |
// Send extra expires header if configured
|
59 |
if ($CFG_GLPI["sendexpire"]) { |
60 |
header_nocache(); |
61 |
} |
62 |
|
63 |
// Start the page
|
64 |
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"; |
65 |
// echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
|
66 |
echo "\n<html><head><title>GLPI - ".$title."</title>"; |
67 |
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8 \" >"; |
68 |
// Send extra expires header if configured
|
69 |
if ($CFG_GLPI["sendexpire"]) { |
70 |
echo "<meta http-equiv=\"Expires\" content=\"Fri, Jun 12 1981 08:20:00 GMT\" >\n"; |
71 |
echo "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n"; |
72 |
echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\n"; |
73 |
} |
74 |
// CSS link
|
75 |
echo "<link rel='stylesheet' href='".$CFG_GLPI["root_doc"]."/css/styles.css' type='text/css' media='screen' >\n"; |
76 |
// surcharge CSS hack for IE
|
77 |
echo "<!--[if lte IE 6]>" ; |
78 |
echo "<link rel='stylesheet' href='".$CFG_GLPI["root_doc"]."/css/styles_ie.css' type='text/css' media='screen' >\n"; |
79 |
echo "<![endif]-->"; |
80 |
|
81 |
echo "<link rel='stylesheet' type='text/css' media='print' href='".$CFG_GLPI["root_doc"]."/css/print.css' >\n"; |
82 |
echo "<link rel='shortcut icon' type='images/x-icon' href='".$CFG_GLPI["root_doc"]."/pics/favicon.ico' >\n"; |
83 |
|
84 |
// AJAX library
|
85 |
echo "<script type=\"text/javascript\" src='".$CFG_GLPI["root_doc"]."/lib/prototype.js'></script>\n"; |
86 |
echo "<script type=\"text/javascript\" src='".$CFG_GLPI["root_doc"]."/lib/control.modal.js'></script>\n"; |
87 |
echo "<script type=\"text/javascript\" src='".$CFG_GLPI["root_doc"]."/lib/scriptaculous/scriptaculous.js'></script>\n"; |
88 |
|
89 |
// Some Javascript-Functions which we may need later
|
90 |
echo "<script type=\"text/javascript\" src='".$CFG_GLPI["root_doc"]."/script.js'></script>\n"; |
91 |
|
92 |
// Calendar scripts
|
93 |
if (isset($_SESSION["glpilanguage"])){ |
94 |
echo "<style type=\"text/css\">@import url(".$CFG_GLPI["root_doc"]."/lib/calendar/aqua/theme.css);</style>\n"; |
95 |
echo "<script type=\"text/javascript\" src=\"".$CFG_GLPI["root_doc"]."/lib/calendar/calendar.js\"></script>\n"; |
96 |
echo "<script type=\"text/javascript\" src=\"".$CFG_GLPI["root_doc"]."/lib/calendar/lang/calendar-".$CFG_GLPI["languages"][$_SESSION["glpilanguage"]][2].".js\"></script>\n"; |
97 |
echo "<script type=\"text/javascript\" src=\"".$CFG_GLPI["root_doc"]."/lib/calendar/calendar-setup.js\"></script>\n"; |
98 |
} |
99 |
|
100 |
// Add specific javascript for plugins
|
101 |
if (isset($PLUGIN_HOOKS['add_javascript'])&&count($PLUGIN_HOOKS['add_javascript'])){ |
102 |
foreach ($PLUGIN_HOOKS["add_javascript"] as $plugin => $file) { |
103 |
echo "<script type=\"text/javascript\" src='".$CFG_GLPI["root_doc"]."/plugins/$plugin/$file'></script>\n"; |
104 |
} |
105 |
} |
106 |
// Add specific css for plugins
|
107 |
if (isset($PLUGIN_HOOKS['add_css'])&&count($PLUGIN_HOOKS['add_css'])){ |
108 |
foreach ($PLUGIN_HOOKS["add_css"] as $plugin => $file) { |
109 |
echo "<link rel='stylesheet' href='".$CFG_GLPI["root_doc"]."/plugins/$plugin/$file' type='text/css' media='screen' >\n"; |
110 |
} |
111 |
} |
112 |
|
113 |
// End of Head
|
114 |
echo "</head>\n"; |
115 |
} |
116 |
|
117 |
/**
|
118 |
* Common Title Function
|
119 |
*
|
120 |
* @param $ref_pic_link Path to the image to display
|
121 |
* @param $ref_pic_text Alt text of the icon
|
122 |
* @param $ref_title Title to display
|
123 |
* @param $ref_btts Extra items to display array(link=>text...)
|
124 |
* @return nothing
|
125 |
**/
|
126 |
function displayTitle($ref_pic_link="",$ref_pic_text="",$ref_title="",$ref_btts="") { |
127 |
echo "<div class='center'><table border='0'><tr>"; |
128 |
if ($ref_pic_link!="") |
129 |
echo "<td><img src=\"".$ref_pic_link."\" alt=\"".$ref_pic_text."\" |
130 |
title=\"".$ref_pic_text."\" ></td>"; |
131 |
if ($ref_title!="") |
132 |
echo "<td><span class='icon_consol'><strong>".$ref_title."</strong></span></td>"; |
133 |
if (is_array($ref_btts)&&count($ref_btts)) |
134 |
foreach ($ref_btts as $key => $val) { |
135 |
echo "<td><a class='icon_consol_hov' href=\"".$key."\">".$val."</a></td>"; |
136 |
} |
137 |
echo "</tr></table></div>"; |
138 |
} |
139 |
|
140 |
/**
|
141 |
* Print a nice HTML head for every page
|
142 |
*
|
143 |
*
|
144 |
* @param $title title of the page
|
145 |
* @param $url not used anymore.
|
146 |
* @param $sector sector in which the page displayed is
|
147 |
* @param $item item corresponding to the page displayed
|
148 |
* @param $option option corresponding to the page displayed
|
149 |
*
|
150 |
**/
|
151 |
function commonHeader($title,$url='',$sector="none",$item="none",$option="") |
152 |
{ |
153 |
// Print a nice HTML-head for every page
|
154 |
|
155 |
global $CFG_GLPI,$LANG,$PLUGIN_HOOKS,$HEADER_LOADED,$INFOFORM_PAGES,$DB ; |
156 |
|
157 |
if ($HEADER_LOADED) return; |
158 |
$HEADER_LOADED=true; |
159 |
// Override list-limit if choosen
|
160 |
if (isset($_POST['list_limit'])) { |
161 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
162 |
} |
163 |
|
164 |
includeCommonHtmlHeader($title);
|
165 |
if (!($CFG_GLPI["cache"]->start($sector.'_'.$item.$option,"GLPI_HEADER_".$_SESSION["glpiID"]))) { |
166 |
|
167 |
// Body
|
168 |
echo "<body>"; |
169 |
|
170 |
|
171 |
// Generate array for menu and check right
|
172 |
|
173 |
|
174 |
//////// INVENTORY
|
175 |
$showstate=false; |
176 |
$menu['inventory']['title']=$LANG["Menu"][38]; |
177 |
if (haveRight("computer","r")){ |
178 |
$menu['inventory']['default']='/front/computer.php'; |
179 |
|
180 |
$menu['inventory']['content']['computer']['title']=$LANG["Menu"][0]; |
181 |
$menu['inventory']['content']['computer']['shortcut']='c'; |
182 |
$menu['inventory']['content']['computer']['page']='/front/computer.php'; |
183 |
$menu['inventory']['content']['computer']['links']['search']='/front/computer.php'; |
184 |
if (haveRight("computer","w")){ |
185 |
$menu['inventory']['content']['computer']['links']['add']='/front/setup.templates.php?type='.COMPUTER_TYPE.'&add=1'; |
186 |
$menu['inventory']['content']['computer']['links']['template']='/front/setup.templates.php?type='.COMPUTER_TYPE.'&add=0'; |
187 |
} |
188 |
$showstate=true; |
189 |
} |
190 |
if (haveRight("monitor","r")){ |
191 |
$menu['inventory']['content']['monitor']['title']=$LANG["Menu"][3]; |
192 |
$menu['inventory']['content']['monitor']['shortcut']='m'; |
193 |
$menu['inventory']['content']['monitor']['page']='/front/monitor.php'; |
194 |
$menu['inventory']['content']['monitor']['links']['search']='/front/monitor.php'; |
195 |
if (haveRight("monitor","w")){ |
196 |
$menu['inventory']['content']['monitor']['links']['add']='/front/setup.templates.php?type='.MONITOR_TYPE.'&add=1'; |
197 |
$menu['inventory']['content']['monitor']['links']['template']='/front/setup.templates.php?type='.MONITOR_TYPE.'&add=0'; |
198 |
} |
199 |
|
200 |
$showstate=true; |
201 |
} |
202 |
if (haveRight("software","r")){ |
203 |
$menu['inventory']['content']['software']['title']=$LANG["Menu"][4]; |
204 |
$menu['inventory']['content']['software']['shortcut']='s'; |
205 |
$menu['inventory']['content']['software']['page']='/front/software.php'; |
206 |
$menu['inventory']['content']['software']['links']['search']='/front/software.php'; |
207 |
if (haveRight("software","w")){ |
208 |
$menu['inventory']['content']['software']['links']['add']='/front/setup.templates.php?type='.SOFTWARE_TYPE.'&add=1'; |
209 |
$menu['inventory']['content']['software']['links']['template']='/front/setup.templates.php?type='.SOFTWARE_TYPE.'&add=0'; |
210 |
} |
211 |
|
212 |
$showstate=true; |
213 |
} |
214 |
if (haveRight("networking","r")){ |
215 |
$menu['inventory']['content']['networking']['title']=$LANG["Menu"][1]; |
216 |
$menu['inventory']['content']['networking']['shortcut']='n'; |
217 |
$menu['inventory']['content']['networking']['page']='/front/networking.php'; |
218 |
$menu['inventory']['content']['networking']['links']['search']='/front/networking.php'; |
219 |
if (haveRight("networking","w")){ |
220 |
$menu['inventory']['content']['networking']['links']['add']='/front/setup.templates.php?type='.NETWORKING_TYPE.'&add=1'; |
221 |
$menu['inventory']['content']['networking']['links']['template']='/front/setup.templates.php?type='.NETWORKING_TYPE.'&add=0'; |
222 |
} |
223 |
$showstate=true; |
224 |
} |
225 |
if (haveRight("peripheral","r")){ |
226 |
$menu['inventory']['content']['peripheral']['title']=$LANG["Menu"][16]; |
227 |
$menu['inventory']['content']['peripheral']['shortcut']='n'; |
228 |
$menu['inventory']['content']['peripheral']['page']='/front/peripheral.php'; |
229 |
$menu['inventory']['content']['peripheral']['links']['search']='/front/peripheral.php'; |
230 |
if (haveRight("peripheral","w")){ |
231 |
$menu['inventory']['content']['peripheral']['links']['add']='/front/setup.templates.php?type='.PERIPHERAL_TYPE.'&add=1'; |
232 |
$menu['inventory']['content']['peripheral']['links']['template']='/front/setup.templates.php?type='.PERIPHERAL_TYPE.'&add=0'; |
233 |
} |
234 |
$showstate=true; |
235 |
} |
236 |
if (haveRight("printer","r")){ |
237 |
$menu['inventory']['content']['printer']['title']=$LANG["Menu"][2]; |
238 |
$menu['inventory']['content']['printer']['shortcut']='p'; |
239 |
$menu['inventory']['content']['printer']['page']='/front/printer.php'; |
240 |
$menu['inventory']['content']['printer']['links']['search']='/front/printer.php'; |
241 |
if (haveRight("printer","w")){ |
242 |
$menu['inventory']['content']['printer']['links']['add']='/front/setup.templates.php?type='.PRINTER_TYPE.'&add=1'; |
243 |
$menu['inventory']['content']['printer']['links']['template']='/front/setup.templates.php?type='.PRINTER_TYPE.'&add=0'; |
244 |
} |
245 |
$showstate=true; |
246 |
} |
247 |
if (haveRight("cartridge","r")){ |
248 |
$menu['inventory']['content']['cartridge']['title']=$LANG["Menu"][21]; |
249 |
$menu['inventory']['content']['cartridge']['shortcut']='c'; |
250 |
$menu['inventory']['content']['cartridge']['page']='/front/cartridge.php'; |
251 |
$menu['inventory']['content']['cartridge']['links']['search']='/front/cartridge.php'; |
252 |
if (haveRight("cartridge","w")){ |
253 |
$menu['inventory']['content']['cartridge']['links']['add']='/front/cartridge.form.php'; |
254 |
} |
255 |
} |
256 |
if (haveRight("consumable","r")){ |
257 |
$menu['inventory']['content']['consumable']['title']=$LANG["Menu"][32]; |
258 |
$menu['inventory']['content']['consumable']['shortcut']='g'; |
259 |
$menu['inventory']['content']['consumable']['page']='/front/consumable.php'; |
260 |
$menu['inventory']['content']['consumable']['links']['search']='/front/consumable.php'; |
261 |
if (haveRight("consumable","w")){ |
262 |
$menu['inventory']['content']['consumable']['links']['add']='/front/consumable.form.php'; |
263 |
} |
264 |
$menu['inventory']['content']['consumable']['links']['summary']='/front/consumable.php?synthese=yes'; |
265 |
} |
266 |
if (haveRight("phone","r")){ |
267 |
$menu['inventory']['content']['phone']['title']=$LANG["Menu"][34]; |
268 |
$menu['inventory']['content']['phone']['shortcut']='t'; |
269 |
$menu['inventory']['content']['phone']['page']='/front/phone.php'; |
270 |
$menu['inventory']['content']['phone']['links']['search']='/front/phone.php'; |
271 |
if (haveRight("phone","w")){ |
272 |
$menu['inventory']['content']['phone']['links']['add']='/front/setup.templates.php?type='.PHONE_TYPE.'&add=1'; |
273 |
$menu['inventory']['content']['phone']['links']['template']='/front/setup.templates.php?type='.PHONE_TYPE.'&add=0'; |
274 |
} |
275 |
$showstate=true; |
276 |
} |
277 |
if ($showstate){ |
278 |
$menu['inventory']['content']['state']['title']=$LANG["Menu"][28]; |
279 |
$menu['inventory']['content']['state']['shortcut']='n'; |
280 |
$menu['inventory']['content']['state']['page']='/front/state.php'; |
281 |
$menu['inventory']['content']['state']['links']['search']='/front/state.php'; |
282 |
$menu['inventory']['content']['state']['links']['summary']='/front/state.php?synthese=yes'; |
283 |
} |
284 |
|
285 |
|
286 |
//////// ASSISTANCE
|
287 |
$menu['maintain']['title']=$LANG["title"][24]; |
288 |
|
289 |
if (haveRight("observe_ticket","1")||haveRight("show_all_ticket","1")||haveRight("create_ticket","1")){ |
290 |
$menu['maintain']['default']='/front/tracking.php'; |
291 |
|
292 |
$menu['maintain']['content']['tracking']['title']=$LANG["Menu"][5]; |
293 |
$menu['maintain']['content']['tracking']['shortcut']='t'; |
294 |
$menu['maintain']['content']['tracking']['page']='/front/tracking.php'; |
295 |
$menu['maintain']['content']['tracking']['links']['search']='/front/tracking.php'; |
296 |
|
297 |
$menu['maintain']['content']['helpdesk']['links']['search']='/front/tracking.php'; |
298 |
|
299 |
} |
300 |
if (haveRight("create_ticket","1")){ |
301 |
$menu['maintain']['content']['helpdesk']['title']=$LANG["Menu"][31]; |
302 |
$menu['maintain']['content']['helpdesk']['shortcut']='h'; |
303 |
$menu['maintain']['content']['helpdesk']['page']='/front/helpdesk.php'; |
304 |
$menu['maintain']['content']['helpdesk']['links']['add']='/front/helpdesk.php'; |
305 |
|
306 |
$menu['maintain']['content']['tracking']['links']['add']='/front/helpdesk.php'; |
307 |
} |
308 |
if (haveRight("show_planning","1")||haveRight("show_all_planning","1")){ |
309 |
$menu['maintain']['content']['planning']['title']=$LANG["Menu"][29]; |
310 |
$menu['maintain']['content']['planning']['shortcut']='l'; |
311 |
$menu['maintain']['content']['planning']['page']='/front/planning.php'; |
312 |
$menu['maintain']['content']['planning']['links']['search']='/front/planning.php'; |
313 |
|
314 |
} |
315 |
if (haveRight("statistic","1")){ |
316 |
$menu['maintain']['content']['stat']['title']=$LANG["Menu"][13]; |
317 |
$menu['maintain']['content']['stat']['shortcut']='1'; |
318 |
$menu['maintain']['content']['stat']['page']='/front/stat.php'; |
319 |
} |
320 |
|
321 |
|
322 |
//////// FINANCIAL
|
323 |
$menu['financial']['title']=$LANG["Menu"][26]; |
324 |
if (haveRight("contact_enterprise","r")){ |
325 |
$menu['financial']['default']='/front/contact.php'; |
326 |
|
327 |
$menu['financial']['content']['contact']['title']=$LANG["Menu"][22]; |
328 |
$menu['financial']['content']['contact']['shortcut']='t'; |
329 |
$menu['financial']['content']['contact']['page']='/front/contact.php'; |
330 |
$menu['financial']['content']['contact']['links']['search']='/front/contact.php'; |
331 |
|
332 |
$menu['financial']['content']['enterprise']['title']=$LANG["Menu"][23]; |
333 |
$menu['financial']['content']['enterprise']['shortcut']='e'; |
334 |
$menu['financial']['content']['enterprise']['page']='/front/enterprise.php'; |
335 |
$menu['financial']['content']['enterprise']['links']['search']='/front/enterprise.php'; |
336 |
|
337 |
if (haveRight("contact_enterprise","w")){ |
338 |
$menu['financial']['content']['contact']['links']['add']='/front/contact.form.php'; |
339 |
$menu['financial']['content']['enterprise']['links']['add']='/front/enterprise.form.php'; |
340 |
} |
341 |
|
342 |
} |
343 |
if (haveRight("contract_infocom","r")){ |
344 |
$menu['financial']['content']['contract']['title']=$LANG["Menu"][25]; |
345 |
$menu['financial']['content']['contract']['shortcut']='n'; |
346 |
$menu['financial']['content']['contract']['page']='/front/contract.php'; |
347 |
$menu['financial']['content']['contract']['links']['search']='/front/contract.php'; |
348 |
|
349 |
if (haveRight("contract_infocom","w")){ |
350 |
$menu['financial']['content']['contract']['links']['add']='/front/contract.form.php'; |
351 |
} |
352 |
|
353 |
} |
354 |
if (haveRight("document","r")){ |
355 |
$menu['financial']['content']['document']['title']=$LANG["Menu"][27]; |
356 |
$menu['financial']['content']['document']['shortcut']='d'; |
357 |
$menu['financial']['content']['document']['page']='/front/document.php'; |
358 |
$menu['financial']['content']['document']['links']['search']='/front/document.php'; |
359 |
|
360 |
if (haveRight("document","w")){ |
361 |
$menu['financial']['content']['document']['links']['add']='/front/document.form.php'; |
362 |
} |
363 |
} |
364 |
|
365 |
//////// UTILS
|
366 |
$menu['utils']['title']=$LANG["Menu"][18]; |
367 |
$menu['utils']['default']='/front/reminder.php'; |
368 |
|
369 |
$menu['utils']['content']['reminder']['title']=$LANG["title"][37]; |
370 |
$menu['utils']['content']['reminder']['page']='/front/reminder.php'; |
371 |
$menu['utils']['content']['reminder']['links']['search']='/front/reminder.php'; |
372 |
$menu['utils']['content']['reminder']['links']['add']='/front/reminder.form.php'; |
373 |
|
374 |
if (haveRight("knowbase","r")||haveRight("faq","r")) { |
375 |
|
376 |
$menu['utils']['content']['knowbase']['title']=$LANG["Menu"][19]; |
377 |
$menu['utils']['content']['knowbase']['page']='/front/knowbase.php'; |
378 |
$menu['utils']['content']['knowbase']['links']['search']='/front/knowbase.php'; |
379 |
|
380 |
if (haveRight("knowbase","w")||haveRight("faq","w")){ |
381 |
$menu['utils']['content']['knowbase']['links']['add']='/front/knowbase.form.php?ID=new'; |
382 |
} |
383 |
|
384 |
} |
385 |
if (haveRight("reservation_helpdesk","1")||haveRight("reservation_central","r")){ |
386 |
$menu['utils']['content']['reservation']['title']=$LANG["Menu"][17]; |
387 |
$menu['utils']['content']['reservation']['page']='/front/reservation.php'; |
388 |
$menu['utils']['content']['reservation']['links']['search']='/front/reservation.php'; |
389 |
$menu['utils']['content']['reservation']['links']['showall']='/front/reservation.php?show=resa&ID'; |
390 |
} |
391 |
if (haveRight("reservation_helpdesk","1")||haveRight("reservation_central","r")){ |
392 |
$menu['utils']['content']['reservation']['title']=$LANG["Menu"][17]; |
393 |
$menu['utils']['content']['reservation']['page']='/front/reservation.php'; |
394 |
$menu['utils']['content']['reservation']['links']['search']='/front/reservation.php'; |
395 |
$menu['utils']['content']['reservation']['links']['showall']='/front/reservation.php?show=resa&ID'; |
396 |
} |
397 |
if (haveRight("reports","r")){ |
398 |
$menu['utils']['content']['report']['title']=$LANG["Menu"][6]; |
399 |
$menu['utils']['content']['report']['page']='/front/report.php'; |
400 |
} |
401 |
|
402 |
if ($CFG_GLPI["ocs_mode"]&&haveRight("ocsng","w")){ |
403 |
$menu['utils']['content']['ocsng']['title']=$LANG["Menu"][33]; |
404 |
$menu['utils']['content']['ocsng']['page']='/front/ocsng.php'; |
405 |
// $menu['utils']['content']['ocsng']['links']['search']='/front/ocsng.php';
|
406 |
} |
407 |
|
408 |
// PLUGINS
|
409 |
if (isset($PLUGIN_HOOKS["menu_entry"])&&count($PLUGIN_HOOKS["menu_entry"])){ |
410 |
$menu['plugins']['title']=$LANG["common"][29]; |
411 |
|
412 |
$plugins=array(); |
413 |
|
414 |
foreach ($PLUGIN_HOOKS["menu_entry"] as $plugin => $active) { |
415 |
if ($active){ |
416 |
$function="plugin_version_$plugin"; |
417 |
|
418 |
if (function_exists($function)) |
419 |
$plugins[$plugin]=$function(); |
420 |
} |
421 |
} |
422 |
if (count($plugins)){ |
423 |
$list=array(); |
424 |
foreach ($plugins as $key => $val) { |
425 |
$list[$key]=$val["name"]; |
426 |
} |
427 |
|
428 |
asort($list); |
429 |
foreach ($list as $key => $val) { |
430 |
$menu['plugins']['content'][$key]['title']=$val; |
431 |
$menu['plugins']['content'][$key]['page']='/plugins/'.$key.'/'; |
432 |
if ($sector=="plugins"&&$item==$key){ |
433 |
if (isset($PLUGIN_HOOKS["submenu_entry"][$key])&&is_array($PLUGIN_HOOKS["submenu_entry"][$key])){ |
434 |
foreach ($PLUGIN_HOOKS["submenu_entry"][$key] as $name => $link){ |
435 |
if (is_array($link)) |
436 |
{ |
437 |
if (isset($link[$option])) |
438 |
$menu['plugins']['content'][$key]['links'][$name]='/plugins/'.$key.'/'.$link[$option]; |
439 |
} |
440 |
else
|
441 |
$menu['plugins']['content'][$key]['links'][$name]='/plugins/'.$key.'/'.$link; |
442 |
} |
443 |
} |
444 |
} |
445 |
} |
446 |
|
447 |
} |
448 |
|
449 |
} |
450 |
//////// ADMINISTRATION
|
451 |
$menu['admin']['title']=$LANG["Menu"][15]; |
452 |
|
453 |
if (haveRight("user","r")){ |
454 |
$menu['admin']['default']='/front/user.php'; |
455 |
|
456 |
$menu['admin']['content']['user']['title']=$LANG["Menu"][14]; |
457 |
$menu['admin']['content']['user']['shortcut']='u'; |
458 |
$menu['admin']['content']['user']['page']='/front/user.php'; |
459 |
$menu['admin']['content']['user']['links']['search']='/front/user.php'; |
460 |
|
461 |
if (haveRight("user","w")){ |
462 |
$menu['admin']['content']['user']['links']['add']="/front/user.form.php"; |
463 |
} |
464 |
|
465 |
switch($option){ |
466 |
case 'ldap' : |
467 |
$menu['admin']['content']['user']['links']['showall']="/front/ldap.php"; |
468 |
break;
|
469 |
|
470 |
} |
471 |
|
472 |
} |
473 |
if (haveRight("group","r")){ |
474 |
$menu['admin']['content']['group']['title']=$LANG["Menu"][36]; |
475 |
$menu['admin']['content']['group']['shortcut']='g'; |
476 |
$menu['admin']['content']['group']['page']='/front/group.php'; |
477 |
$menu['admin']['content']['group']['links']['search']='/front/group.php'; |
478 |
|
479 |
if (haveRight("group","w")){ |
480 |
$menu['admin']['content']['group']['links']['add']="/front/group.form.php"; |
481 |
} |
482 |
|
483 |
} |
484 |
|
485 |
if (haveRight("entity","r")){ |
486 |
$menu['admin']['content']['entity']['title']=$LANG["Menu"][37]; |
487 |
$menu['admin']['content']['entity']['shortcut']='z'; |
488 |
$menu['admin']['content']['entity']['page']='/front/entity.php'; |
489 |
$menu['admin']['content']['entity']['links']['search']='/front/entity.php'; |
490 |
|
491 |
//$menu['admin']['content']['entity']['links'][$LANG["entity"][2]]="/front/entity.form.php?ID=0";
|
492 |
$menu['admin']['content']['entity']['links']['add']="/front/entity.tree.php"; |
493 |
} |
494 |
|
495 |
if (haveRight("rule_ldap","r")||haveRight("rule_ocs","r")||haveRight("rule_tracking","r")|| haveRight("rule_softwarecategories","r")){ |
496 |
$menu['admin']['content']['rule']['title']=$LANG["rulesengine"][17]; |
497 |
$menu['admin']['content']['rule']['shortcut']='r'; |
498 |
$menu['admin']['content']['rule']['page']='/front/rule.php'; |
499 |
switch($option){ |
500 |
case RULE_OCS_AFFECT_COMPUTER : |
501 |
$menu['admin']['content']['rule']['links']['search']='/front/rule.ocs.php'; |
502 |
$menu['admin']['content']['rule']['links']['add']='/front/rule.ocs.form.php'; |
503 |
break;
|
504 |
case RULE_AFFECT_RIGHTS : |
505 |
$menu['admin']['content']['rule']['links']['search']='/front/rule.right.php'; |
506 |
$menu['admin']['content']['rule']['links']['add']='/front/rule.right.form.php'; |
507 |
break;
|
508 |
case RULE_TRACKING_AUTO_ACTION : |
509 |
$menu['admin']['content']['rule']['links']['search']='/front/rule.tracking.php'; |
510 |
$menu['admin']['content']['rule']['links']['add']='/front/rule.tracking.form.php'; |
511 |
break;
|
512 |
case RULE_SOFTWARE_CATEGORY : |
513 |
$menu['admin']['content']['rule']['links']['search']='/front/rule.softwarecategories.php'; |
514 |
$menu['admin']['content']['rule']['links']['add']='/front/rule.softwarecategories.form.php'; |
515 |
break;
|
516 |
} |
517 |
} |
518 |
|
519 |
if (haveRight("rule_dictionnary_manufacturer","r") || haveRight("rule_dictionnary_software","r") || |
520 |
haveRight("rule_dictionnary_model","r") || haveRight("rule_dictionnary_type","r")|| |
521 |
haveRight("rule_dictionnary_os","r")){ |
522 |
$menu['admin']['content']['dictionnary']['title']=$LANG["rulesengine"][77]; |
523 |
$menu['admin']['content']['dictionnary']['shortcut']='r'; |
524 |
$menu['admin']['content']['dictionnary']['page']='/front/dictionnary.php'; |
525 |
switch($option){ |
526 |
case RULE_DICTIONNARY_MANUFACTURER : |
527 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.manufacturer.php'; |
528 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.manufacturer.form.php'; |
529 |
break;
|
530 |
case RULE_DICTIONNARY_SOFTWARE : |
531 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.software.php'; |
532 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.software.form.php'; |
533 |
break;
|
534 |
case RULE_DICTIONNARY_MODEL_COMPUTER : |
535 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.model.computer.php'; |
536 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.model.computer.form.php'; |
537 |
break;
|
538 |
case RULE_DICTIONNARY_MODEL_MONITOR : |
539 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.model.monitor.php'; |
540 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.model.monitor.form.php'; |
541 |
break;
|
542 |
case RULE_DICTIONNARY_MODEL_PRINTER : |
543 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.model.printer.php'; |
544 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.model.printer.form.php'; |
545 |
break;
|
546 |
case RULE_DICTIONNARY_MODEL_PERIPHERAL : |
547 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.model.peripheral.php'; |
548 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.model.peripheral.form.php'; |
549 |
break;
|
550 |
case RULE_DICTIONNARY_MODEL_NETWORKING : |
551 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.model.networking.php'; |
552 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.model.networking.form.php'; |
553 |
break;
|
554 |
case RULE_DICTIONNARY_MODEL_PHONE : |
555 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.model.phone.php'; |
556 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.model.phone.form.php'; |
557 |
break;
|
558 |
case RULE_DICTIONNARY_TYPE_COMPUTER : |
559 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.type.computer.php'; |
560 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.type.computer.form.php'; |
561 |
break;
|
562 |
case RULE_DICTIONNARY_TYPE_MONITOR : |
563 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.type.monitor.php'; |
564 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.type.monitor.form.php'; |
565 |
break;
|
566 |
case RULE_DICTIONNARY_TYPE_PRINTER : |
567 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.type.printer.php'; |
568 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.type.printer.form.php'; |
569 |
break;
|
570 |
case RULE_DICTIONNARY_TYPE_PERIPHERAL : |
571 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.type.peripheral.php'; |
572 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.type.peripheral.form.php'; |
573 |
break;
|
574 |
case RULE_DICTIONNARY_TYPE_NETWORKING : |
575 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.type.networking.php'; |
576 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.type.networking.form.php'; |
577 |
break;
|
578 |
case RULE_DICTIONNARY_TYPE_PHONE : |
579 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.type.phone.php'; |
580 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.type.phone.form.php'; |
581 |
break;
|
582 |
case RULE_DICTIONNARY_OS : |
583 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.os.php'; |
584 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.os.form.php'; |
585 |
break;
|
586 |
case RULE_DICTIONNARY_OS_SP : |
587 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.os_sp.php'; |
588 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.os_sp.form.php'; |
589 |
break;
|
590 |
case RULE_DICTIONNARY_OS_VERSION : |
591 |
$menu['admin']['content']['dictionnary']['links']['search']='/front/rule.dictionnary.os_version.php'; |
592 |
$menu['admin']['content']['dictionnary']['links']['add']='/front/rule.dictionnary.os_version.form.php'; |
593 |
break;
|
594 |
} |
595 |
} |
596 |
|
597 |
|
598 |
if (haveRight("profile","r")){ |
599 |
$menu['admin']['content']['profile']['title']=$LANG["Menu"][35]; |
600 |
$menu['admin']['content']['profile']['shortcut']='p'; |
601 |
$menu['admin']['content']['profile']['page']='/front/profile.php'; |
602 |
$menu['admin']['content']['profile']['links']['search']="/front/profile.php"; |
603 |
if (haveRight("profile","w")){ |
604 |
$menu['admin']['content']['profile']['links']['add']="/front/profile.form.php"; |
605 |
} |
606 |
|
607 |
} |
608 |
|
609 |
if (haveRight("transfer","r")&&isMultiEntitiesMode()){ |
610 |
$menu['admin']['content']['transfer']['title']=$LANG["transfer"][1]; |
611 |
$menu['admin']['content']['transfer']['shortcut']='t'; |
612 |
$menu['admin']['content']['transfer']['page']='/front/transfer.php'; |
613 |
$menu['admin']['content']['transfer']['links']['search']="/front/transfer.php"; |
614 |
if (haveRight("transfer","w")){ |
615 |
$menu['admin']['content']['transfer']['links']['summary']="/front/transfer.action.php"; |
616 |
$menu['admin']['content']['transfer']['links']['add']="/front/transfer.form.php"; |
617 |
} |
618 |
} |
619 |
|
620 |
// $config[$LANG["common"][12]]=array("setup.php","2");
|
621 |
if (haveRight("backup","w")){ |
622 |
$menu['admin']['content']['backup']['title']=$LANG["Menu"][12]; |
623 |
$menu['admin']['content']['backup']['shortcut']='b'; |
624 |
$menu['admin']['content']['backup']['page']='/front/backup.php'; |
625 |
} |
626 |
if (haveRight("logs","r")){ |
627 |
$menu['admin']['content']['log']['title']=$LANG["Menu"][30]; |
628 |
$menu['admin']['content']['log']['shortcut']='l'; |
629 |
$menu['admin']['content']['log']['page']='/front/log.php'; |
630 |
} |
631 |
|
632 |
|
633 |
// CONFIG
|
634 |
$config=array(); |
635 |
$addconfig=array(); |
636 |
$menu['config']['title']=$LANG["common"][12]; |
637 |
$menu['config']['default']='/front/setup.php'; |
638 |
|
639 |
if (haveRight("dropdown","w")||haveRight("entity_dropdown","w")){ |
640 |
$menu['config']['content']['dropdowns']['title']=$LANG["setup"][0]; |
641 |
$menu['config']['content']['dropdowns']['page']='/front/setup.dropdowns.php'; |
642 |
} |
643 |
if (haveRight("device","w")){ |
644 |
$menu['config']['content']['device']['title']=$LANG["title"][30]; |
645 |
$menu['config']['content']['device']['page']='/front/device.php'; |
646 |
} |
647 |
|
648 |
if (haveRight("config","w")){ |
649 |
$menu['config']['content']['config']['title']=$LANG["setup"][703]; |
650 |
$menu['config']['content']['config']['page']='/front/setup.config.php'; |
651 |
|
652 |
$menu['config']['content']['mailing']['title']=$LANG["setup"][704]; |
653 |
$menu['config']['content']['mailing']['page']='/front/setup.mailing.php'; |
654 |
|
655 |
$menu['config']['content']['extauth']['title']=$LANG["login"][10]; |
656 |
$menu['config']['content']['extauth']['page']='/front/setup.auth.php'; |
657 |
$menu['config']['content']['extauth']['links']['search']='/front/setup.auth.php'; |
658 |
switch ($option){ |
659 |
case 1 : // LDAP |
660 |
$menu['config']['content']['extauth']['links']['add']='/front/setup.auth.php?next=extauth_ldap'; |
661 |
break;
|
662 |
case 2 : // IMAP |
663 |
$menu['config']['content']['extauth']['links']['add']='/front/setup.auth.php?next=extauth_mail'; |
664 |
break;
|
665 |
} |
666 |
|
667 |
$menu['config']['content']['mailgate']['title']=$LANG["Menu"][39]; |
668 |
$menu['config']['content']['mailgate']['page']='/front/mailgate.php'; |
669 |
$menu['config']['content']['mailgate']['links']['search']='/front/mailgate.php'; |
670 |
$menu['config']['content']['mailgate']['links']['add']='/front/mailgate.form.php'; |
671 |
|
672 |
} |
673 |
|
674 |
if ($CFG_GLPI["ocs_mode"]&&haveRight("config","w")){ |
675 |
$menu['config']['content']['ocsng']['title']=$LANG["setup"][134]; |
676 |
$menu['config']['content']['ocsng']['page']='/front/setup.ocsng.php'; |
677 |
$menu['config']['content']['ocsng']['links']['search']='/front/setup.ocsng.php'; |
678 |
$menu['config']['content']['ocsng']['links']['add']='/front/setup.templates.php?type='.OCSNG_TYPE.'&add=1'; |
679 |
$menu['config']['content']['ocsng']['links']['template']='/front/setup.templates.php?type='.OCSNG_TYPE.'&add=0'; |
680 |
} |
681 |
|
682 |
if (haveRight("typedoc","r")){ |
683 |
$menu['config']['content']['typedoc']['title']=$LANG["document"][7]; |
684 |
$menu['config']['content']['typedoc']['page']='/front/typedoc.php'; |
685 |
$menu['config']['content']['typedoc']['hide']=true; |
686 |
$menu['config']['content']['typedoc']['links']['search']='/front/typedoc.php'; |
687 |
|
688 |
if (haveRight("typedoc","w")){ |
689 |
$menu['config']['content']['typedoc']['links']['add']="/front/typedoc.form.php"; |
690 |
} |
691 |
|
692 |
} |
693 |
if (haveRight("link","r")){ |
694 |
$menu['config']['content']['link']['title']=$LANG["title"][33]; |
695 |
$menu['config']['content']['link']['page']='/front/link.php'; |
696 |
$menu['config']['content']['link']['hide']=true; |
697 |
$menu['config']['content']['link']['links']['search']='/front/link.php'; |
698 |
|
699 |
if (haveRight("link","w")){ |
700 |
$menu['config']['content']['link']['links']['add']="/front/link.form.php"; |
701 |
} |
702 |
|
703 |
} |
704 |
|
705 |
|
706 |
if (isset($PLUGIN_HOOKS['config_page'])&&is_array($PLUGIN_HOOKS['config_page'])&&count($PLUGIN_HOOKS['config_page'])) { |
707 |
$menu['config']['content']['plugins']['title']=$LANG["common"][29]; |
708 |
$menu['config']['content']['plugins']['page']='/front/setup.plugins.php'; |
709 |
} |
710 |
echo "<div id='header'>"; |
711 |
echo "<div id='c_logo' ><a href='".$CFG_GLPI["root_doc"]."/front/central.php' title=\"".$LANG["central"][5]."\"></a></div>"; |
712 |
|
713 |
// Les préférences + lien déconnexion
|
714 |
echo "<div id='c_preference' >"; |
715 |
echo "<ul><li id='deconnexion'><a href=\"".$CFG_GLPI["root_doc"]."/logout.php"; |
716 |
// logout witour noAuto login for extauth
|
717 |
if (isset($_SESSION['glpiextauth'])&&$_SESSION['glpiextauth']){ |
718 |
echo "?noAUTO=1"; |
719 |
} |
720 |
echo "\" title=\"".$LANG["central"][6]."\">".$LANG["central"][6]." </a>"; |
721 |
|
722 |
echo "("; |
723 |
echo formatUserName (0,$_SESSION["glpiname"],$_SESSION["glpirealname"],$_SESSION["glpifirstname"],0,20); |
724 |
echo ")</li>\n"; |
725 |
|
726 |
echo " <li><a href='".(empty($CFG_GLPI["centralhelp_url"])?"http://glpi-project.org/help-central":$CFG_GLPI["centralhelp_url"])."' target='_blank' title='".$LANG["central"][7]."'> ".$LANG["central"][7]."</a></li>\n"; |
727 |
|
728 |
echo " <li> <a href=\"".$CFG_GLPI["root_doc"]."/front/user.form.my.php\" title=\"".$LANG["Menu"][11]."\" >".$LANG["Menu"][11]." </a></li>\n"; |
729 |
echo "</ul>\n"; |
730 |
echo "<div class='sep'></div>\n"; |
731 |
echo "</div>\n"; |
732 |
|
733 |
//-- Le moteur de recherche -->
|
734 |
echo "<div id='c_recherche' >\n"; |
735 |
|
736 |
echo "<form method='get' action='".$CFG_GLPI["root_doc"]."/front/search.php'>\n"; |
737 |
echo " <div id='boutonRecherche'><input type='image' src='".$CFG_GLPI["root_doc"]."/pics/ok2.png' value='OK' title=\"".$LANG["buttons"][2]."\" alt=\"".$LANG["buttons"][2]."\" ></div>\n"; |
738 |
echo " <div id='champRecherche'><input size='15' type='text' name='globalsearch' value='".$LANG["buttons"][0]."' onfocus=\"this.value='';\" ></div> \n"; |
739 |
|
740 |
echo "</form>\n"; |
741 |
|
742 |
echo "<div class='sep'></div>\n"; |
743 |
echo "</div>"; |
744 |
|
745 |
//<!-- Le menu principal -->
|
746 |
echo "<div id='c_menu'>"; |
747 |
echo " <ul id='menu'>"; |
748 |
|
749 |
|
750 |
// Get object-variables and build the navigation-elements
|
751 |
$i=1; |
752 |
foreach ($menu as $part => $data){ |
753 |
if (isset($data['content'])&&count($data['content'])){ |
754 |
echo " <li id='menu$i' onmouseover=\"javascript:menuAff('menu$i','menu');\" >"; |
755 |
|
756 |
$link="#"; |
757 |
if (isset($data['default'])&&!empty($data['default'])){ |
758 |
$link=$CFG_GLPI["root_doc"].$data['default']; |
759 |
} |
760 |
if (strlen($data['title'])>14){ |
761 |
$data['title']=utf8_substr($data['title'],0,14)."..."; |
762 |
} |
763 |
|
764 |
echo "<a href=\"$link\" class='itemP'>".$data['title']."</a>"; |
765 |
echo "<ul class='ssmenu'>"; |
766 |
// list menu item
|
767 |
foreach ($data['content'] as $key => $val) { |
768 |
if (isset($val['page'])&&isset($val['title'])){ |
769 |
echo "<li><a href=\"".$CFG_GLPI["root_doc"].$val['page']."\""; |
770 |
if (isset($data['shortcut'])&&!empty($data['shortcut'])){ |
771 |
echo " accesskey=\"".$val['shortcut']."\" "; |
772 |
} |
773 |
|
774 |
echo ">".$val['title']."</a></li>\n"; |
775 |
} |
776 |
} |
777 |
|
778 |
echo "</ul>"; |
779 |
echo "</li>"; |
780 |
|
781 |
$i++;
|
782 |
} |
783 |
} |
784 |
|
785 |
echo "</ul>"; |
786 |
echo "<div class='sep'></div>"; |
787 |
echo "</div>"; |
788 |
|
789 |
// End navigation bar
|
790 |
|
791 |
// End headline
|
792 |
|
793 |
// Le sous menu contextuel 1
|
794 |
echo "<div id='c_ssmenu1' >"; |
795 |
echo "<ul>"; |
796 |
// list sous-menu item
|
797 |
if (isset($menu[$sector])){ |
798 |
if (isset($menu[$sector]['content'])&&is_array($menu[$sector]['content'])){ |
799 |
|
800 |
$ssmenu=$menu[$sector]['content']; |
801 |
if (count($ssmenu)>12){ |
802 |
foreach ($ssmenu as $key => $val){ |
803 |
if (isset($val['hide'])){ |
804 |
unset($ssmenu[$key]); |
805 |
} |
806 |
} |
807 |
$ssmenu=array_splice($ssmenu,0,12); |
808 |
} |
809 |
|
810 |
foreach ($ssmenu as $key => $val) { |
811 |
if (isset($val['page'])&&isset($val['title'])){ |
812 |
echo "<li><a href=\"".$CFG_GLPI["root_doc"].$val['page']."\" "; |
813 |
if (isset($val['shortcut'])&&!empty($val['shortcut'])){ |
814 |
echo " accesskey=\"".$val['shortcut']."\""; |
815 |
} |
816 |
echo ">".$val['title']."</a></li>\n"; |
817 |
} |
818 |
} |
819 |
} else echo "<li> </li>"; |
820 |
} else echo "<li> </li>"; |
821 |
echo "</ul>"; |
822 |
echo "</div>"; |
823 |
|
824 |
// Le fil d arianne
|
825 |
echo "<div id='c_ssmenu2' >"; |
826 |
echo "<ul>"; |
827 |
|
828 |
// Display item
|
829 |
echo " <li><a href='".$CFG_GLPI["root_doc"]."/front/central.php' title='".$LANG["common"][56]."' >".$LANG["common"][56]." </a> ></li>"; |
830 |
|
831 |
if (isset($menu[$sector])){ |
832 |
$link="/front/central.php"; |
833 |
if (isset($menu[$sector]['default'])){ |
834 |
$link=$menu[$sector]['default']; |
835 |
} |
836 |
echo " <li><a href='".$CFG_GLPI["root_doc"].$link."' title='".$menu[$sector]['title']."' >".$menu[$sector]['title']." </a> > </li>"; |
837 |
} |
838 |
|
839 |
if (isset($menu[$sector]['content'][$item])){ |
840 |
// Title
|
841 |
echo " <li><a href='".$CFG_GLPI["root_doc"].$menu[$sector]['content'][$item]['page']."' class='here' title='".$menu[$sector]['content'][$item]['title']."' >".$menu[$sector]['content'][$item]['title']." </a></li>"; |
842 |
echo "<li> </li>"; |
843 |
|
844 |
// Add item
|
845 |
echo "<li>"; |
846 |
if (isset($menu[$sector]['content'][$item]['links']['add'])){ |
847 |
echo "<a href='".$CFG_GLPI["root_doc"].$menu[$sector]['content'][$item]['links']['add']."'><img src='".$CFG_GLPI["root_doc"]."/pics/menu_add.png' title='".$LANG["buttons"][8]."' alt='".$LANG["buttons"][8]."'></a>"; |
848 |
} else {
|
849 |
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/menu_add_off.png' title='".$LANG["buttons"][8]."' alt='".$LANG["buttons"][8]."'>"; |
850 |
} |
851 |
echo "</li>"; |
852 |
// Search Item
|
853 |
if (isset($menu[$sector]['content'][$item]['links']['search'])){ |
854 |
echo "<li><a href='".$CFG_GLPI["root_doc"].$menu[$sector]['content'][$item]['links']['search']."' ><img src='".$CFG_GLPI["root_doc"]."/pics/menu_search.png' title='".$LANG["buttons"][0]."' alt='".$LANG["buttons"][0]."'></a></li>"; |
855 |
} else {
|
856 |
echo "<li><img src='".$CFG_GLPI["root_doc"]."/pics/menu_search_off.png' title='".$LANG["buttons"][0]."' alt='".$LANG["buttons"][0]."'></li>"; |
857 |
} |
858 |
|
859 |
// Links
|
860 |
if (isset($menu[$sector]['content'][$item]['links'])&&is_array($menu[$sector]['content'][$item]['links'])){ |
861 |
foreach ($menu[$sector]['content'][$item]['links'] as $key => $val) { |
862 |
switch ($key){ |
863 |
case "add": |
864 |
case "search": |
865 |
break;
|
866 |
case "template": |
867 |
echo "<li><a href='".$CFG_GLPI["root_doc"].$val."' ><img title='".$LANG["common"][8]."' alt='".$LANG["common"][8]."' src='".$CFG_GLPI["root_doc"]."/pics/menu_addtemplate.png' > </a></li>"; |
868 |
break;
|
869 |
case "showall": |
870 |
echo "<li><a href='".$CFG_GLPI["root_doc"].$val."' ><img title='".$LANG["buttons"][40]."' alt='".$LANG["buttons"][40]."' src='".$CFG_GLPI["root_doc"]."/pics/menu_showall.png' > </a></li>"; |
871 |
break;
|
872 |
case "summary": |
873 |
echo "<li><a href='".$CFG_GLPI["root_doc"].$val."' ><img title='".$LANG["state"][11]."' alt='".$LANG["state"][11]."' src='".$CFG_GLPI["root_doc"]."/pics/menu_show.png' > </a></li>"; |
874 |
break;
|
875 |
case "config": |
876 |
echo "<li><a href='".$CFG_GLPI["root_doc"].$val."' ><img title='".$LANG["common"][12]."' alt='".$LANG["common"][12]."' src='".$CFG_GLPI["root_doc"]."/pics/menu_config.png' > </a></li>"; |
877 |
break;
|
878 |
|
879 |
default :
|
880 |
echo "<li><a href='".$CFG_GLPI["root_doc"].$val."' >".$key." </a></li>"; |
881 |
break;
|
882 |
} |
883 |
} |
884 |
} |
885 |
} else {
|
886 |
echo "<li> </li>"; |
887 |
echo "<li> </li>"; |
888 |
} |
889 |
// Add common items
|
890 |
echo "<li>"; |
891 |
|
892 |
// Display MENU ALL
|
893 |
echo "<div id='show_all_menu' onmouseover=\"completecleandisplay('show_all_menu');\">"; |
894 |
$items_per_columns=15; |
895 |
$i=-1; |
896 |
echo "<table><tr><td valign='top'><table>"; |
897 |
foreach ($menu as $part => $data){ |
898 |
if (isset($data['content'])&&count($data['content'])){ |
899 |
|
900 |
if ($i>$items_per_columns){ |
901 |
$i=0; |
902 |
echo "</table></td><td valign='top'><table>"; |
903 |
} |
904 |
$link="#"; |
905 |
if (isset($data['default'])&&!empty($data['default'])){ |
906 |
$link=$CFG_GLPI["root_doc"].$data['default']; |
907 |
} |
908 |
echo "<tr><td class='tab_bg_1'><strong><a href=\"$link\" title=\"".$data['title']."\" class='itemP'>".$data['title']."</a></strong></td></tr>"; |
909 |
$i++;
|
910 |
|
911 |
// list menu item
|
912 |
foreach ($data['content'] as $key => $val) { |
913 |
if ($i>$items_per_columns){ |
914 |
$i=0; |
915 |
echo "</table></td><td valign='top'><table>"; |
916 |
} |
917 |
if (isset($val['page'])&&isset($val['title'])){ |
918 |
echo "<tr><td><a href=\"".$CFG_GLPI["root_doc"].$val['page']."\""; |
919 |
if (isset($data['shortcut'])&&!empty($data['shortcut'])){ |
920 |
echo " accesskey=\"".$val['shortcut']."\" "; |
921 |
} |
922 |
|
923 |
echo ">".$val['title']."</a></td></tr>\n"; |
924 |
$i++;
|
925 |
} |
926 |
} |
927 |
} |
928 |
} |
929 |
echo "</table></td></tr></table>"; |
930 |
|
931 |
echo "</div>"; |
932 |
echo " "; |
933 |
echo "</li>"; |
934 |
|
935 |
// Bookmark load
|
936 |
echo "<li>"; |
937 |
echo " <a href='#' onClick=\"var w=window.open('".$CFG_GLPI["root_doc"]."/front/popup.php?popup=load_bookmark' ,'glpibookmarks', 'height=400, width=600, top=100, left=100, scrollbars=yes' );w.focus();\">"; |
938 |
echo " <img src='".$CFG_GLPI["root_doc"]."/pics/bookmark.png' title=\"".$LANG["buttons"][52]." ".$LANG["bookmark"][1]."\" alt=\"".$LANG["buttons"][52]." ".$LANG["bookmark"][1]."\" >"; |
939 |
echo " </a>"; |
940 |
echo "</li>"; |
941 |
|
942 |
|
943 |
/* echo "<li id='headercalendar'><img src='".$CFG_GLPI["root_doc"]."/pics/menu_calendar.png' alt='".$LANG["buttons"][15]."' title='".$LANG["buttons"][15]."'>";
|
944 |
|
945 |
echo "<script type='text/javascript'>";
|
946 |
echo "Calendar.setup(";
|
947 |
echo "{";
|
948 |
echo "ifFormat : '%Y-%m-%d',"; // the datetime format
|
949 |
echo "button : 'headercalendar' "; // ID of the button
|
950 |
echo "});";
|
951 |
echo "</script>";
|
952 |
echo "</li>";
|
953 |
*/
|
954 |
|
955 |
// MENU ALL
|
956 |
echo "<li >"; |
957 |
echo "<img alt='' src='".$CFG_GLPI["root_doc"]."/pics/menu_all.png' onclick=\"completecleandisplay('show_all_menu'); |
958 |
\">";
|
959 |
echo "</li>"; |
960 |
showProfileSelecter($CFG_GLPI["root_doc"]."/front/central.php"); |
961 |
echo "</ul>"; |
962 |
|
963 |
echo " </div>"; |
964 |
|
965 |
echo "</div>\n"; // fin header |
966 |
|
967 |
|
968 |
|
969 |
echo "<div id='page' >"; |
970 |
|
971 |
$CFG_GLPI["cache"]->end(); |
972 |
} |
973 |
|
974 |
if ($DB->isSlave() && !$DB->first_connection) |
975 |
{ |
976 |
echo "<div id='dbslave-float'>"; |
977 |
echo "<a href='#see_debug'>".$LANG["setup"][809]."</a>"; |
978 |
echo "</div>"; |
979 |
} |
980 |
|
981 |
// call function callcron() every 5min
|
982 |
if (isset($_SESSION["glpicrontimer"])){ |
983 |
if (abs(time()-$_SESSION["glpicrontimer"])>300){ |
984 |
callCron(); |
985 |
$_SESSION["glpicrontimer"]=time(); |
986 |
} |
987 |
} else $_SESSION["glpicrontimer"]=time(); |
988 |
|
989 |
displayMessageAfterRedirect(); |
990 |
} |
991 |
|
992 |
/**
|
993 |
* Display a div containing a message set in session in the previous page
|
994 |
*
|
995 |
*
|
996 |
**/
|
997 |
function displayMessageAfterRedirect(){ |
998 |
// Affichage du message apres redirection
|
999 |
if (isset($_SESSION["MESSAGE_AFTER_REDIRECT"])&&!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])){ |
1000 |
echo "<div class=\"box\" style=\"margin-bottom:20px;\">"; |
1001 |
echo "<div class=\"box-tleft\"><div class=\"box-tright\"><div class=\"box-tcenter\"></div></div></div>"; |
1002 |
echo "<div class=\"box-mleft\"><div class=\"box-mright\"><div class=\"box-mcenter\">"; |
1003 |
echo "<h3>".$_SESSION["MESSAGE_AFTER_REDIRECT"]."</h3>"; |
1004 |
echo "</div></div></div>"; |
1005 |
echo "<div class=\"box-bleft\"><div class=\"box-bright\"><div class=\"box-bcenter\"></div></div></div>"; |
1006 |
echo "</div>"; |
1007 |
|
1008 |
} |
1009 |
// Clean message
|
1010 |
$_SESSION["MESSAGE_AFTER_REDIRECT"]=""; |
1011 |
} |
1012 |
/**
|
1013 |
* Add a message to be displayed after redirect
|
1014 |
*
|
1015 |
* @param $msg Message to add
|
1016 |
* @param $check_once Check if the message is not already added
|
1017 |
**/
|
1018 |
function addMessageAfterRedirect($msg,$check_once=false){ |
1019 |
if (!empty($msg)){ |
1020 |
if ($check_once){ |
1021 |
if (strstr($_SESSION["MESSAGE_AFTER_REDIRECT"],$msg)===false){ |
1022 |
$_SESSION["MESSAGE_AFTER_REDIRECT"].=$msg.'<br>'; |
1023 |
} |
1024 |
} else {
|
1025 |
$_SESSION["MESSAGE_AFTER_REDIRECT"].=$msg.'<br>'; |
1026 |
} |
1027 |
} |
1028 |
} |
1029 |
|
1030 |
/**
|
1031 |
* Print a nice HTML head for help page
|
1032 |
*
|
1033 |
*
|
1034 |
* @param $title title of the page
|
1035 |
* @param $url not used anymore.
|
1036 |
**/
|
1037 |
function helpHeader($title,$url='') { |
1038 |
// Print a nice HTML-head for help page
|
1039 |
|
1040 |
global $CFG_GLPI,$LANG, $CFG_GLPI,$HEADER_LOADED,$PLUGIN_HOOKS ; |
1041 |
|
1042 |
if ($HEADER_LOADED) return; |
1043 |
$HEADER_LOADED=true; |
1044 |
|
1045 |
// Override list-limit if choosen
|
1046 |
if (isset($_POST['list_limit'])) { |
1047 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
1048 |
} |
1049 |
|
1050 |
|
1051 |
includeCommonHtmlHeader($title);
|
1052 |
|
1053 |
// Body
|
1054 |
echo "<body>"; |
1055 |
|
1056 |
// Main Headline
|
1057 |
echo "<div id='header'>"; |
1058 |
echo "<div id='c_logo' ><a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.public.php\" accesskey=\"0\" title=\"".$LANG["central"][5]."\"><span class='invisible'>Logo</span></a></div>"; |
1059 |
|
1060 |
// Les préférences + lien déconnexion
|
1061 |
echo "<div id='c_preference' >"; |
1062 |
echo" <ul><li id='deconnexion'><a href=\"".$CFG_GLPI["root_doc"]."/logout.php\" title=\"".$LANG["central"][6]."\">".$LANG["central"][6]." </a>"; |
1063 |
echo "("; |
1064 |
echo formatUserName (0,$_SESSION["glpiname"],$_SESSION["glpirealname"],$_SESSION["glpifirstname"],0,20); |
1065 |
echo ")</li>\n"; |
1066 |
|
1067 |
echo " <li><a href='".(empty($CFG_GLPI["helpdeskhelp_url"])?"http://glpi-project.org/help-helpdesk":$CFG_GLPI["helpdeskhelp_url"])."' target='_blank' title='".$LANG["central"][7]."'> ".$LANG["central"][7]."</a></li>\n"; |
1068 |
echo " <li> <a href=\"".$CFG_GLPI["root_doc"]."/front/user.form.my.php\" title=\"".$LANG["Menu"][11]."\" >".$LANG["Menu"][11]." </a></li>\n"; |
1069 |
|
1070 |
echo "</ul>\n"; |
1071 |
echo "<div class='sep'></div>\n"; |
1072 |
echo "</div>\n"; |
1073 |
//-- Le moteur de recherche -->
|
1074 |
echo "<div id='c_recherche' >\n"; |
1075 |
/*
|
1076 |
echo "<form id='recherche' action=''>\n";
|
1077 |
echo " <div id='boutonRecherche'><input type='submit' value='OK' /></div>\n";
|
1078 |
echo " <div id='champRecherche'><input type='text' value='Recherche' /></div> \n";
|
1079 |
echo "</form>\n";
|
1080 |
*/
|
1081 |
echo "<div class='sep'></div>\n"; |
1082 |
echo "</div>"; |
1083 |
|
1084 |
//<!-- Le menu principal -->
|
1085 |
echo "<div id='c_menu'>"; |
1086 |
echo " <ul id='menu'>"; |
1087 |
|
1088 |
|
1089 |
// Build the navigation-elements
|
1090 |
|
1091 |
// Ticket
|
1092 |
if (haveRight("create_ticket","1")){ |
1093 |
echo " <li id='menu1' >"; |
1094 |
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.public.php\" title=\"".$LANG["job"][13]."\" class='itemP'>".$LANG["Menu"][31]."</a>"; |
1095 |
|
1096 |
echo "</li>"; |
1097 |
} |
1098 |
|
1099 |
// Suivi ticket
|
1100 |
if (haveRight("observe_ticket","1")){ |
1101 |
echo " <li id='menu2' >"; |
1102 |
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.public.php?show=user\" title=\"".$LANG["title"][10]."\" class='itemP'>".$LANG["title"][28]."</a>"; |
1103 |
|
1104 |
echo "</li>"; |
1105 |
} |
1106 |
// Reservation
|
1107 |
if (haveRight("reservation_helpdesk","1")){ |
1108 |
echo " <li id='menu3' >"; |
1109 |
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.resa.php\" title=\"".$LANG["Menu"][17]."\" class='itemP'>".$LANG["Menu"][17]."</a>"; |
1110 |
|
1111 |
echo "</li>"; |
1112 |
} |
1113 |
|
1114 |
// FAQ
|
1115 |
if (haveRight("faq","r")){ |
1116 |
echo " <li id='menu4' >"; |
1117 |
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.faq.php\" title=\"".$LANG["knowbase"][1]."\" class='itemP'>".$LANG["Menu"][20]."</a>"; |
1118 |
|
1119 |
echo "</li>"; |
1120 |
} |
1121 |
|
1122 |
// PLUGINS
|
1123 |
$plugins=array(); |
1124 |
if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"])&&count($PLUGIN_HOOKS["helpdesk_menu_entry"])) |
1125 |
foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) { |
1126 |
if ($active){ |
1127 |
$function="plugin_version_$plugin"; |
1128 |
|
1129 |
if (function_exists($function)) |
1130 |
$plugins[$plugin]=$function(); |
1131 |
} |
1132 |
} |
1133 |
|
1134 |
if (isset($plugins)&&count($plugins)>0){ |
1135 |
$list=array(); |
1136 |
foreach ($plugins as $key => $val) { |
1137 |
$list[$key]=$val["name"]; |
1138 |
} |
1139 |
asort($list); |
1140 |
echo " <li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\" >"; |
1141 |
echo "<a href='#' title=\"".$LANG["common"][29]."\" class='itemP'>".$LANG["common"][29]."</a>"; // default none |
1142 |
echo "<ul class='ssmenu'>"; |
1143 |
// list menu item
|
1144 |
foreach ($list as $key => $val) { |
1145 |
echo "<li><a href=\"".$CFG_GLPI["root_doc"]."/plugins/".$key."/\">".$plugins[$key]["name"]."</a></li>\n"; |
1146 |
} |
1147 |
echo "</ul>"; |
1148 |
echo "</li>"; |
1149 |
} |
1150 |
|
1151 |
|
1152 |
echo "</ul>"; |
1153 |
echo "<div class='sep'></div>"; |
1154 |
echo "</div>"; |
1155 |
|
1156 |
// End navigation bar
|
1157 |
|
1158 |
// End headline
|
1159 |
|
1160 |
///Le sous menu contextuel 1
|
1161 |
echo "<div id='c_ssmenu1' >"; |
1162 |
//echo "<ul>";
|
1163 |
//echo " <li><a href='' title='' >Suivi</a></li>";
|
1164 |
//echo " <li>Planning</li>";
|
1165 |
//echo " <li>Statistique</li>";
|
1166 |
//echo " <li>Helpdesk</li>";
|
1167 |
//echo "</ul>";
|
1168 |
echo "</div>"; |
1169 |
|
1170 |
// Le fil d arianne
|
1171 |
echo "<div id='c_ssmenu2' >"; |
1172 |
echo "<ul>"; |
1173 |
echo " <li><a href='#' title='' >Helpdesk > </a></li>"; |
1174 |
showProfileSelecter($CFG_GLPI["root_doc"]."/front/helpdesk.public.php"); |
1175 |
echo "</ul>"; |
1176 |
echo " </div>"; |
1177 |
|
1178 |
echo "</div>\n"; // fin header |
1179 |
|
1180 |
echo "<div id='page' >"; |
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
// call function callcron() every 5min
|
1187 |
if (isset($_SESSION["glpicrontimer"])){ |
1188 |
if (($_SESSION["glpicrontimer"]-time())>300){ |
1189 |
callCron(); |
1190 |
$_SESSION["glpicrontimer"]=time(); |
1191 |
} |
1192 |
} else $_SESSION["glpicrontimer"]=time(); |
1193 |
|
1194 |
displayMessageAfterRedirect(); |
1195 |
} |
1196 |
|
1197 |
|
1198 |
/**
|
1199 |
* Print a simple HTML head with links
|
1200 |
*
|
1201 |
*
|
1202 |
* @param $title title of the page
|
1203 |
* @param $links links to display
|
1204 |
**/
|
1205 |
function simpleHeader($title,$links=array()) { |
1206 |
// Print a nice HTML-head for help page
|
1207 |
|
1208 |
global $CFG_GLPI,$LANG, $CFG_GLPI,$HEADER_LOADED ; |
1209 |
|
1210 |
if ($HEADER_LOADED) return; |
1211 |
$HEADER_LOADED=true; |
1212 |
|
1213 |
// Override list-limit if choosen
|
1214 |
if (isset($_POST['list_limit'])) { |
1215 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
1216 |
} |
1217 |
|
1218 |
includeCommonHtmlHeader($title);
|
1219 |
|
1220 |
// Body
|
1221 |
echo "<body>"; |
1222 |
|
1223 |
// Main Headline
|
1224 |
echo "<div id='header'>"; |
1225 |
echo "<div id='c_logo' ><a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.public.php\" accesskey=\"0\" title=\"".$LANG["central"][5]."\"><span class='invisible'>Logo</span></a></div>"; |
1226 |
|
1227 |
// Les préférences + lien déconnexion
|
1228 |
echo "<div id='c_preference' >"; |
1229 |
echo "<div class='sep'></div>\n"; |
1230 |
echo "</div>\n"; |
1231 |
//-- Le moteur de recherche -->
|
1232 |
echo "<div id='c_recherche' >\n"; |
1233 |
/*
|
1234 |
echo "<form id='recherche' action=''>\n";
|
1235 |
echo " <div id='boutonRecherche'><input type='submit' value='OK' /></div>\n";
|
1236 |
echo " <div id='champRecherche'><input type='text' value='Recherche' /></div> \n";
|
1237 |
echo "</form>\n";
|
1238 |
*/
|
1239 |
echo "<div class='sep'></div>\n"; |
1240 |
echo "</div>"; |
1241 |
|
1242 |
//<!-- Le menu principal -->
|
1243 |
echo "<div id='c_menu'>"; |
1244 |
echo " <ul id='menu'>"; |
1245 |
|
1246 |
// Build the navigation-elements
|
1247 |
if (count($links)){ |
1248 |
$i=1; |
1249 |
foreach ($links as $name => $link){ |
1250 |
echo " <li id='menu$i' >"; |
1251 |
echo "<a href=\"$link\" title=\"".$name."\" class='itemP'>".$name."</a>"; |
1252 |
echo "</li>"; |
1253 |
$i++;
|
1254 |
} |
1255 |
} |
1256 |
|
1257 |
echo "</ul>"; |
1258 |
echo "</div>"; |
1259 |
// End navigation bar
|
1260 |
|
1261 |
// End headline
|
1262 |
|
1263 |
///Le sous menu contextuel 1
|
1264 |
echo "<div id='c_ssmenu1' >"; |
1265 |
echo "</div>"; |
1266 |
|
1267 |
// Le fil d arianne
|
1268 |
echo "<div id='c_ssmenu2' >"; |
1269 |
echo " </div>"; |
1270 |
|
1271 |
echo "</div>\n"; // fin header |
1272 |
|
1273 |
echo "<div id='page' >"; |
1274 |
|
1275 |
// call function callcron() every 5min
|
1276 |
if (isset($_SESSION["glpicrontimer"])){ |
1277 |
if (($_SESSION["glpicrontimer"]-time())>300){ |
1278 |
callCron(); |
1279 |
$_SESSION["glpicrontimer"]=time(); |
1280 |
} |
1281 |
} else $_SESSION["glpicrontimer"]=time(); |
1282 |
|
1283 |
// displayMessageAfterRedirect();
|
1284 |
} |
1285 |
|
1286 |
|
1287 |
/**
|
1288 |
* Print a nice HTML head with no controls
|
1289 |
*
|
1290 |
*
|
1291 |
* @param $title title of the page
|
1292 |
* @param $url not used anymore.
|
1293 |
**/
|
1294 |
function nullHeader($title,$url='') { |
1295 |
global $CFG_GLPI,$HEADER_LOADED,$LANG ; |
1296 |
if ($HEADER_LOADED) return; |
1297 |
$HEADER_LOADED=true; |
1298 |
// Print a nice HTML-head with no controls
|
1299 |
|
1300 |
// Detect root_doc in case of error
|
1301 |
if (!isset($CFG_GLPI["root_doc"])){ |
1302 |
if ( !isset($_SERVER['REQUEST_URI']) ) { |
1303 |
$_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF']; |
1304 |
} |
1305 |
$currentdir=getcwd(); |
1306 |
chdir(GLPI_ROOT); |
1307 |
$glpidir=str_replace(str_replace('\\', '/',getcwd()),"",str_replace('\\', '/',$currentdir)); |
1308 |
chdir($currentdir); |
1309 |
|
1310 |
$globaldir=preg_replace("/\/[0-9a-zA-Z\.\-\_]+\.php/","",$_SERVER['REQUEST_URI']); |
1311 |
$globaldir=preg_replace("/\?.*/","",$globaldir); |
1312 |
$CFG_GLPI["root_doc"]=str_replace($glpidir,"",$globaldir); |
1313 |
$CFG_GLPI["root_doc"]=preg_replace("/\/$/","",$CFG_GLPI["root_doc"]); |
1314 |
$CFG_GLPI["logotxt"]=""; |
1315 |
} |
1316 |
|
1317 |
// Send UTF8 Headers
|
1318 |
header("Content-Type: text/html; charset=UTF-8"); |
1319 |
|
1320 |
// Override list-limit if choosen
|
1321 |
if (isset($_POST['list_limit'])) { |
1322 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
1323 |
} |
1324 |
|
1325 |
// Send extra expires header if configured
|
1326 |
if (!empty($CFG_GLPI["sendexpire"])) { |
1327 |
header_nocache(); |
1328 |
} |
1329 |
|
1330 |
if (isCommandLine()){
|
1331 |
return true; |
1332 |
} |
1333 |
|
1334 |
|
1335 |
includeCommonHtmlHeader($title);
|
1336 |
|
1337 |
|
1338 |
// Body with configured stuff
|
1339 |
echo "<body>"; |
1340 |
|
1341 |
echo "<div id='contenu-nullHeader'>"; |
1342 |
|
1343 |
echo "<div id='text-nullHeader'>"; |
1344 |
} |
1345 |
|
1346 |
/**
|
1347 |
* Print a nice HTML head for popup window (nothing to display)
|
1348 |
*
|
1349 |
*
|
1350 |
* @param $title title of the page
|
1351 |
* @param $url not used anymore.
|
1352 |
**/
|
1353 |
function popHeader($title,$url='') |
1354 |
{ |
1355 |
// Print a nice HTML-head for every page
|
1356 |
|
1357 |
global $CFG_GLPI,$LANG,$PLUGIN_HOOKS,$HEADER_LOADED ; |
1358 |
|
1359 |
if ($HEADER_LOADED) return; |
1360 |
$HEADER_LOADED=true; |
1361 |
|
1362 |
|
1363 |
// Override list-limit if choosen
|
1364 |
if (isset($_POST['list_limit'])) { |
1365 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
1366 |
} |
1367 |
|
1368 |
includeCommonHtmlHeader($title); // Body |
1369 |
|
1370 |
echo "<body>"; |
1371 |
|
1372 |
displayMessageAfterRedirect(); |
1373 |
} |
1374 |
|
1375 |
/**
|
1376 |
* Print footer for a popup window
|
1377 |
*
|
1378 |
*
|
1379 |
**/
|
1380 |
function popFooter() { |
1381 |
global $FOOTER_LOADED; |
1382 |
|
1383 |
if ($FOOTER_LOADED) return; |
1384 |
$FOOTER_LOADED=true; |
1385 |
|
1386 |
// Print foot
|
1387 |
|
1388 |
echo "</body></html>"; |
1389 |
} |
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
/**
|
1402 |
* Print footer for every page
|
1403 |
*
|
1404 |
* @param $keepDB booleen, closeDBConnections if false
|
1405 |
*
|
1406 |
**/
|
1407 |
function commonFooter($keepDB=false) { |
1408 |
// Print foot for every page
|
1409 |
|
1410 |
global $LANG,$CFG_GLPI,$DEBUG_SQL,$TIMER_DEBUG,$SQL_TOTAL_TIMER,$SQL_TOTAL_REQUEST,$FOOTER_LOADED; |
1411 |
|
1412 |
if ($FOOTER_LOADED) return; |
1413 |
$FOOTER_LOADED=true; |
1414 |
|
1415 |
echo "</div>"; // fin de la div id ='page' initiée dans la fonction header |
1416 |
|
1417 |
echo "<div id='footer' >"; |
1418 |
echo "<table width='100%'><tr><td class='left'><span class='copyright'>"; |
1419 |
echo $TIMER_DEBUG->Get_Time()."s - "; |
1420 |
if (function_exists("memory_get_usage")){ |
1421 |
echo memory_get_usage();
|
1422 |
} |
1423 |
echo "</span></td>"; |
1424 |
|
1425 |
if (!empty($CFG_GLPI["founded_new_version"])) |
1426 |
echo "<td class='copyright'>".$LANG["setup"][301]." ".$CFG_GLPI["founded_new_version"]."<br>".$LANG["setup"][302]."</td>"; |
1427 |
|
1428 |
echo "<td class='right'>"; |
1429 |
echo "<a href=\"http://glpi-project.org/\">"; |
1430 |
echo "<span class='copyright'>GLPI ".$CFG_GLPI["version"]." Copyright (C) 2003-".date("Y")." by the INDEPNET Development Team.</span>"; |
1431 |
echo "</a>"; |
1432 |
|
1433 |
echo "</td></tr>"; |
1434 |
echo "</table></div>"; |
1435 |
|
1436 |
|
1437 |
|
1438 |
if ($CFG_GLPI["debug"]==1){ // debug mode traduction |
1439 |
|
1440 |
echo "<div id='debug-float'>"; |
1441 |
echo "<a href='#see_debug'>GLPI MODE TRANSLATION</a>"; |
1442 |
echo "</div>"; |
1443 |
} |
1444 |
|
1445 |
if ($CFG_GLPI["debug"]==2){ // mode debug |
1446 |
|
1447 |
echo "<div id='debug-float'>"; |
1448 |
echo "<a href='#see_debug'>GLPI MODE DEBUG</a>"; |
1449 |
echo "</div>"; |
1450 |
|
1451 |
|
1452 |
|
1453 |
echo "<div id='debug'>"; |
1454 |
echo "<h1><a id='see_debug' name='see_debug'>GLPI MODE DEBUG</a></h1>"; |
1455 |
|
1456 |
if ($CFG_GLPI["debug_sql"]){ |
1457 |
echo "<h2>SQL REQUEST : "; |
1458 |
|
1459 |
echo $SQL_TOTAL_REQUEST." Queries "; |
1460 |
if ($CFG_GLPI["debug_profile"]){ |
1461 |
echo "took ".array_sum($DEBUG_SQL['times'])."s </h2>"; |
1462 |
} |
1463 |
|
1464 |
echo "<table class='tab_cadre' ><tr><th>N° </th><th>Queries</th><th>Time</th><th>Errors</th></tr>"; |
1465 |
|
1466 |
foreach ($DEBUG_SQL['queries'] as $num => $query){ |
1467 |
echo "<tr class='tab_bg_".(($num%2)+1)."'><td>$num</td><td>"; |
1468 |
echo eregi_replace("ORDER BY","<br>ORDER BY",eregi_replace("SORT","<br>SORT",eregi_replace("LEFT JOIN","<br>LEFT JOIN",eregi_replace("INNER JOIN","<br>INNER JOIN",eregi_replace("WHERE","<br>WHERE",eregi_replace("FROM","<br>FROM",eregi_replace("UNION","<br>UNION<br>",eregi_replace(">",">",eregi_replace("<","<",$query))))))))); |
1469 |
echo "</td><td>"; |
1470 |
echo $DEBUG_SQL['times'][$num]; |
1471 |
echo "</td><td>"; |
1472 |
if (isset($DEBUG_SQL['errors'][$num])){ |
1473 |
echo $DEBUG_SQL['errors'][$num]; |
1474 |
} else {
|
1475 |
echo " "; |
1476 |
} |
1477 |
echo "</td></tr>"; |
1478 |
} |
1479 |
echo "</table>"; |
1480 |
|
1481 |
// Reset, as further request will not be displayed
|
1482 |
$CFG_GLPI["debug_sql"]=false; |
1483 |
} |
1484 |
|
1485 |
|
1486 |
|
1487 |
if ($CFG_GLPI["debug_vars"]){ |
1488 |
echo "<h2>POST VARIABLE</h2>"; |
1489 |
printCleanArray($_POST);
|
1490 |
echo "<h2>GET VARIABLE</h2>"; |
1491 |
printCleanArray($_GET);
|
1492 |
echo "<h2>SESSION VARIABLE</h2>"; |
1493 |
printCleanArray($_SESSION);
|
1494 |
} |
1495 |
|
1496 |
|
1497 |
|
1498 |
echo "</div>"; |
1499 |
} |
1500 |
echo "</body></html>"; |
1501 |
|
1502 |
if (!$keepDB) { |
1503 |
closeDBConnections(); |
1504 |
} |
1505 |
} |
1506 |
|
1507 |
/**
|
1508 |
* Print footer for help page
|
1509 |
*
|
1510 |
*
|
1511 |
**/
|
1512 |
function helpFooter() { |
1513 |
// Print foot for help page
|
1514 |
global $CFG_GLPI,$FOOTER_LOADED; |
1515 |
|
1516 |
if ($FOOTER_LOADED) return; |
1517 |
$FOOTER_LOADED=true; |
1518 |
|
1519 |
echo "</div>"; // fin de la div id ='page' initiée dans la fonction header |
1520 |
|
1521 |
echo "<div id='footer'>"; |
1522 |
echo "<table width='100%'><tr>"; |
1523 |
echo "<td class='right'>"; |
1524 |
echo "<a href=\"http://glpi-project.org/\">"; |
1525 |
echo "<span class='copyright'>GLPI ".$CFG_GLPI["version"]." Copyright (C) 2003-".date("Y")." by the INDEPNET Development Team.</span>"; |
1526 |
echo "</a></tr></table>"; |
1527 |
echo "</div>"; |
1528 |
|
1529 |
echo "</body></html>"; |
1530 |
closeDBConnections(); |
1531 |
} |
1532 |
|
1533 |
/**
|
1534 |
* Print footer for null page
|
1535 |
*
|
1536 |
*
|
1537 |
**/
|
1538 |
function nullFooter() { |
1539 |
// Print foot for null page
|
1540 |
global $CFG_GLPI,$FOOTER_LOADED; |
1541 |
|
1542 |
if ($FOOTER_LOADED) return; |
1543 |
$FOOTER_LOADED=true; |
1544 |
|
1545 |
if (!isCommandLine()){
|
1546 |
echo "</div>"; // fin box text-nullHeader ouvert dans le null header |
1547 |
echo "</div>"; // fin contenu-nullHeader ouvert dans le null header |
1548 |
|
1549 |
|
1550 |
echo "<div id='footer-login'>"; |
1551 |
echo "<a href=\"http://glpi-project.org/\" title=\"Powered By Indepnet\" >"; |
1552 |
echo 'GLPI version '.(isset($CFG_GLPI["version"])?$CFG_GLPI["version"]:"").' Copyright (C) 2003-'.date("Y").' INDEPNET Development Team.'; |
1553 |
echo "</a>"; |
1554 |
echo "</div>"; |
1555 |
|
1556 |
echo "</body></html>"; |
1557 |
} |
1558 |
|
1559 |
closeDBConnections(); |
1560 |
} |
1561 |
|
1562 |
|
1563 |
/**
|
1564 |
* Print the helpdesk
|
1565 |
*
|
1566 |
* @param $ID int : ID of the user who want to display the Helpdesk
|
1567 |
* @param $from_helpdesk int : is display from the helpdesk.php ?
|
1568 |
* @return nothing (print the helpdesk)
|
1569 |
*/
|
1570 |
function printHelpDesk ($ID,$from_helpdesk) { |
1571 |
|
1572 |
global $DB,$CFG_GLPI,$LANG; |
1573 |
|
1574 |
if (!haveRight("create_ticket","1")) return false; |
1575 |
|
1576 |
$query = "SELECT email,realname,firstname,name FROM glpi_users WHERE (ID = '$ID')"; |
1577 |
$result=$DB->query($query); |
1578 |
$email = $DB->result($result,0,"email"); |
1579 |
|
1580 |
// Get saved data from a back system
|
1581 |
$emailupdates = 1; |
1582 |
if ($email=="") $emailupdates=0; |
1583 |
$device_type = 0; |
1584 |
$computer=""; |
1585 |
$contents=""; |
1586 |
$title=""; |
1587 |
$category = 0; |
1588 |
$priority = 3; |
1589 |
|
1590 |
|
1591 |
if (isset($_SESSION["helpdeskSaved"]["emailupdates"])) |
1592 |
$emailupdates = stripslashes($_SESSION["helpdeskSaved"]["emailupdates"]); |
1593 |
if (isset($_SESSION["helpdeskSaved"]["email"])) |
1594 |
$email = stripslashes($_SESSION["helpdeskSaved"]["uemail"]); |
1595 |
if (isset($_SESSION["helpdeskSaved"]["device_type"])) |
1596 |
$device_type = stripslashes($_SESSION["helpdeskSaved"]["device_type"]); |
1597 |
if (isset($_SESSION["helpdeskSaved"]["contents"])) |
1598 |
$contents = stripslashes($_SESSION["helpdeskSaved"]["contents"]); |
1599 |
if (isset($_SESSION["helpdeskSaved"]["name"])) |
1600 |
$title = stripslashes($_SESSION["helpdeskSaved"]["name"]); |
1601 |
if (isset($_SESSION["helpdeskSaved"]["category"])) |
1602 |
$category = stripslashes($_SESSION["helpdeskSaved"]["category"]); |
1603 |
if (isset($_SESSION["helpdeskSaved"]["priority"])) |
1604 |
$priority = stripslashes($_SESSION["helpdeskSaved"]["priority"]); |
1605 |
unset($_SESSION["helpdeskSaved"]); |
1606 |
|
1607 |
|
1608 |
echo "<form method='post' name=\"helpdeskform\" action=\"".$CFG_GLPI["root_doc"]."/front/tracking.injector.php\" enctype=\"multipart/form-data\">"; |
1609 |
echo "<input type='hidden' name='_from_helpdesk' value='$from_helpdesk'>"; |
1610 |
echo "<input type='hidden' name='request_type' value='1'>"; |
1611 |
echo "<input type='hidden' name='FK_entities' value='".$_SESSION["glpiactive_entity"]."'>"; |
1612 |
echo "<div class='center'><table class='tab_cadre'>"; |
1613 |
|
1614 |
echo "<tr><th colspan='2'>".$LANG["help"][1].": "; |
1615 |
if (isMultiEntitiesMode()){
|
1616 |
echo " (".getDropdownName("glpi_entities",$_SESSION["glpiactive_entity"]).")"; |
1617 |
} |
1618 |
|
1619 |
echo "</th></tr>"; |
1620 |
echo "<tr class='tab_bg_1'>"; |
1621 |
echo "<td>".$LANG["help"][2].": </td>"; |
1622 |
echo "<td>"; |
1623 |
dropdownPriority("priority",$priority); |
1624 |
echo "</td></tr>"; |
1625 |
if(isAuthorMailingActivatedForHelpdesk()){
|
1626 |
echo "<tr class='tab_bg_1'>"; |
1627 |
echo "<td>".$LANG["help"][8].":</td>"; |
1628 |
echo "<td>"; |
1629 |
dropdownYesNo('emailupdates',$emailupdates); |
1630 |
echo "</td></tr>"; |
1631 |
echo "<tr class='tab_bg_1'>"; |
1632 |
echo "<td>".$LANG["help"][11].":</td>"; |
1633 |
echo "<td> <input name='uemail' value=\"$email\" size='50' onchange=\"emailupdates.value='1'\">"; |
1634 |
echo "</td></tr>"; |
1635 |
} |
1636 |
|
1637 |
if ($_SESSION["glpiactiveprofile"]["helpdesk_hardware"]!=0){ |
1638 |
echo "<tr class='tab_bg_1'>"; |
1639 |
echo "<td>".$LANG["help"][24].": </td>"; |
1640 |
echo "<td class='center'>"; |
1641 |
dropdownMyDevices($_SESSION["glpiID"],$_SESSION["glpiactive_entity"]); |
1642 |
|
1643 |
dropdownTrackingAllDevices("device_type",$device_type,0,$_SESSION["glpiactive_entity"]); |
1644 |
echo "</td></tr>"; |
1645 |
} |
1646 |
|
1647 |
echo "<tr class='tab_bg_1'>"; |
1648 |
echo "<td>".$LANG["common"][36].":</td><td>"; |
1649 |
|
1650 |
dropdownValue("glpi_dropdown_tracking_category","category",$category); |
1651 |
echo "</td>"; |
1652 |
echo "</tr>"; |
1653 |
|
1654 |
echo "<tr class='tab_bg_1'>"; |
1655 |
echo "<td colspan='2' align='center'>".$LANG["help"][13].":</td>"; |
1656 |
echo "</tr>"; |
1657 |
echo "<tr class='tab_bg_1'>"; |
1658 |
echo "<td class='center'>".$LANG["common"][57].":</td>"; |
1659 |
echo "<td class='center'><input type='text' maxlength='250' size='80' name='name' value=\"$title\"></td>"; |
1660 |
echo "</tr>"; |
1661 |
|
1662 |
echo "<tr class='tab_bg_1'>"; |
1663 |
echo "<td colspan='2' align='center'><textarea name='contents' cols='80' rows='14' >$contents</textarea>"; |
1664 |
echo "</td></tr>"; |
1665 |
|
1666 |
$max_size=return_bytes_from_ini_vars(ini_get("upload_max_filesize")); |
1667 |
$max_size/=1024*1024; |
1668 |
$max_size=round($max_size,1); |
1669 |
|
1670 |
echo "<tr class='tab_bg_1'><td>".$LANG["document"][2]." (".$max_size." Mb max): "; |
1671 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/aide.png\" class='pointer' alt=\"".$LANG["central"][7]."\" onclick=\"window.open('".$CFG_GLPI["root_doc"]."/front/typedoc.list.php','Help','scrollbars=1,resizable=1,width=1000,height=800')\">"; |
1672 |
echo "</td>"; |
1673 |
echo "<td><input type='file' name='filename' value=\"\" size='25'></td>"; |
1674 |
echo "</tr>"; |
1675 |
|
1676 |
echo "<tr class='tab_bg_1'>"; |
1677 |
echo "<td colspan='2' class='center'> <input type='submit' value=\"".$LANG["help"][14]."\" class='submit'>"; |
1678 |
echo "</td></tr>"; |
1679 |
|
1680 |
echo "</table>"; |
1681 |
echo "</div>"; |
1682 |
echo "</form>"; |
1683 |
|
1684 |
} |
1685 |
|
1686 |
/**
|
1687 |
* Display the list_limit combo choice
|
1688 |
*
|
1689 |
*
|
1690 |
* @param $action page would be posted when change the value (URL + param)
|
1691 |
* @return nothing (print a combo)
|
1692 |
*
|
1693 |
*/
|
1694 |
function printPagerForm ($action) { |
1695 |
global $LANG; |
1696 |
|
1697 |
echo "<form method='POST' action=\"$action\">\n"; |
1698 |
echo "<span>".$LANG["pager"][4]." </span>"; |
1699 |
echo "<select name='list_limit' onChange='submit()'>"; |
1700 |
|
1701 |
for ($i=5;$i<20;$i+=5) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1702 |
for ($i=20;$i<50;$i+=10) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1703 |
for ($i=50;$i<250;$i+=50) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1704 |
for ($i=250;$i<1000;$i+=250) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1705 |
for ($i=1000;$i<5000;$i+=1000) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1706 |
for ($i=5000;$i<=10000;$i+=5000) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1707 |
echo "<option value='9999999' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==9999999)?" selected ":"").">9999999</option>\n"; |
1708 |
|
1709 |
echo "</select><span> "; |
1710 |
echo $LANG["pager"][5]; |
1711 |
echo "</span>"; |
1712 |
echo "</form>\n"; |
1713 |
} |
1714 |
|
1715 |
/**
|
1716 |
* Print pager for search option (first/previous/next/last)
|
1717 |
*
|
1718 |
*
|
1719 |
*
|
1720 |
* @param $start from witch item we start
|
1721 |
* @param $numrows total items
|
1722 |
* @param $target page would be open when click on the option (last,previous etc)
|
1723 |
* @param $parameters parameters would be passed on the URL.
|
1724 |
* @param $item_type_output item type display - if >0 display export PDF et Sylk form
|
1725 |
* @param $item_type_output_param item type parameter for export
|
1726 |
* @return nothing (print a pager)
|
1727 |
*
|
1728 |
*/
|
1729 |
function printPager($start,$numrows,$target,$parameters,$item_type_output=0,$item_type_output_param=0) { |
1730 |
|
1731 |
global $CFG_GLPI, $LANG,$CFG_GLPI; |
1732 |
|
1733 |
// Forward is the next step forward
|
1734 |
$forward = $start+$_SESSION["glpilist_limit"]; |
1735 |
|
1736 |
// This is the end, my friend
|
1737 |
$end = $numrows-$_SESSION["glpilist_limit"]; |
1738 |
|
1739 |
// Human readable count starts here
|
1740 |
$current_start=$start+1; |
1741 |
|
1742 |
// And the human is viewing from start to end
|
1743 |
$current_end = $current_start+$_SESSION["glpilist_limit"]-1; |
1744 |
if ($current_end>$numrows) { |
1745 |
$current_end = $numrows; |
1746 |
} |
1747 |
|
1748 |
// Backward browsing
|
1749 |
if ($current_start-$_SESSION["glpilist_limit"]<=0) { |
1750 |
$back=0; |
1751 |
} else {
|
1752 |
$back=$start-$_SESSION["glpilist_limit"]; |
1753 |
} |
1754 |
|
1755 |
// Print it
|
1756 |
|
1757 |
echo "<table class='tab_cadre_pager'>\n"; |
1758 |
echo "<tr>\n"; |
1759 |
|
1760 |
// Back and fast backward button
|
1761 |
if (!$start==0) { |
1762 |
echo "<th class='left'>"; |
1763 |
echo "<a href=\"$target?$parameters&start=0\">"; |
1764 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/first.png\" alt='".$LANG["buttons"][33]."' title='".$LANG["buttons"][33]."'>"; |
1765 |
|
1766 |
|
1767 |
echo "</a></th>\n"; |
1768 |
echo "<th class='left'>"; |
1769 |
echo "<a href=\"$target?$parameters&start=$back\">"; |
1770 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/left.png\" alt='".$LANG["buttons"][12]."' title='".$LANG["buttons"][12]."'>"; |
1771 |
echo "</a></th>\n"; |
1772 |
} |
1773 |
|
1774 |
// Print the "where am I?"
|
1775 |
echo "<td width='50%' class='tab_bg_2'>"; |
1776 |
printPagerForm("$target?$parameters&start=$start");
|
1777 |
echo "</td>\n"; |
1778 |
|
1779 |
if ($item_type_output>0&&isset($_SESSION["glpiactiveprofile"])&&$_SESSION["glpiactiveprofile"]["interface"]=="central"){ |
1780 |
echo "<td class='tab_bg_2' width='30%'>" ; |
1781 |
echo "<form method='GET' action=\"".$CFG_GLPI["root_doc"]."/front/report.dynamic.php\" target='_blank'>\n"; |
1782 |
echo "<input type='hidden' name='item_type' value='$item_type_output'>"; |
1783 |
if ($item_type_output_param!=0) |
1784 |
echo "<input type='hidden' name='item_type_param' value='".serialize($item_type_output_param)."'>"; |
1785 |
$split=split("&",$parameters); |
1786 |
for ($i=0;$i<count($split);$i++){ |
1787 |
$pos=strpos($split[$i],'='); |
1788 |
echo "<input type='hidden' name=\"".substr($split[$i],0,$pos)."\" value=\"".substr($split[$i],$pos+1)."\">"; |
1789 |
} |
1790 |
echo "<select name='display_type'>"; |
1791 |
echo "<option value='".PDF_OUTPUT_LANDSCAPE."'>".$LANG["buttons"][27]." ".$LANG["common"][68]."</option>"; |
1792 |
echo "<option value='".PDF_OUTPUT_PORTRAIT."'>".$LANG["buttons"][27]." ".$LANG["common"][69]."</option>"; |
1793 |
echo "<option value='".SYLK_OUTPUT."'>".$LANG["buttons"][28]."</option>"; |
1794 |
echo "<option value='".CSV_OUTPUT."'>".$LANG["buttons"][44]."</option>"; |
1795 |
echo "<option value='-".PDF_OUTPUT_LANDSCAPE."'>".$LANG["buttons"][29]." ".$LANG["common"][68]."</option>"; |
1796 |
echo "<option value='-".PDF_OUTPUT_PORTRAIT."'>".$LANG["buttons"][29]." ".$LANG["common"][69]."</option>"; |
1797 |
echo "<option value='-".SYLK_OUTPUT."'>".$LANG["buttons"][30]."</option>"; |
1798 |
echo "<option value='-".CSV_OUTPUT."'>".$LANG["buttons"][45]."</option>"; |
1799 |
echo "</select>"; |
1800 |
echo " <input type='image' name='export' src='".$CFG_GLPI["root_doc"]."/pics/greenbutton.png' title='".$LANG["buttons"][31]."' value='".$LANG["buttons"][31]."'>"; |
1801 |
echo "</form>"; |
1802 |
echo "</td>" ; |
1803 |
} |
1804 |
|
1805 |
echo "<td width='50%' class='tab_bg_2'><strong>"; |
1806 |
|
1807 |
echo $LANG["pager"][2]." ".$current_start." ".$LANG["pager"][1]." ".$current_end." ".$LANG["pager"][3]." ".$numrows." "; |
1808 |
echo "</strong></td>\n"; |
1809 |
|
1810 |
// Forward and fast forward button
|
1811 |
if ($forward<$numrows) { |
1812 |
echo "<th class='right'>"; |
1813 |
echo "<a href=\"$target?$parameters&start=$forward\">"; |
1814 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/right.png\" alt='".$LANG["buttons"][11]."' title='".$LANG["buttons"][11]."'>"; |
1815 |
echo "</a></th>\n"; |
1816 |
echo "<th class='right'>"; |
1817 |
echo "<a href=\"$target?$parameters&start=$end\">"; |
1818 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/last.png\" alt='".$LANG["buttons"][32]."' title='".$LANG["buttons"][32]."'>"; |
1819 |
echo "</a></th>\n"; |
1820 |
} |
1821 |
|
1822 |
// End pager
|
1823 |
echo "</tr>\n"; |
1824 |
echo "</table><br>\n"; |
1825 |
|
1826 |
} |
1827 |
|
1828 |
|
1829 |
/**
|
1830 |
* Display calendar form
|
1831 |
*
|
1832 |
* @param $form form in which the calendar is display
|
1833 |
* @param $element name of the element
|
1834 |
* @param $value default value to display
|
1835 |
* @param $can_edit could not modify element
|
1836 |
* @param $with_time use datetime format instead of date format ?
|
1837 |
* @param $with_reset do not display reset button
|
1838 |
* @return nothing
|
1839 |
*/
|
1840 |
function showCalendarForm($form,$element,$value='',$can_edit=true,$with_time=false,$with_reset=true){ |
1841 |
global $LANG,$CFG_GLPI; |
1842 |
$rand=mt_rand();
|
1843 |
if (empty($value)) { |
1844 |
if ($with_time) $value=date("Y-m-d H:i"); |
1845 |
else $value=date("Y-m-d"); |
1846 |
} |
1847 |
|
1848 |
$size=10; |
1849 |
$dvalue=$value; |
1850 |
if ($with_time) { |
1851 |
$size=18; |
1852 |
$dvalue=convDateTime($value); |
1853 |
} else {
|
1854 |
$dvalue=convDate($value); |
1855 |
} |
1856 |
|
1857 |
echo "<input id='show$rand' type='text' name='____".$element."_show' readonly size='$size' value=\"".$dvalue."\">"; |
1858 |
echo "<input id='data$rand' type='hidden' name='$element' size='$size' value=\"".$value."\">"; |
1859 |
|
1860 |
if ($can_edit){ |
1861 |
echo " <img id='button$rand' src='".$CFG_GLPI["root_doc"]."/pics/calendar.png' class='calendrier' alt='".$LANG["buttons"][15]."' title='".$LANG["buttons"][15]."'>"; |
1862 |
|
1863 |
if ($with_reset){ |
1864 |
echo " <img src='".$CFG_GLPI["root_doc"]."/pics/reset.png' class='calendrier' onclick=\"window.document.getElementById('data$rand').value='0000-00-00".($with_time?" 00:00":"")."';window.document.getElementById('show$rand').value='".($with_time?convDateTime("0000-00-00 00:00"):convDate("0000-00-00"))."'\" alt='Reset' title='Reset'>"; |
1865 |
} |
1866 |
|
1867 |
echo "<script type='text/javascript'>"; |
1868 |
echo "Calendar.setup("; |
1869 |
echo "{"; |
1870 |
echo "inputField : 'data$rand',"; // ID of the input field |
1871 |
if ($with_time){ |
1872 |
echo "ifFormat : '%Y-%m-%d %H:%M',"; // the date format |
1873 |
echo "showsTime : true,"; |
1874 |
} |
1875 |
else {
|
1876 |
echo "ifFormat : '%Y-%m-%d',"; // the datetime format |
1877 |
} |
1878 |
echo "button : 'button$rand'"; // ID of the button |
1879 |
echo "});"; |
1880 |
echo "</script>"; |
1881 |
|
1882 |
echo "<script type='text/javascript' >\n"; |
1883 |
echo " new Form.Element.Observer('data$rand', 1, \n"; |
1884 |
echo " function(element, value) {\n"; |
1885 |
if (!$CFG_GLPI["dateformat"]){ |
1886 |
echo "window.document.getElementById('show$rand').value=value;"; |
1887 |
} else {
|
1888 |
if ($with_time){ |
1889 |
echo "if (value!='0000-00-00 00:00'){"; |
1890 |
echo "var d=Date.parseDate(value,'%Y-%m-%d %H:%M');"; |
1891 |
echo "window.document.getElementById('show$rand').value=d.print('%d-%m-%Y %H:%M');"; |
1892 |
echo "}"; |
1893 |
} else {
|
1894 |
echo "if (value!='0000-00-00'){"; |
1895 |
echo "var d=Date.parseDate(value,'%Y-%m-%d');"; |
1896 |
echo "window.document.getElementById('show$rand').value=d.print('%d-%m-%Y');"; |
1897 |
echo "}"; |
1898 |
} |
1899 |
} |
1900 |
echo "})\n"; |
1901 |
echo "</script>\n"; |
1902 |
} |
1903 |
} |
1904 |
|
1905 |
/**
|
1906 |
* show notes for item
|
1907 |
*
|
1908 |
* @param $target target page to update item
|
1909 |
* @param $type item type of the device to display notes
|
1910 |
* @param $id id of the device to display notes
|
1911 |
* @return nothing
|
1912 |
*/
|
1913 |
function showNotesForm($target,$type,$id){ |
1914 |
global $LANG; |
1915 |
|
1916 |
if (!haveRight("notes","r")) return false; |
1917 |
//new objet
|
1918 |
$ci =new CommonItem; |
1919 |
//getFromDB
|
1920 |
$ci->getFromDB ($type,$id); |
1921 |
|
1922 |
|
1923 |
echo "<form name='form' method='post' action=\"".$target."\">"; |
1924 |
echo "<div class='center'>"; |
1925 |
echo "<table class='tab_cadre_fixe' >"; |
1926 |
echo "<tr><th align='center' >"; |
1927 |
echo $LANG["title"][37]; |
1928 |
echo "</th></tr>"; |
1929 |
echo "<tr><td valign='middle' align='center' class='tab_bg_1' ><textarea class='textarea_notes' cols='100' rows='35' name='notes' >".$ci->getField('notes')."</textarea></td></tr>"; |
1930 |
echo "<tr><td class='tab_bg_2' align='center' >\n"; |
1931 |
echo "<input type='hidden' name='ID' value=$id>"; |
1932 |
if (haveRight("notes","w")) |
1933 |
echo "<input type='submit' name='update' value=\"".$LANG["buttons"][7]."\" class='submit'>"; |
1934 |
echo "</td></tr>\n"; |
1935 |
echo "</table></div></form>"; |
1936 |
} |
1937 |
|
1938 |
/**
|
1939 |
* Set page not to use the cache
|
1940 |
*
|
1941 |
*
|
1942 |
**/
|
1943 |
function header_nocache(){ |
1944 |
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 |
1945 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date du passe |
1946 |
} |
1947 |
|
1948 |
/**
|
1949 |
* Flush the current displayed items (do not works really fine)
|
1950 |
*
|
1951 |
*
|
1952 |
**/
|
1953 |
function glpi_flush(){ |
1954 |
flush();
|
1955 |
if (function_exists("ob_flush") && ob_get_length () !== FALSE) ob_flush(); |
1956 |
} |
1957 |
|
1958 |
/**
|
1959 |
* Display a simple progress bar
|
1960 |
* @param $width Width of the progress bar
|
1961 |
* @param $percent Percent of the progress bar
|
1962 |
* @return nothing
|
1963 |
*
|
1964 |
*
|
1965 |
**/
|
1966 |
function displayProgressBar($width,$percent){ |
1967 |
global $LANG; |
1968 |
$percentwidth=floor($percent*$width/100); |
1969 |
echo str_pad("<div class='center'><table class='tab_cadre' width='$width'><tr><td width='$width' align='center'> ".$LANG["common"][47]." ".$percent."%</td></tr><tr><td><table><tr><td bgcolor='red' width='$percentwidth' height='20'> </td></tr></table></td></tr></table></div>\n",4096); |
1970 |
glpi_flush(); |
1971 |
} |
1972 |
/**
|
1973 |
* Clean Printing of and array in a table
|
1974 |
* @param $tab the array to display
|
1975 |
* @param $pad Pad used
|
1976 |
* @return nothing
|
1977 |
*
|
1978 |
*
|
1979 |
**/
|
1980 |
function printCleanArray($tab,$pad=0){ |
1981 |
if (count($tab)){ |
1982 |
echo "<table class='tab_cadre'>"; |
1983 |
echo "<tr><th>KEY</th><th>=></th><th>VALUE</th></tr>"; |
1984 |
foreach($tab as $key => $val){ |
1985 |
echo "<tr class='tab_bg_1'><td valign='top' align='right'>"; |
1986 |
echo $key; |
1987 |
echo "</td><td valign='top'>=></td><td valign='top' class='tab_bg_1'>"; |
1988 |
if (is_array($val)){ |
1989 |
printCleanArray($val,$pad+1); |
1990 |
} |
1991 |
else echo $val; |
1992 |
echo "</td></tr>"; |
1993 |
} |
1994 |
echo "</table>"; |
1995 |
} |
1996 |
} |
1997 |
|
1998 |
/**
|
1999 |
* Display a Link to the last page using http_referer if available else use history.back
|
2000 |
*
|
2001 |
*
|
2002 |
**/
|
2003 |
function displayBackLink(){ |
2004 |
global $LANG; |
2005 |
if (isset($_SERVER['HTTP_REFERER'])){ |
2006 |
echo "<a href='".$_SERVER['HTTP_REFERER']."'>".$LANG["buttons"][13]."</a>"; |
2007 |
} else {
|
2008 |
echo "<a href='javascript:history.back();'>".$LANG["buttons"][13]."</a>"; |
2009 |
} |
2010 |
} |
2011 |
|
2012 |
/**
|
2013 |
* Print the form used to select profile if several are available
|
2014 |
* @param $target target of the form
|
2015 |
* @return nothing
|
2016 |
*
|
2017 |
*
|
2018 |
**/
|
2019 |
function showProfileSelecter($target){ |
2020 |
global $CFG_GLPI, $LANG; |
2021 |
|
2022 |
if (count($_SESSION["glpiprofiles"])>1){ |
2023 |
echo '<li><form name="form" method="post" action="'.$target.'">'; |
2024 |
echo '<select name="newprofile" onChange="submit()">'; |
2025 |
foreach ($_SESSION["glpiprofiles"] as $key => $val){ |
2026 |
echo '<option value="'.$key.'" '.($_SESSION["glpiactiveprofile"]["ID"]==$key?'selected':'').'>'.$val['name'].'</option>'; |
2027 |
} |
2028 |
echo '</select>'; |
2029 |
echo '</form>'; |
2030 |
echo "</li>"; |
2031 |
|
2032 |
|
2033 |
} //else echo "only one profile -> no select to print";
|
2034 |
|
2035 |
if (isMultiEntitiesMode()){
|
2036 |
$cpt=0; |
2037 |
|
2038 |
foreach ($_SESSION['glpi_entities_tree'] as $key => $tree){ |
2039 |
$entities = contructListFromTree($tree); |
2040 |
$cpt+=count($entities); |
2041 |
} |
2042 |
|
2043 |
$addname=""; |
2044 |
if ($cpt>15){ |
2045 |
$addname="_long"; |
2046 |
} |
2047 |
|
2048 |
echo "<li>"; |
2049 |
|
2050 |
|
2051 |
//echo "<a href='".$CFG_GLPI["root_doc"]."/front/entity.select.php?target=$target' id='modal_entity_selection'>".$_SESSION["glpiactive_entity_name"]."</a>";
|
2052 |
|
2053 |
|
2054 |
echo "<a href='#modal_entity_contents' id='modal_entity_selection' title='".$_SESSION["glpiactive_entity_name"]."' class='entity_select'>".$_SESSION["glpiactive_entity_shortname"]."</a>"; |
2055 |
echo "<div id='modal_entity_contents'>"; |
2056 |
displayActiveEntities($target,"activeentity"); |
2057 |
echo "</div>"; |
2058 |
|
2059 |
|
2060 |
echo "<script type='text/javascript'>"; |
2061 |
echo "new Control.Modal('modal_entity_selection',{"; |
2062 |
//echo "iframe: true,";
|
2063 |
//echo "opacity: 0.8, position: 'relative', width:300, height:50";
|
2064 |
echo "opacity: 0.2, fadeDuration: 0.35, width: 500, height: 500"; |
2065 |
echo "});"; |
2066 |
echo "</script>"; |
2067 |
|
2068 |
/* echo "<a href='#' title=\"".$_SESSION["glpiactive_entity_name"]."\" onclick=\"completecleandisplay('show_entities$addname');\">";
|
2069 |
echo $_SESSION["glpiactive_entity_shortname"];
|
2070 |
echo "</a>";
|
2071 |
echo "<div id='show_entities$addname' onmouseover=\"completecleandisplay('show_entities$addname');\">";
|
2072 |
|
2073 |
displayActiveEntities($target,"activeentity");
|
2074 |
|
2075 |
echo "</div>";
|
2076 |
*/
|
2077 |
echo "</li>"; |
2078 |
} |
2079 |
|
2080 |
|
2081 |
|
2082 |
} |
2083 |
|
2084 |
/**
|
2085 |
* Create a Dynamic Progress Bar
|
2086 |
*
|
2087 |
* @param $msg initial message (under the bar)
|
2088 |
* @return nothing
|
2089 |
**/
|
2090 |
function createProgressBar ($msg=" ") { |
2091 |
echo "<div class='doaction_cadre'><div class='doaction_progress' id='doaction_progress'>". |
2092 |
"<div class='doaction_pourcent' id='doaction_pourcent'> </div></div></div><br />".
|
2093 |
"<div id='doaction_message'>$msg</div>";
|
2094 |
} |
2095 |
|
2096 |
/**
|
2097 |
* Change the Progress Bar Position
|
2098 |
*
|
2099 |
* @param $crt Current Value (less then $max)
|
2100 |
* @param $tot Maximum Value
|
2101 |
* @param $msg message inside the bar (defaut is %)
|
2102 |
* @return nothing
|
2103 |
**/
|
2104 |
function changeProgressBarPosition ($crt, $tot, $msg="") { |
2105 |
if (!$tot) |
2106 |
$pct=0; |
2107 |
else if ($crt>$tot) |
2108 |
$pct=100; |
2109 |
else
|
2110 |
$pct = floor($crt*100/$tot); |
2111 |
|
2112 |
if (empty($msg)) $msg = $pct." %"; |
2113 |
|
2114 |
echo "<script type='text/javascript'>action_change_progress(\"$pct%\",\"$msg\")</script>\n"; |
2115 |
glpi_flush(); |
2116 |
} |
2117 |
|
2118 |
/**
|
2119 |
* Change the Message under the Progress Bar
|
2120 |
*
|
2121 |
* @param $msg message under the bar
|
2122 |
* @return nothing
|
2123 |
**/
|
2124 |
function changeProgressBarMessage ($msg=" ") { |
2125 |
echo "<script type='text/javascript'>action_change_message(\"$msg\")</script>\n"; |
2126 |
} |
2127 |
?>
|