ryxeo-glpi-git / inc / display.function.php @ bdec3308
Historique | Voir | Annoter | Télécharger (76,4 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 |
//ryxeo
|
712 |
// echo "<div id='c_logo' ><a href='".$CFG_GLPI["root_doc"]."/front/central.php' title=\"".$LANG["central"][5]."\"></a></div>";
|
713 |
echo "<div id='c_logo' ><a href='".$CFG_GLPI["root_doc"]."/front/central.php?active_entity=all' title=\"".$LANG["central"][5]."\"></a></div>"; |
714 |
|
715 |
|
716 |
// Les préférences + lien déconnexion
|
717 |
echo "<div id='c_preference' >"; |
718 |
echo "<ul><li id='deconnexion'><a href=\"".$CFG_GLPI["root_doc"]."/logout.php"; |
719 |
// logout witour noAuto login for extauth
|
720 |
if (isset($_SESSION['glpiextauth'])&&$_SESSION['glpiextauth']){ |
721 |
echo "?noAUTO=1"; |
722 |
} |
723 |
echo "\" title=\"".$LANG["central"][6]."\">".$LANG["central"][6]." </a>"; |
724 |
|
725 |
echo "("; |
726 |
echo formatUserName (0,$_SESSION["glpiname"],$_SESSION["glpirealname"],$_SESSION["glpifirstname"],0,20); |
727 |
echo ")</li>\n"; |
728 |
|
729 |
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"; |
730 |
|
731 |
echo " <li> <a href=\"".$CFG_GLPI["root_doc"]."/front/user.form.my.php\" title=\"".$LANG["Menu"][11]."\" >".$LANG["Menu"][11]." </a></li>\n"; |
732 |
echo "</ul>\n"; |
733 |
echo "<div class='sep'></div>\n"; |
734 |
echo "</div>\n"; |
735 |
|
736 |
//-- Le moteur de recherche -->
|
737 |
echo "<div id='c_recherche' >\n"; |
738 |
|
739 |
echo "<form method='get' action='".$CFG_GLPI["root_doc"]."/front/search.php'>\n"; |
740 |
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"; |
741 |
echo " <div id='champRecherche'><input size='15' type='text' name='globalsearch' value='".$LANG["buttons"][0]."' onfocus=\"this.value='';\" ></div> \n"; |
742 |
|
743 |
echo "</form>\n"; |
744 |
|
745 |
echo "<div class='sep'></div>\n"; |
746 |
echo "</div>"; |
747 |
|
748 |
//<!-- Le menu principal -->
|
749 |
echo "<div id='c_menu'>"; |
750 |
echo " <ul id='menu'>"; |
751 |
|
752 |
|
753 |
// Get object-variables and build the navigation-elements
|
754 |
$i=1; |
755 |
foreach ($menu as $part => $data){ |
756 |
if (isset($data['content'])&&count($data['content'])){ |
757 |
echo " <li id='menu$i' onmouseover=\"javascript:menuAff('menu$i','menu');\" >"; |
758 |
|
759 |
$link="#"; |
760 |
if (isset($data['default'])&&!empty($data['default'])){ |
761 |
$link=$CFG_GLPI["root_doc"].$data['default']; |
762 |
} |
763 |
if (strlen($data['title'])>14){ |
764 |
$data['title']=utf8_substr($data['title'],0,14)."..."; |
765 |
} |
766 |
|
767 |
echo "<a href=\"$link\" class='itemP'>".$data['title']."</a>"; |
768 |
echo "<ul class='ssmenu'>"; |
769 |
// list menu item
|
770 |
foreach ($data['content'] as $key => $val) { |
771 |
if (isset($val['page'])&&isset($val['title'])){ |
772 |
echo "<li><a href=\"".$CFG_GLPI["root_doc"].$val['page']."\""; |
773 |
if (isset($data['shortcut'])&&!empty($data['shortcut'])){ |
774 |
echo " accesskey=\"".$val['shortcut']."\" "; |
775 |
} |
776 |
|
777 |
echo ">".$val['title']."</a></li>\n"; |
778 |
} |
779 |
} |
780 |
|
781 |
echo "</ul>"; |
782 |
echo "</li>"; |
783 |
|
784 |
$i++;
|
785 |
} |
786 |
} |
787 |
|
788 |
echo "</ul>"; |
789 |
echo "<div class='sep'></div>"; |
790 |
echo "</div>"; |
791 |
|
792 |
// End navigation bar
|
793 |
|
794 |
// End headline
|
795 |
|
796 |
// Le sous menu contextuel 1
|
797 |
echo "<div id='c_ssmenu1' >"; |
798 |
echo "<ul>"; |
799 |
// list sous-menu item
|
800 |
if (isset($menu[$sector])){ |
801 |
if (isset($menu[$sector]['content'])&&is_array($menu[$sector]['content'])){ |
802 |
|
803 |
$ssmenu=$menu[$sector]['content']; |
804 |
if (count($ssmenu)>12){ |
805 |
foreach ($ssmenu as $key => $val){ |
806 |
if (isset($val['hide'])){ |
807 |
unset($ssmenu[$key]); |
808 |
} |
809 |
} |
810 |
$ssmenu=array_splice($ssmenu,0,12); |
811 |
} |
812 |
|
813 |
foreach ($ssmenu as $key => $val) { |
814 |
if (isset($val['page'])&&isset($val['title'])){ |
815 |
echo "<li><a href=\"".$CFG_GLPI["root_doc"].$val['page']."\" "; |
816 |
if (isset($val['shortcut'])&&!empty($val['shortcut'])){ |
817 |
echo " accesskey=\"".$val['shortcut']."\""; |
818 |
} |
819 |
echo ">".$val['title']."</a></li>\n"; |
820 |
} |
821 |
} |
822 |
} else echo "<li> </li>"; |
823 |
} else echo "<li> </li>"; |
824 |
echo "</ul>"; |
825 |
echo "</div>"; |
826 |
|
827 |
// Le fil d arianne
|
828 |
echo "<div id='c_ssmenu2' >"; |
829 |
echo "<ul>"; |
830 |
|
831 |
// Display item
|
832 |
//ryxeo (ajout du ?active_entity=all)
|
833 |
echo " <li><a href='".$CFG_GLPI["root_doc"]."/front/central.php?active_entity=all' title='".$LANG["common"][56]."' >".$LANG["common"][56]." </a> ></li>"; |
834 |
|
835 |
if (isset($menu[$sector])){ |
836 |
$link="/front/central.php"; |
837 |
if (isset($menu[$sector]['default'])){ |
838 |
$link=$menu[$sector]['default']; |
839 |
} |
840 |
echo " <li><a href='".$CFG_GLPI["root_doc"].$link."' title='".$menu[$sector]['title']."' >".$menu[$sector]['title']." </a> > </li>"; |
841 |
} |
842 |
|
843 |
if (isset($menu[$sector]['content'][$item])){ |
844 |
// Title
|
845 |
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>"; |
846 |
echo "<li> </li>"; |
847 |
|
848 |
// Add item
|
849 |
echo "<li>"; |
850 |
if (isset($menu[$sector]['content'][$item]['links']['add'])){ |
851 |
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>"; |
852 |
} else {
|
853 |
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/menu_add_off.png' title='".$LANG["buttons"][8]."' alt='".$LANG["buttons"][8]."'>"; |
854 |
} |
855 |
echo "</li>"; |
856 |
// Search Item
|
857 |
if (isset($menu[$sector]['content'][$item]['links']['search'])){ |
858 |
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>"; |
859 |
} else {
|
860 |
echo "<li><img src='".$CFG_GLPI["root_doc"]."/pics/menu_search_off.png' title='".$LANG["buttons"][0]."' alt='".$LANG["buttons"][0]."'></li>"; |
861 |
} |
862 |
|
863 |
// Links
|
864 |
if (isset($menu[$sector]['content'][$item]['links'])&&is_array($menu[$sector]['content'][$item]['links'])){ |
865 |
foreach ($menu[$sector]['content'][$item]['links'] as $key => $val) { |
866 |
switch ($key){ |
867 |
case "add": |
868 |
case "search": |
869 |
break;
|
870 |
case "template": |
871 |
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>"; |
872 |
break;
|
873 |
case "showall": |
874 |
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>"; |
875 |
break;
|
876 |
case "summary": |
877 |
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>"; |
878 |
break;
|
879 |
case "config": |
880 |
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>"; |
881 |
break;
|
882 |
|
883 |
default :
|
884 |
echo "<li><a href='".$CFG_GLPI["root_doc"].$val."' >".$key." </a></li>"; |
885 |
break;
|
886 |
} |
887 |
} |
888 |
} |
889 |
} else {
|
890 |
echo "<li> </li>"; |
891 |
echo "<li> </li>"; |
892 |
} |
893 |
// Add common items
|
894 |
echo "<li>"; |
895 |
|
896 |
// Display MENU ALL
|
897 |
echo "<div id='show_all_menu' onmouseover=\"completecleandisplay('show_all_menu');\">"; |
898 |
$items_per_columns=15; |
899 |
$i=-1; |
900 |
echo "<table><tr><td valign='top'><table>"; |
901 |
foreach ($menu as $part => $data){ |
902 |
if (isset($data['content'])&&count($data['content'])){ |
903 |
|
904 |
if ($i>$items_per_columns){ |
905 |
$i=0; |
906 |
echo "</table></td><td valign='top'><table>"; |
907 |
} |
908 |
$link="#"; |
909 |
if (isset($data['default'])&&!empty($data['default'])){ |
910 |
$link=$CFG_GLPI["root_doc"].$data['default']; |
911 |
} |
912 |
echo "<tr><td class='tab_bg_1'><strong><a href=\"$link\" title=\"".$data['title']."\" class='itemP'>".$data['title']."</a></strong></td></tr>"; |
913 |
$i++;
|
914 |
|
915 |
// list menu item
|
916 |
foreach ($data['content'] as $key => $val) { |
917 |
if ($i>$items_per_columns){ |
918 |
$i=0; |
919 |
echo "</table></td><td valign='top'><table>"; |
920 |
} |
921 |
if (isset($val['page'])&&isset($val['title'])){ |
922 |
echo "<tr><td><a href=\"".$CFG_GLPI["root_doc"].$val['page']."\""; |
923 |
if (isset($data['shortcut'])&&!empty($data['shortcut'])){ |
924 |
echo " accesskey=\"".$val['shortcut']."\" "; |
925 |
} |
926 |
|
927 |
echo ">".$val['title']."</a></td></tr>\n"; |
928 |
$i++;
|
929 |
} |
930 |
} |
931 |
} |
932 |
} |
933 |
echo "</table></td></tr></table>"; |
934 |
|
935 |
echo "</div>"; |
936 |
echo " "; |
937 |
echo "</li>"; |
938 |
|
939 |
// Bookmark load
|
940 |
echo "<li>"; |
941 |
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();\">"; |
942 |
echo " <img src='".$CFG_GLPI["root_doc"]."/pics/bookmark.png' title=\"".$LANG["buttons"][52]." ".$LANG["bookmark"][1]."\" alt=\"".$LANG["buttons"][52]." ".$LANG["bookmark"][1]."\" >"; |
943 |
echo " </a>"; |
944 |
echo "</li>"; |
945 |
|
946 |
|
947 |
/* echo "<li id='headercalendar'><img src='".$CFG_GLPI["root_doc"]."/pics/menu_calendar.png' alt='".$LANG["buttons"][15]."' title='".$LANG["buttons"][15]."'>";
|
948 |
|
949 |
echo "<script type='text/javascript'>";
|
950 |
echo "Calendar.setup(";
|
951 |
echo "{";
|
952 |
echo "ifFormat : '%Y-%m-%d',"; // the datetime format
|
953 |
echo "button : 'headercalendar' "; // ID of the button
|
954 |
echo "});";
|
955 |
echo "</script>";
|
956 |
echo "</li>";
|
957 |
*/
|
958 |
|
959 |
// MENU ALL
|
960 |
echo "<li >"; |
961 |
echo "<img alt='' src='".$CFG_GLPI["root_doc"]."/pics/menu_all.png' onclick=\"completecleandisplay('show_all_menu'); |
962 |
\">";
|
963 |
echo "</li>"; |
964 |
showProfileSelecter($CFG_GLPI["root_doc"]."/front/central.php"); |
965 |
echo "</ul>"; |
966 |
|
967 |
echo " </div>"; |
968 |
|
969 |
echo "</div>\n"; // fin header |
970 |
|
971 |
|
972 |
|
973 |
echo "<div id='page' >"; |
974 |
|
975 |
$CFG_GLPI["cache"]->end(); |
976 |
} |
977 |
|
978 |
if ($DB->isSlave() && !$DB->first_connection) |
979 |
{ |
980 |
echo "<div id='dbslave-float'>"; |
981 |
echo "<a href='#see_debug'>".$LANG["setup"][809]."</a>"; |
982 |
echo "</div>"; |
983 |
} |
984 |
|
985 |
// call function callcron() every 5min
|
986 |
if (isset($_SESSION["glpicrontimer"])){ |
987 |
if (abs(time()-$_SESSION["glpicrontimer"])>300){ |
988 |
callCron(); |
989 |
$_SESSION["glpicrontimer"]=time(); |
990 |
} |
991 |
} else $_SESSION["glpicrontimer"]=time(); |
992 |
|
993 |
displayMessageAfterRedirect(); |
994 |
} |
995 |
|
996 |
/**
|
997 |
* Display a div containing a message set in session in the previous page
|
998 |
*
|
999 |
*
|
1000 |
**/
|
1001 |
function displayMessageAfterRedirect(){ |
1002 |
// Affichage du message apres redirection
|
1003 |
if (isset($_SESSION["MESSAGE_AFTER_REDIRECT"])&&!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])){ |
1004 |
echo "<div class=\"box\" style=\"margin-bottom:20px;\">"; |
1005 |
echo "<div class=\"box-tleft\"><div class=\"box-tright\"><div class=\"box-tcenter\"></div></div></div>"; |
1006 |
echo "<div class=\"box-mleft\"><div class=\"box-mright\"><div class=\"box-mcenter\">"; |
1007 |
echo "<h3>".$_SESSION["MESSAGE_AFTER_REDIRECT"]."</h3>"; |
1008 |
echo "</div></div></div>"; |
1009 |
echo "<div class=\"box-bleft\"><div class=\"box-bright\"><div class=\"box-bcenter\"></div></div></div>"; |
1010 |
echo "</div>"; |
1011 |
|
1012 |
} |
1013 |
// Clean message
|
1014 |
$_SESSION["MESSAGE_AFTER_REDIRECT"]=""; |
1015 |
} |
1016 |
/**
|
1017 |
* Add a message to be displayed after redirect
|
1018 |
*
|
1019 |
* @param $msg Message to add
|
1020 |
* @param $check_once Check if the message is not already added
|
1021 |
**/
|
1022 |
function addMessageAfterRedirect($msg,$check_once=false){ |
1023 |
if (!empty($msg)){ |
1024 |
if ($check_once){ |
1025 |
if (strstr($_SESSION["MESSAGE_AFTER_REDIRECT"],$msg)===false){ |
1026 |
$_SESSION["MESSAGE_AFTER_REDIRECT"].=$msg.'<br>'; |
1027 |
} |
1028 |
} else {
|
1029 |
$_SESSION["MESSAGE_AFTER_REDIRECT"].=$msg.'<br>'; |
1030 |
} |
1031 |
} |
1032 |
} |
1033 |
|
1034 |
/**
|
1035 |
* Print a nice HTML head for help page
|
1036 |
*
|
1037 |
*
|
1038 |
* @param $title title of the page
|
1039 |
* @param $url not used anymore.
|
1040 |
**/
|
1041 |
function helpHeader($title,$url='') { |
1042 |
// Print a nice HTML-head for help page
|
1043 |
|
1044 |
global $CFG_GLPI,$LANG, $CFG_GLPI,$HEADER_LOADED,$PLUGIN_HOOKS ; |
1045 |
|
1046 |
if ($HEADER_LOADED) return; |
1047 |
$HEADER_LOADED=true; |
1048 |
|
1049 |
// Override list-limit if choosen
|
1050 |
if (isset($_POST['list_limit'])) { |
1051 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
1052 |
} |
1053 |
|
1054 |
|
1055 |
includeCommonHtmlHeader($title);
|
1056 |
|
1057 |
// Body
|
1058 |
echo "<body>"; |
1059 |
|
1060 |
// Main Headline
|
1061 |
echo "<div id='header'>"; |
1062 |
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>"; |
1063 |
|
1064 |
// Les préférences + lien déconnexion
|
1065 |
echo "<div id='c_preference' >"; |
1066 |
echo" <ul><li id='deconnexion'><a href=\"".$CFG_GLPI["root_doc"]."/logout.php\" title=\"".$LANG["central"][6]."\">".$LANG["central"][6]." </a>"; |
1067 |
echo "("; |
1068 |
echo formatUserName (0,$_SESSION["glpiname"],$_SESSION["glpirealname"],$_SESSION["glpifirstname"],0,20); |
1069 |
echo ")</li>\n"; |
1070 |
|
1071 |
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"; |
1072 |
echo " <li> <a href=\"".$CFG_GLPI["root_doc"]."/front/user.form.my.php\" title=\"".$LANG["Menu"][11]."\" >".$LANG["Menu"][11]." </a></li>\n"; |
1073 |
|
1074 |
echo "</ul>\n"; |
1075 |
echo "<div class='sep'></div>\n"; |
1076 |
echo "</div>\n"; |
1077 |
//-- Le moteur de recherche -->
|
1078 |
echo "<div id='c_recherche' >\n"; |
1079 |
/*
|
1080 |
echo "<form id='recherche' action=''>\n";
|
1081 |
echo " <div id='boutonRecherche'><input type='submit' value='OK' /></div>\n";
|
1082 |
echo " <div id='champRecherche'><input type='text' value='Recherche' /></div> \n";
|
1083 |
echo "</form>\n";
|
1084 |
*/
|
1085 |
echo "<div class='sep'></div>\n"; |
1086 |
echo "</div>"; |
1087 |
|
1088 |
//<!-- Le menu principal -->
|
1089 |
echo "<div id='c_menu'>"; |
1090 |
echo " <ul id='menu'>"; |
1091 |
|
1092 |
|
1093 |
// Build the navigation-elements
|
1094 |
|
1095 |
// Ticket
|
1096 |
if (haveRight("create_ticket","1")){ |
1097 |
echo " <li id='menu1' >"; |
1098 |
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.public.php\" title=\"".$LANG["job"][13]."\" class='itemP'>".$LANG["Menu"][31]."</a>"; |
1099 |
|
1100 |
echo "</li>"; |
1101 |
} |
1102 |
|
1103 |
// Suivi ticket
|
1104 |
if (haveRight("observe_ticket","1")){ |
1105 |
echo " <li id='menu2' >"; |
1106 |
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.public.php?show=user\" title=\"".$LANG["title"][10]."\" class='itemP'>".$LANG["title"][28]."</a>"; |
1107 |
|
1108 |
echo "</li>"; |
1109 |
} |
1110 |
// Reservation
|
1111 |
if (haveRight("reservation_helpdesk","1")){ |
1112 |
echo " <li id='menu3' >"; |
1113 |
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.resa.php\" title=\"".$LANG["Menu"][17]."\" class='itemP'>".$LANG["Menu"][17]."</a>"; |
1114 |
|
1115 |
echo "</li>"; |
1116 |
} |
1117 |
|
1118 |
// FAQ
|
1119 |
if (haveRight("faq","r")){ |
1120 |
echo " <li id='menu4' >"; |
1121 |
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/helpdesk.faq.php\" title=\"".$LANG["knowbase"][1]."\" class='itemP'>".$LANG["Menu"][20]."</a>"; |
1122 |
|
1123 |
echo "</li>"; |
1124 |
} |
1125 |
|
1126 |
// PLUGINS
|
1127 |
$plugins=array(); |
1128 |
if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"])&&count($PLUGIN_HOOKS["helpdesk_menu_entry"])) |
1129 |
foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) { |
1130 |
if ($active){ |
1131 |
$function="plugin_version_$plugin"; |
1132 |
|
1133 |
if (function_exists($function)) |
1134 |
$plugins[$plugin]=$function(); |
1135 |
} |
1136 |
} |
1137 |
|
1138 |
if (isset($plugins)&&count($plugins)>0){ |
1139 |
$list=array(); |
1140 |
foreach ($plugins as $key => $val) { |
1141 |
$list[$key]=$val["name"]; |
1142 |
} |
1143 |
asort($list); |
1144 |
echo " <li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\" >"; |
1145 |
echo "<a href='#' title=\"".$LANG["common"][29]."\" class='itemP'>".$LANG["common"][29]."</a>"; // default none |
1146 |
echo "<ul class='ssmenu'>"; |
1147 |
// list menu item
|
1148 |
foreach ($list as $key => $val) { |
1149 |
echo "<li><a href=\"".$CFG_GLPI["root_doc"]."/plugins/".$key."/\">".$plugins[$key]["name"]."</a></li>\n"; |
1150 |
} |
1151 |
echo "</ul>"; |
1152 |
echo "</li>"; |
1153 |
} |
1154 |
|
1155 |
|
1156 |
echo "</ul>"; |
1157 |
echo "<div class='sep'></div>"; |
1158 |
echo "</div>"; |
1159 |
|
1160 |
// End navigation bar
|
1161 |
|
1162 |
// End headline
|
1163 |
|
1164 |
///Le sous menu contextuel 1
|
1165 |
echo "<div id='c_ssmenu1' >"; |
1166 |
//echo "<ul>";
|
1167 |
//echo " <li><a href='' title='' >Suivi</a></li>";
|
1168 |
//echo " <li>Planning</li>";
|
1169 |
//echo " <li>Statistique</li>";
|
1170 |
//echo " <li>Helpdesk</li>";
|
1171 |
//echo "</ul>";
|
1172 |
echo "</div>"; |
1173 |
|
1174 |
// Le fil d arianne
|
1175 |
echo "<div id='c_ssmenu2' >"; |
1176 |
echo "<ul>"; |
1177 |
echo " <li><a href='#' title='' >Helpdesk > </a></li>"; |
1178 |
showProfileSelecter($CFG_GLPI["root_doc"]."/front/helpdesk.public.php"); |
1179 |
echo "</ul>"; |
1180 |
echo " </div>"; |
1181 |
|
1182 |
echo "</div>\n"; // fin header |
1183 |
|
1184 |
echo "<div id='page' >"; |
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
// call function callcron() every 5min
|
1191 |
if (isset($_SESSION["glpicrontimer"])){ |
1192 |
if (($_SESSION["glpicrontimer"]-time())>300){ |
1193 |
callCron(); |
1194 |
$_SESSION["glpicrontimer"]=time(); |
1195 |
} |
1196 |
} else $_SESSION["glpicrontimer"]=time(); |
1197 |
|
1198 |
displayMessageAfterRedirect(); |
1199 |
} |
1200 |
|
1201 |
|
1202 |
/**
|
1203 |
* Print a simple HTML head with links
|
1204 |
*
|
1205 |
*
|
1206 |
* @param $title title of the page
|
1207 |
* @param $links links to display
|
1208 |
**/
|
1209 |
function simpleHeader($title,$links=array()) { |
1210 |
// Print a nice HTML-head for help page
|
1211 |
|
1212 |
global $CFG_GLPI,$LANG, $CFG_GLPI,$HEADER_LOADED ; |
1213 |
|
1214 |
if ($HEADER_LOADED) return; |
1215 |
$HEADER_LOADED=true; |
1216 |
|
1217 |
// Override list-limit if choosen
|
1218 |
if (isset($_POST['list_limit'])) { |
1219 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
1220 |
} |
1221 |
|
1222 |
includeCommonHtmlHeader($title);
|
1223 |
|
1224 |
// Body
|
1225 |
echo "<body>"; |
1226 |
|
1227 |
// Main Headline
|
1228 |
echo "<div id='header'>"; |
1229 |
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>"; |
1230 |
|
1231 |
// Les préférences + lien déconnexion
|
1232 |
echo "<div id='c_preference' >"; |
1233 |
echo "<div class='sep'></div>\n"; |
1234 |
echo "</div>\n"; |
1235 |
//-- Le moteur de recherche -->
|
1236 |
echo "<div id='c_recherche' >\n"; |
1237 |
/*
|
1238 |
echo "<form id='recherche' action=''>\n";
|
1239 |
echo " <div id='boutonRecherche'><input type='submit' value='OK' /></div>\n";
|
1240 |
echo " <div id='champRecherche'><input type='text' value='Recherche' /></div> \n";
|
1241 |
echo "</form>\n";
|
1242 |
*/
|
1243 |
echo "<div class='sep'></div>\n"; |
1244 |
echo "</div>"; |
1245 |
|
1246 |
//<!-- Le menu principal -->
|
1247 |
echo "<div id='c_menu'>"; |
1248 |
echo " <ul id='menu'>"; |
1249 |
|
1250 |
// Build the navigation-elements
|
1251 |
if (count($links)){ |
1252 |
$i=1; |
1253 |
foreach ($links as $name => $link){ |
1254 |
echo " <li id='menu$i' >"; |
1255 |
echo "<a href=\"$link\" title=\"".$name."\" class='itemP'>".$name."</a>"; |
1256 |
echo "</li>"; |
1257 |
$i++;
|
1258 |
} |
1259 |
} |
1260 |
|
1261 |
echo "</ul>"; |
1262 |
echo "</div>"; |
1263 |
// End navigation bar
|
1264 |
|
1265 |
// End headline
|
1266 |
|
1267 |
///Le sous menu contextuel 1
|
1268 |
echo "<div id='c_ssmenu1' >"; |
1269 |
echo "</div>"; |
1270 |
|
1271 |
// Le fil d arianne
|
1272 |
echo "<div id='c_ssmenu2' >"; |
1273 |
echo " </div>"; |
1274 |
|
1275 |
echo "</div>\n"; // fin header |
1276 |
|
1277 |
echo "<div id='page' >"; |
1278 |
|
1279 |
// call function callcron() every 5min
|
1280 |
if (isset($_SESSION["glpicrontimer"])){ |
1281 |
if (($_SESSION["glpicrontimer"]-time())>300){ |
1282 |
callCron(); |
1283 |
$_SESSION["glpicrontimer"]=time(); |
1284 |
} |
1285 |
} else $_SESSION["glpicrontimer"]=time(); |
1286 |
|
1287 |
// displayMessageAfterRedirect();
|
1288 |
} |
1289 |
|
1290 |
|
1291 |
/**
|
1292 |
* Print a nice HTML head with no controls
|
1293 |
*
|
1294 |
*
|
1295 |
* @param $title title of the page
|
1296 |
* @param $url not used anymore.
|
1297 |
**/
|
1298 |
function nullHeader($title,$url='') { |
1299 |
global $CFG_GLPI,$HEADER_LOADED,$LANG ; |
1300 |
if ($HEADER_LOADED) return; |
1301 |
$HEADER_LOADED=true; |
1302 |
// Print a nice HTML-head with no controls
|
1303 |
|
1304 |
// Detect root_doc in case of error
|
1305 |
if (!isset($CFG_GLPI["root_doc"])){ |
1306 |
if ( !isset($_SERVER['REQUEST_URI']) ) { |
1307 |
$_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF']; |
1308 |
} |
1309 |
$currentdir=getcwd(); |
1310 |
chdir(GLPI_ROOT); |
1311 |
$glpidir=str_replace(str_replace('\\', '/',getcwd()),"",str_replace('\\', '/',$currentdir)); |
1312 |
chdir($currentdir); |
1313 |
|
1314 |
$globaldir=preg_replace("/\/[0-9a-zA-Z\.\-\_]+\.php/","",$_SERVER['REQUEST_URI']); |
1315 |
$globaldir=preg_replace("/\?.*/","",$globaldir); |
1316 |
$CFG_GLPI["root_doc"]=str_replace($glpidir,"",$globaldir); |
1317 |
$CFG_GLPI["root_doc"]=preg_replace("/\/$/","",$CFG_GLPI["root_doc"]); |
1318 |
$CFG_GLPI["logotxt"]=""; |
1319 |
} |
1320 |
|
1321 |
// Send UTF8 Headers
|
1322 |
header("Content-Type: text/html; charset=UTF-8"); |
1323 |
|
1324 |
// Override list-limit if choosen
|
1325 |
if (isset($_POST['list_limit'])) { |
1326 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
1327 |
} |
1328 |
|
1329 |
// Send extra expires header if configured
|
1330 |
if (!empty($CFG_GLPI["sendexpire"])) { |
1331 |
header_nocache(); |
1332 |
} |
1333 |
|
1334 |
if (isCommandLine()){
|
1335 |
return true; |
1336 |
} |
1337 |
|
1338 |
|
1339 |
includeCommonHtmlHeader($title);
|
1340 |
|
1341 |
|
1342 |
// Body with configured stuff
|
1343 |
echo "<body>"; |
1344 |
|
1345 |
echo "<div id='contenu-nullHeader'>"; |
1346 |
|
1347 |
echo "<div id='text-nullHeader'>"; |
1348 |
} |
1349 |
|
1350 |
/**
|
1351 |
* Print a nice HTML head for popup window (nothing to display)
|
1352 |
*
|
1353 |
*
|
1354 |
* @param $title title of the page
|
1355 |
* @param $url not used anymore.
|
1356 |
**/
|
1357 |
function popHeader($title,$url='') |
1358 |
{ |
1359 |
// Print a nice HTML-head for every page
|
1360 |
|
1361 |
global $CFG_GLPI,$LANG,$PLUGIN_HOOKS,$HEADER_LOADED ; |
1362 |
|
1363 |
if ($HEADER_LOADED) return; |
1364 |
$HEADER_LOADED=true; |
1365 |
|
1366 |
|
1367 |
// Override list-limit if choosen
|
1368 |
if (isset($_POST['list_limit'])) { |
1369 |
$_SESSION['glpilist_limit']=$_POST['list_limit']; |
1370 |
} |
1371 |
|
1372 |
includeCommonHtmlHeader($title); // Body |
1373 |
|
1374 |
echo "<body>"; |
1375 |
|
1376 |
displayMessageAfterRedirect(); |
1377 |
} |
1378 |
|
1379 |
/**
|
1380 |
* Print footer for a popup window
|
1381 |
*
|
1382 |
*
|
1383 |
**/
|
1384 |
function popFooter() { |
1385 |
global $FOOTER_LOADED; |
1386 |
|
1387 |
if ($FOOTER_LOADED) return; |
1388 |
$FOOTER_LOADED=true; |
1389 |
|
1390 |
// Print foot
|
1391 |
|
1392 |
echo "</body></html>"; |
1393 |
} |
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
/**
|
1406 |
* Print footer for every page
|
1407 |
*
|
1408 |
* @param $keepDB booleen, closeDBConnections if false
|
1409 |
*
|
1410 |
**/
|
1411 |
function commonFooter($keepDB=false) { |
1412 |
// Print foot for every page
|
1413 |
|
1414 |
global $LANG,$CFG_GLPI,$DEBUG_SQL,$TIMER_DEBUG,$SQL_TOTAL_TIMER,$SQL_TOTAL_REQUEST,$FOOTER_LOADED; |
1415 |
|
1416 |
if ($FOOTER_LOADED) return; |
1417 |
$FOOTER_LOADED=true; |
1418 |
|
1419 |
echo "</div>"; // fin de la div id ='page' initiée dans la fonction header |
1420 |
|
1421 |
echo "<div id='footer' >"; |
1422 |
echo "<table width='100%'><tr><td class='left'><span class='copyright'>"; |
1423 |
echo $TIMER_DEBUG->Get_Time()."s - "; |
1424 |
if (function_exists("memory_get_usage")){ |
1425 |
echo memory_get_usage();
|
1426 |
} |
1427 |
echo "</span></td>"; |
1428 |
|
1429 |
if (!empty($CFG_GLPI["founded_new_version"])) |
1430 |
echo "<td class='copyright'>".$LANG["setup"][301]." ".$CFG_GLPI["founded_new_version"]."<br>".$LANG["setup"][302]."</td>"; |
1431 |
|
1432 |
echo "<td class='right'>"; |
1433 |
echo "<a href=\"http://glpi-project.org/\">"; |
1434 |
echo "<span class='copyright'>GLPI ".$CFG_GLPI["version"]." Copyright (C) 2003-".date("Y")." by the INDEPNET Development Team.</span>"; |
1435 |
echo "</a>"; |
1436 |
|
1437 |
echo "</td></tr>"; |
1438 |
echo "</table></div>"; |
1439 |
|
1440 |
|
1441 |
|
1442 |
if ($CFG_GLPI["debug"]==1){ // debug mode traduction |
1443 |
|
1444 |
echo "<div id='debug-float'>"; |
1445 |
echo "<a href='#see_debug'>GLPI MODE TRANSLATION</a>"; |
1446 |
echo "</div>"; |
1447 |
} |
1448 |
|
1449 |
if ($CFG_GLPI["debug"]==2){ // mode debug |
1450 |
|
1451 |
echo "<div id='debug-float'>"; |
1452 |
echo "<a href='#see_debug'>GLPI MODE DEBUG</a>"; |
1453 |
echo "</div>"; |
1454 |
|
1455 |
|
1456 |
|
1457 |
echo "<div id='debug'>"; |
1458 |
echo "<h1><a id='see_debug' name='see_debug'>GLPI MODE DEBUG</a></h1>"; |
1459 |
|
1460 |
if ($CFG_GLPI["debug_sql"]){ |
1461 |
echo "<h2>SQL REQUEST : "; |
1462 |
|
1463 |
echo $SQL_TOTAL_REQUEST." Queries "; |
1464 |
if ($CFG_GLPI["debug_profile"]){ |
1465 |
echo "took ".array_sum($DEBUG_SQL['times'])."s </h2>"; |
1466 |
} |
1467 |
|
1468 |
echo "<table class='tab_cadre' ><tr><th>N° </th><th>Queries</th><th>Time</th><th>Errors</th></tr>"; |
1469 |
|
1470 |
foreach ($DEBUG_SQL['queries'] as $num => $query){ |
1471 |
echo "<tr class='tab_bg_".(($num%2)+1)."'><td>$num</td><td>"; |
1472 |
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))))))))); |
1473 |
echo "</td><td>"; |
1474 |
echo $DEBUG_SQL['times'][$num]; |
1475 |
echo "</td><td>"; |
1476 |
if (isset($DEBUG_SQL['errors'][$num])){ |
1477 |
echo $DEBUG_SQL['errors'][$num]; |
1478 |
} else {
|
1479 |
echo " "; |
1480 |
} |
1481 |
echo "</td></tr>"; |
1482 |
} |
1483 |
echo "</table>"; |
1484 |
|
1485 |
// Reset, as further request will not be displayed
|
1486 |
$CFG_GLPI["debug_sql"]=false; |
1487 |
} |
1488 |
|
1489 |
|
1490 |
|
1491 |
if ($CFG_GLPI["debug_vars"]){ |
1492 |
echo "<h2>POST VARIABLE</h2>"; |
1493 |
printCleanArray($_POST);
|
1494 |
echo "<h2>GET VARIABLE</h2>"; |
1495 |
printCleanArray($_GET);
|
1496 |
echo "<h2>SESSION VARIABLE</h2>"; |
1497 |
printCleanArray($_SESSION);
|
1498 |
} |
1499 |
|
1500 |
|
1501 |
|
1502 |
echo "</div>"; |
1503 |
} |
1504 |
echo "</body></html>"; |
1505 |
|
1506 |
if (!$keepDB) { |
1507 |
closeDBConnections(); |
1508 |
} |
1509 |
} |
1510 |
|
1511 |
/**
|
1512 |
* Print footer for help page
|
1513 |
*
|
1514 |
*
|
1515 |
**/
|
1516 |
function helpFooter() { |
1517 |
// Print foot for help page
|
1518 |
global $CFG_GLPI,$FOOTER_LOADED; |
1519 |
|
1520 |
if ($FOOTER_LOADED) return; |
1521 |
$FOOTER_LOADED=true; |
1522 |
|
1523 |
echo "</div>"; // fin de la div id ='page' initiée dans la fonction header |
1524 |
|
1525 |
echo "<div id='footer'>"; |
1526 |
echo "<table width='100%'><tr>"; |
1527 |
echo "<td class='right'>"; |
1528 |
echo "<a href=\"http://glpi-project.org/\">"; |
1529 |
echo "<span class='copyright'>GLPI ".$CFG_GLPI["version"]." Copyright (C) 2003-".date("Y")." by the INDEPNET Development Team.</span>"; |
1530 |
echo "</a></tr></table>"; |
1531 |
echo "</div>"; |
1532 |
|
1533 |
echo "</body></html>"; |
1534 |
closeDBConnections(); |
1535 |
} |
1536 |
|
1537 |
/**
|
1538 |
* Print footer for null page
|
1539 |
*
|
1540 |
*
|
1541 |
**/
|
1542 |
function nullFooter() { |
1543 |
// Print foot for null page
|
1544 |
global $CFG_GLPI,$FOOTER_LOADED; |
1545 |
|
1546 |
if ($FOOTER_LOADED) return; |
1547 |
$FOOTER_LOADED=true; |
1548 |
|
1549 |
if (!isCommandLine()){
|
1550 |
echo "</div>"; // fin box text-nullHeader ouvert dans le null header |
1551 |
echo "</div>"; // fin contenu-nullHeader ouvert dans le null header |
1552 |
|
1553 |
|
1554 |
echo "<div id='footer-login'>"; |
1555 |
echo "<a href=\"http://glpi-project.org/\" title=\"Powered By Indepnet\" >"; |
1556 |
echo 'GLPI version '.(isset($CFG_GLPI["version"])?$CFG_GLPI["version"]:"").' Copyright (C) 2003-'.date("Y").' INDEPNET Development Team.'; |
1557 |
echo "</a>"; |
1558 |
echo "</div>"; |
1559 |
|
1560 |
echo "</body></html>"; |
1561 |
} |
1562 |
|
1563 |
closeDBConnections(); |
1564 |
} |
1565 |
|
1566 |
|
1567 |
/**
|
1568 |
* Print the helpdesk
|
1569 |
*
|
1570 |
* @param $ID int : ID of the user who want to display the Helpdesk
|
1571 |
* @param $from_helpdesk int : is display from the helpdesk.php ?
|
1572 |
* @return nothing (print the helpdesk)
|
1573 |
*/
|
1574 |
function printHelpDesk ($ID,$from_helpdesk) { |
1575 |
|
1576 |
global $DB,$CFG_GLPI,$LANG; |
1577 |
|
1578 |
if (!haveRight("create_ticket","1")) return false; |
1579 |
|
1580 |
$query = "SELECT email,realname,firstname,name FROM glpi_users WHERE (ID = '$ID')"; |
1581 |
$result=$DB->query($query); |
1582 |
$email = $DB->result($result,0,"email"); |
1583 |
|
1584 |
// Get saved data from a back system
|
1585 |
$emailupdates = 1; |
1586 |
if ($email=="") $emailupdates=0; |
1587 |
$device_type = 0; |
1588 |
$computer=""; |
1589 |
$contents=""; |
1590 |
$title=""; |
1591 |
$category = 0; |
1592 |
$priority = 3; |
1593 |
|
1594 |
|
1595 |
if (isset($_SESSION["helpdeskSaved"]["emailupdates"])) |
1596 |
$emailupdates = stripslashes($_SESSION["helpdeskSaved"]["emailupdates"]); |
1597 |
if (isset($_SESSION["helpdeskSaved"]["email"])) |
1598 |
$email = stripslashes($_SESSION["helpdeskSaved"]["uemail"]); |
1599 |
if (isset($_SESSION["helpdeskSaved"]["device_type"])) |
1600 |
$device_type = stripslashes($_SESSION["helpdeskSaved"]["device_type"]); |
1601 |
if (isset($_SESSION["helpdeskSaved"]["contents"])) |
1602 |
$contents = stripslashes($_SESSION["helpdeskSaved"]["contents"]); |
1603 |
if (isset($_SESSION["helpdeskSaved"]["name"])) |
1604 |
$title = stripslashes($_SESSION["helpdeskSaved"]["name"]); |
1605 |
if (isset($_SESSION["helpdeskSaved"]["category"])) |
1606 |
$category = stripslashes($_SESSION["helpdeskSaved"]["category"]); |
1607 |
if (isset($_SESSION["helpdeskSaved"]["priority"])) |
1608 |
$priority = stripslashes($_SESSION["helpdeskSaved"]["priority"]); |
1609 |
unset($_SESSION["helpdeskSaved"]); |
1610 |
|
1611 |
|
1612 |
echo "<form method='post' name=\"helpdeskform\" action=\"".$CFG_GLPI["root_doc"]."/front/tracking.injector.php\" enctype=\"multipart/form-data\">"; |
1613 |
echo "<input type='hidden' name='_from_helpdesk' value='$from_helpdesk'>"; |
1614 |
echo "<input type='hidden' name='request_type' value='1'>"; |
1615 |
echo "<input type='hidden' name='FK_entities' value='".$_SESSION["glpiactive_entity"]."'>"; |
1616 |
echo "<div class='center'><table class='tab_cadre'>"; |
1617 |
|
1618 |
echo "<tr><th colspan='2'>".$LANG["help"][1].": "; |
1619 |
if (isMultiEntitiesMode()){
|
1620 |
echo " (".getDropdownName("glpi_entities",$_SESSION["glpiactive_entity"]).")"; |
1621 |
} |
1622 |
|
1623 |
echo "</th></tr>"; |
1624 |
echo "<tr class='tab_bg_1'>"; |
1625 |
echo "<td>".$LANG["help"][2].": </td>"; |
1626 |
echo "<td>"; |
1627 |
dropdownPriority("priority",$priority); |
1628 |
echo "</td></tr>"; |
1629 |
if(isAuthorMailingActivatedForHelpdesk()){
|
1630 |
echo "<tr class='tab_bg_1'>"; |
1631 |
echo "<td>".$LANG["help"][8].":</td>"; |
1632 |
echo "<td>"; |
1633 |
dropdownYesNo('emailupdates',$emailupdates); |
1634 |
echo "</td></tr>"; |
1635 |
echo "<tr class='tab_bg_1'>"; |
1636 |
echo "<td>".$LANG["help"][11].":</td>"; |
1637 |
echo "<td> <input name='uemail' value=\"$email\" size='50' onchange=\"emailupdates.value='1'\">"; |
1638 |
echo "</td></tr>"; |
1639 |
} |
1640 |
|
1641 |
if ($_SESSION["glpiactiveprofile"]["helpdesk_hardware"]!=0){ |
1642 |
echo "<tr class='tab_bg_1'>"; |
1643 |
echo "<td>".$LANG["help"][24].": </td>"; |
1644 |
echo "<td class='center'>"; |
1645 |
dropdownMyDevices($_SESSION["glpiID"],$_SESSION["glpiactive_entity"]); |
1646 |
|
1647 |
dropdownTrackingAllDevices("device_type",$device_type,0,$_SESSION["glpiactive_entity"]); |
1648 |
echo "</td></tr>"; |
1649 |
} |
1650 |
|
1651 |
echo "<tr class='tab_bg_1'>"; |
1652 |
echo "<td>".$LANG["common"][36].":</td><td>"; |
1653 |
|
1654 |
dropdownValue("glpi_dropdown_tracking_category","category",$category); |
1655 |
echo "</td>"; |
1656 |
echo "</tr>"; |
1657 |
|
1658 |
echo "<tr class='tab_bg_1'>"; |
1659 |
echo "<td colspan='2' align='center'>".$LANG["help"][13].":</td>"; |
1660 |
echo "</tr>"; |
1661 |
echo "<tr class='tab_bg_1'>"; |
1662 |
echo "<td class='center'>".$LANG["common"][57].":</td>"; |
1663 |
echo "<td class='center'><input type='text' maxlength='250' size='80' name='name' value=\"$title\"></td>"; |
1664 |
echo "</tr>"; |
1665 |
|
1666 |
echo "<tr class='tab_bg_1'>"; |
1667 |
echo "<td colspan='2' align='center'><textarea name='contents' cols='80' rows='14' >$contents</textarea>"; |
1668 |
echo "</td></tr>"; |
1669 |
|
1670 |
$max_size=return_bytes_from_ini_vars(ini_get("upload_max_filesize")); |
1671 |
$max_size/=1024*1024; |
1672 |
$max_size=round($max_size,1); |
1673 |
|
1674 |
echo "<tr class='tab_bg_1'><td>".$LANG["document"][2]." (".$max_size." Mb max): "; |
1675 |
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')\">"; |
1676 |
echo "</td>"; |
1677 |
echo "<td><input type='file' name='filename' value=\"\" size='25'></td>"; |
1678 |
echo "</tr>"; |
1679 |
|
1680 |
echo "<tr class='tab_bg_1'>"; |
1681 |
echo "<td colspan='2' class='center'> <input type='submit' value=\"".$LANG["help"][14]."\" class='submit'>"; |
1682 |
echo "</td></tr>"; |
1683 |
|
1684 |
echo "</table>"; |
1685 |
echo "</div>"; |
1686 |
echo "</form>"; |
1687 |
|
1688 |
} |
1689 |
|
1690 |
/**
|
1691 |
* Display the list_limit combo choice
|
1692 |
*
|
1693 |
*
|
1694 |
* @param $action page would be posted when change the value (URL + param)
|
1695 |
* @return nothing (print a combo)
|
1696 |
*
|
1697 |
*/
|
1698 |
function printPagerForm ($action) { |
1699 |
global $LANG; |
1700 |
|
1701 |
echo "<form method='POST' action=\"$action\">\n"; |
1702 |
echo "<span>".$LANG["pager"][4]." </span>"; |
1703 |
echo "<select name='list_limit' onChange='submit()'>"; |
1704 |
|
1705 |
for ($i=5;$i<20;$i+=5) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1706 |
for ($i=20;$i<50;$i+=10) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1707 |
for ($i=50;$i<250;$i+=50) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1708 |
for ($i=250;$i<1000;$i+=250) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1709 |
for ($i=1000;$i<5000;$i+=1000) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1710 |
for ($i=5000;$i<=10000;$i+=5000) echo "<option value='$i' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==$i)?" selected ":"").">$i</option>\n"; |
1711 |
echo "<option value='9999999' ".((isset($_SESSION["glpilist_limit"])&&$_SESSION["glpilist_limit"]==9999999)?" selected ":"").">9999999</option>\n"; |
1712 |
|
1713 |
echo "</select><span> "; |
1714 |
echo $LANG["pager"][5]; |
1715 |
echo "</span>"; |
1716 |
echo "</form>\n"; |
1717 |
} |
1718 |
|
1719 |
/**
|
1720 |
* Print pager for search option (first/previous/next/last)
|
1721 |
*
|
1722 |
*
|
1723 |
*
|
1724 |
* @param $start from witch item we start
|
1725 |
* @param $numrows total items
|
1726 |
* @param $target page would be open when click on the option (last,previous etc)
|
1727 |
* @param $parameters parameters would be passed on the URL.
|
1728 |
* @param $item_type_output item type display - if >0 display export PDF et Sylk form
|
1729 |
* @param $item_type_output_param item type parameter for export
|
1730 |
* @return nothing (print a pager)
|
1731 |
*
|
1732 |
*/
|
1733 |
function printPager($start,$numrows,$target,$parameters,$item_type_output=0,$item_type_output_param=0) { |
1734 |
|
1735 |
global $CFG_GLPI, $LANG,$CFG_GLPI; |
1736 |
|
1737 |
// Forward is the next step forward
|
1738 |
$forward = $start+$_SESSION["glpilist_limit"]; |
1739 |
|
1740 |
// This is the end, my friend
|
1741 |
$end = $numrows-$_SESSION["glpilist_limit"]; |
1742 |
|
1743 |
// Human readable count starts here
|
1744 |
$current_start=$start+1; |
1745 |
|
1746 |
// And the human is viewing from start to end
|
1747 |
$current_end = $current_start+$_SESSION["glpilist_limit"]-1; |
1748 |
if ($current_end>$numrows) { |
1749 |
$current_end = $numrows; |
1750 |
} |
1751 |
|
1752 |
// Backward browsing
|
1753 |
if ($current_start-$_SESSION["glpilist_limit"]<=0) { |
1754 |
$back=0; |
1755 |
} else {
|
1756 |
$back=$start-$_SESSION["glpilist_limit"]; |
1757 |
} |
1758 |
|
1759 |
// Print it
|
1760 |
|
1761 |
echo "<table class='tab_cadre_pager'>\n"; |
1762 |
echo "<tr>\n"; |
1763 |
|
1764 |
// Back and fast backward button
|
1765 |
if (!$start==0) { |
1766 |
echo "<th class='left'>"; |
1767 |
echo "<a href=\"$target?$parameters&start=0\">"; |
1768 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/first.png\" alt='".$LANG["buttons"][33]."' title='".$LANG["buttons"][33]."'>"; |
1769 |
|
1770 |
|
1771 |
echo "</a></th>\n"; |
1772 |
echo "<th class='left'>"; |
1773 |
echo "<a href=\"$target?$parameters&start=$back\">"; |
1774 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/left.png\" alt='".$LANG["buttons"][12]."' title='".$LANG["buttons"][12]."'>"; |
1775 |
echo "</a></th>\n"; |
1776 |
} |
1777 |
|
1778 |
// Print the "where am I?"
|
1779 |
echo "<td width='50%' class='tab_bg_2'>"; |
1780 |
printPagerForm("$target?$parameters&start=$start");
|
1781 |
echo "</td>\n"; |
1782 |
|
1783 |
if ($item_type_output>0&&isset($_SESSION["glpiactiveprofile"])&&$_SESSION["glpiactiveprofile"]["interface"]=="central"){ |
1784 |
echo "<td class='tab_bg_2' width='30%'>" ; |
1785 |
echo "<form method='GET' action=\"".$CFG_GLPI["root_doc"]."/front/report.dynamic.php\" target='_blank'>\n"; |
1786 |
echo "<input type='hidden' name='item_type' value='$item_type_output'>"; |
1787 |
if ($item_type_output_param!=0) |
1788 |
echo "<input type='hidden' name='item_type_param' value='".serialize($item_type_output_param)."'>"; |
1789 |
$split=split("&",$parameters); |
1790 |
for ($i=0;$i<count($split);$i++){ |
1791 |
$pos=strpos($split[$i],'='); |
1792 |
echo "<input type='hidden' name=\"".substr($split[$i],0,$pos)."\" value=\"".substr($split[$i],$pos+1)."\">"; |
1793 |
} |
1794 |
echo "<select name='display_type'>"; |
1795 |
echo "<option value='".PDF_OUTPUT_LANDSCAPE."'>".$LANG["buttons"][27]." ".$LANG["common"][68]."</option>"; |
1796 |
echo "<option value='".PDF_OUTPUT_PORTRAIT."'>".$LANG["buttons"][27]." ".$LANG["common"][69]."</option>"; |
1797 |
echo "<option value='".SYLK_OUTPUT."'>".$LANG["buttons"][28]."</option>"; |
1798 |
echo "<option value='".CSV_OUTPUT."'>".$LANG["buttons"][44]."</option>"; |
1799 |
echo "<option value='-".PDF_OUTPUT_LANDSCAPE."'>".$LANG["buttons"][29]." ".$LANG["common"][68]."</option>"; |
1800 |
echo "<option value='-".PDF_OUTPUT_PORTRAIT."'>".$LANG["buttons"][29]." ".$LANG["common"][69]."</option>"; |
1801 |
echo "<option value='-".SYLK_OUTPUT."'>".$LANG["buttons"][30]."</option>"; |
1802 |
echo "<option value='-".CSV_OUTPUT."'>".$LANG["buttons"][45]."</option>"; |
1803 |
echo "</select>"; |
1804 |
echo " <input type='image' name='export' src='".$CFG_GLPI["root_doc"]."/pics/greenbutton.png' title='".$LANG["buttons"][31]."' value='".$LANG["buttons"][31]."'>"; |
1805 |
echo "</form>"; |
1806 |
echo "</td>" ; |
1807 |
} |
1808 |
|
1809 |
echo "<td width='50%' class='tab_bg_2'><strong>"; |
1810 |
|
1811 |
echo $LANG["pager"][2]." ".$current_start." ".$LANG["pager"][1]." ".$current_end." ".$LANG["pager"][3]." ".$numrows." "; |
1812 |
echo "</strong></td>\n"; |
1813 |
|
1814 |
// Forward and fast forward button
|
1815 |
if ($forward<$numrows) { |
1816 |
echo "<th class='right'>"; |
1817 |
echo "<a href=\"$target?$parameters&start=$forward\">"; |
1818 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/right.png\" alt='".$LANG["buttons"][11]."' title='".$LANG["buttons"][11]."'>"; |
1819 |
echo "</a></th>\n"; |
1820 |
echo "<th class='right'>"; |
1821 |
echo "<a href=\"$target?$parameters&start=$end\">"; |
1822 |
echo "<img src=\"".$CFG_GLPI["root_doc"]."/pics/last.png\" alt='".$LANG["buttons"][32]."' title='".$LANG["buttons"][32]."'>"; |
1823 |
echo "</a></th>\n"; |
1824 |
} |
1825 |
|
1826 |
// End pager
|
1827 |
echo "</tr>\n"; |
1828 |
echo "</table><br>\n"; |
1829 |
|
1830 |
} |
1831 |
|
1832 |
|
1833 |
/**
|
1834 |
* Display calendar form
|
1835 |
*
|
1836 |
* @param $form form in which the calendar is display
|
1837 |
* @param $element name of the element
|
1838 |
* @param $value default value to display
|
1839 |
* @param $can_edit could not modify element
|
1840 |
* @param $with_time use datetime format instead of date format ?
|
1841 |
* @param $with_reset do not display reset button
|
1842 |
* @return nothing
|
1843 |
*/
|
1844 |
function showCalendarForm($form,$element,$value='',$can_edit=true,$with_time=false,$with_reset=true){ |
1845 |
global $LANG,$CFG_GLPI; |
1846 |
$rand=mt_rand();
|
1847 |
if (empty($value)) { |
1848 |
if ($with_time) $value=date("Y-m-d H:i"); |
1849 |
else $value=date("Y-m-d"); |
1850 |
} |
1851 |
|
1852 |
$size=10; |
1853 |
$dvalue=$value; |
1854 |
if ($with_time) { |
1855 |
$size=18; |
1856 |
$dvalue=convDateTime($value); |
1857 |
} else {
|
1858 |
$dvalue=convDate($value); |
1859 |
} |
1860 |
|
1861 |
echo "<input id='show$rand' type='text' name='____".$element."_show' readonly size='$size' value=\"".$dvalue."\">"; |
1862 |
echo "<input id='data$rand' type='hidden' name='$element' size='$size' value=\"".$value."\">"; |
1863 |
|
1864 |
if ($can_edit){ |
1865 |
echo " <img id='button$rand' src='".$CFG_GLPI["root_doc"]."/pics/calendar.png' class='calendrier' alt='".$LANG["buttons"][15]."' title='".$LANG["buttons"][15]."'>"; |
1866 |
|
1867 |
if ($with_reset){ |
1868 |
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'>"; |
1869 |
} |
1870 |
|
1871 |
echo "<script type='text/javascript'>"; |
1872 |
echo "Calendar.setup("; |
1873 |
echo "{"; |
1874 |
echo "inputField : 'data$rand',"; // ID of the input field |
1875 |
if ($with_time){ |
1876 |
echo "ifFormat : '%Y-%m-%d %H:%M',"; // the date format |
1877 |
echo "showsTime : true,"; |
1878 |
} |
1879 |
else {
|
1880 |
echo "ifFormat : '%Y-%m-%d',"; // the datetime format |
1881 |
} |
1882 |
echo "button : 'button$rand'"; // ID of the button |
1883 |
echo "});"; |
1884 |
echo "</script>"; |
1885 |
|
1886 |
echo "<script type='text/javascript' >\n"; |
1887 |
echo " new Form.Element.Observer('data$rand', 1, \n"; |
1888 |
echo " function(element, value) {\n"; |
1889 |
if (!$CFG_GLPI["dateformat"]){ |
1890 |
echo "window.document.getElementById('show$rand').value=value;"; |
1891 |
} else {
|
1892 |
if ($with_time){ |
1893 |
echo "if (value!='0000-00-00 00:00'){"; |
1894 |
echo "var d=Date.parseDate(value,'%Y-%m-%d %H:%M');"; |
1895 |
echo "window.document.getElementById('show$rand').value=d.print('%d-%m-%Y %H:%M');"; |
1896 |
echo "}"; |
1897 |
} else {
|
1898 |
echo "if (value!='0000-00-00'){"; |
1899 |
echo "var d=Date.parseDate(value,'%Y-%m-%d');"; |
1900 |
echo "window.document.getElementById('show$rand').value=d.print('%d-%m-%Y');"; |
1901 |
echo "}"; |
1902 |
} |
1903 |
} |
1904 |
echo "})\n"; |
1905 |
echo "</script>\n"; |
1906 |
} |
1907 |
} |
1908 |
|
1909 |
/**
|
1910 |
* show notes for item
|
1911 |
*
|
1912 |
* @param $target target page to update item
|
1913 |
* @param $type item type of the device to display notes
|
1914 |
* @param $id id of the device to display notes
|
1915 |
* @return nothing
|
1916 |
*/
|
1917 |
function showNotesForm($target,$type,$id){ |
1918 |
global $LANG; |
1919 |
|
1920 |
if (!haveRight("notes","r")) return false; |
1921 |
//new objet
|
1922 |
$ci =new CommonItem; |
1923 |
//getFromDB
|
1924 |
$ci->getFromDB ($type,$id); |
1925 |
|
1926 |
|
1927 |
echo "<form name='form' method='post' action=\"".$target."\">"; |
1928 |
echo "<div class='center'>"; |
1929 |
echo "<table class='tab_cadre_fixe' >"; |
1930 |
echo "<tr><th align='center' >"; |
1931 |
echo $LANG["title"][37]; |
1932 |
echo "</th></tr>"; |
1933 |
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>"; |
1934 |
echo "<tr><td class='tab_bg_2' align='center' >\n"; |
1935 |
echo "<input type='hidden' name='ID' value=$id>"; |
1936 |
if (haveRight("notes","w")) |
1937 |
echo "<input type='submit' name='update' value=\"".$LANG["buttons"][7]."\" class='submit'>"; |
1938 |
echo "</td></tr>\n"; |
1939 |
echo "</table></div></form>"; |
1940 |
} |
1941 |
|
1942 |
/**
|
1943 |
* Set page not to use the cache
|
1944 |
*
|
1945 |
*
|
1946 |
**/
|
1947 |
function header_nocache(){ |
1948 |
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 |
1949 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date du passe |
1950 |
} |
1951 |
|
1952 |
/**
|
1953 |
* Flush the current displayed items (do not works really fine)
|
1954 |
*
|
1955 |
*
|
1956 |
**/
|
1957 |
function glpi_flush(){ |
1958 |
flush();
|
1959 |
if (function_exists("ob_flush") && ob_get_length () !== FALSE) ob_flush(); |
1960 |
} |
1961 |
|
1962 |
/**
|
1963 |
* Display a simple progress bar
|
1964 |
* @param $width Width of the progress bar
|
1965 |
* @param $percent Percent of the progress bar
|
1966 |
* @return nothing
|
1967 |
*
|
1968 |
*
|
1969 |
**/
|
1970 |
function displayProgressBar($width,$percent){ |
1971 |
global $LANG; |
1972 |
$percentwidth=floor($percent*$width/100); |
1973 |
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); |
1974 |
glpi_flush(); |
1975 |
} |
1976 |
/**
|
1977 |
* Clean Printing of and array in a table
|
1978 |
* @param $tab the array to display
|
1979 |
* @param $pad Pad used
|
1980 |
* @return nothing
|
1981 |
*
|
1982 |
*
|
1983 |
**/
|
1984 |
function printCleanArray($tab,$pad=0){ |
1985 |
if (count($tab)){ |
1986 |
echo "<table class='tab_cadre'>"; |
1987 |
echo "<tr><th>KEY</th><th>=></th><th>VALUE</th></tr>"; |
1988 |
foreach($tab as $key => $val){ |
1989 |
echo "<tr class='tab_bg_1'><td valign='top' align='right'>"; |
1990 |
echo $key; |
1991 |
echo "</td><td valign='top'>=></td><td valign='top' class='tab_bg_1'>"; |
1992 |
if (is_array($val)){ |
1993 |
printCleanArray($val,$pad+1); |
1994 |
} |
1995 |
else echo $val; |
1996 |
echo "</td></tr>"; |
1997 |
} |
1998 |
echo "</table>"; |
1999 |
} |
2000 |
} |
2001 |
|
2002 |
/**
|
2003 |
* Display a Link to the last page using http_referer if available else use history.back
|
2004 |
*
|
2005 |
*
|
2006 |
**/
|
2007 |
function displayBackLink(){ |
2008 |
global $LANG; |
2009 |
if (isset($_SERVER['HTTP_REFERER'])){ |
2010 |
echo "<a href='".$_SERVER['HTTP_REFERER']."'>".$LANG["buttons"][13]."</a>"; |
2011 |
} else {
|
2012 |
echo "<a href='javascript:history.back();'>".$LANG["buttons"][13]."</a>"; |
2013 |
} |
2014 |
} |
2015 |
|
2016 |
/**
|
2017 |
* Print the form used to select profile if several are available
|
2018 |
* @param $target target of the form
|
2019 |
* @return nothing
|
2020 |
*
|
2021 |
*
|
2022 |
**/
|
2023 |
function showProfileSelecter($target){ |
2024 |
global $CFG_GLPI, $LANG; |
2025 |
|
2026 |
if (count($_SESSION["glpiprofiles"])>1){ |
2027 |
echo '<li><form name="form" method="post" action="'.$target.'">'; |
2028 |
echo '<select name="newprofile" onChange="submit()">'; |
2029 |
foreach ($_SESSION["glpiprofiles"] as $key => $val){ |
2030 |
echo '<option value="'.$key.'" '.($_SESSION["glpiactiveprofile"]["ID"]==$key?'selected':'').'>'.$val['name'].'</option>'; |
2031 |
} |
2032 |
echo '</select>'; |
2033 |
echo '</form>'; |
2034 |
echo "</li>"; |
2035 |
|
2036 |
|
2037 |
} //else echo "only one profile -> no select to print";
|
2038 |
|
2039 |
if (isMultiEntitiesMode()){
|
2040 |
$cpt=0; |
2041 |
|
2042 |
foreach ($_SESSION['glpi_entities_tree'] as $key => $tree){ |
2043 |
$entities = contructListFromTree($tree); |
2044 |
$cpt+=count($entities); |
2045 |
} |
2046 |
|
2047 |
$addname=""; |
2048 |
if ($cpt>15){ |
2049 |
$addname="_long"; |
2050 |
} |
2051 |
|
2052 |
echo "<li>"; |
2053 |
|
2054 |
|
2055 |
//echo "<a href='".$CFG_GLPI["root_doc"]."/front/entity.select.php?target=$target' id='modal_entity_selection'>".$_SESSION["glpiactive_entity_name"]."</a>";
|
2056 |
|
2057 |
|
2058 |
echo "<a href='#modal_entity_contents' id='modal_entity_selection' title='".$_SESSION["glpiactive_entity_name"]."' class='entity_select'>".$_SESSION["glpiactive_entity_shortname"]."</a>"; |
2059 |
echo "<div id='modal_entity_contents'>"; |
2060 |
displayActiveEntities($target,"activeentity"); |
2061 |
echo "</div>"; |
2062 |
|
2063 |
|
2064 |
echo "<script type='text/javascript'>"; |
2065 |
echo "new Control.Modal('modal_entity_selection',{"; |
2066 |
//echo "iframe: true,";
|
2067 |
//echo "opacity: 0.8, position: 'relative', width:300, height:50";
|
2068 |
echo "opacity: 0.2, fadeDuration: 0.35, width: 500, height: 500"; |
2069 |
echo "});"; |
2070 |
echo "</script>"; |
2071 |
|
2072 |
/* echo "<a href='#' title=\"".$_SESSION["glpiactive_entity_name"]."\" onclick=\"completecleandisplay('show_entities$addname');\">";
|
2073 |
echo $_SESSION["glpiactive_entity_shortname"];
|
2074 |
echo "</a>";
|
2075 |
echo "<div id='show_entities$addname' onmouseover=\"completecleandisplay('show_entities$addname');\">";
|
2076 |
|
2077 |
displayActiveEntities($target,"activeentity");
|
2078 |
|
2079 |
echo "</div>";
|
2080 |
*/
|
2081 |
echo "</li>"; |
2082 |
} |
2083 |
|
2084 |
|
2085 |
|
2086 |
} |
2087 |
|
2088 |
/**
|
2089 |
* Create a Dynamic Progress Bar
|
2090 |
*
|
2091 |
* @param $msg initial message (under the bar)
|
2092 |
* @return nothing
|
2093 |
**/
|
2094 |
function createProgressBar ($msg=" ") { |
2095 |
echo "<div class='doaction_cadre'><div class='doaction_progress' id='doaction_progress'>". |
2096 |
"<div class='doaction_pourcent' id='doaction_pourcent'> </div></div></div><br />".
|
2097 |
"<div id='doaction_message'>$msg</div>";
|
2098 |
} |
2099 |
|
2100 |
/**
|
2101 |
* Change the Progress Bar Position
|
2102 |
*
|
2103 |
* @param $crt Current Value (less then $max)
|
2104 |
* @param $tot Maximum Value
|
2105 |
* @param $msg message inside the bar (defaut is %)
|
2106 |
* @return nothing
|
2107 |
**/
|
2108 |
function changeProgressBarPosition ($crt, $tot, $msg="") { |
2109 |
if (!$tot) |
2110 |
$pct=0; |
2111 |
else if ($crt>$tot) |
2112 |
$pct=100; |
2113 |
else
|
2114 |
$pct = floor($crt*100/$tot); |
2115 |
|
2116 |
if (empty($msg)) $msg = $pct." %"; |
2117 |
|
2118 |
echo "<script type='text/javascript'>action_change_progress(\"$pct%\",\"$msg\")</script>\n"; |
2119 |
glpi_flush(); |
2120 |
} |
2121 |
|
2122 |
/**
|
2123 |
* Change the Message under the Progress Bar
|
2124 |
*
|
2125 |
* @param $msg message under the bar
|
2126 |
* @return nothing
|
2127 |
**/
|
2128 |
function changeProgressBarMessage ($msg=" ") { |
2129 |
echo "<script type='text/javascript'>action_change_message(\"$msg\")</script>\n"; |
2130 |
} |
2131 |
?>
|