ryxeo-glpi-git / plugins / pdf / inc / plugin_pdf.functions.php @ 892c5791
Historique | Voir | Annoter | Télécharger (87,2 ko)
1 | 7b214c36 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | ----------------------------------------------------------------------
|
||
4 | GLPI - Gestionnaire Libre de Parc Informatique
|
||
5 | Copyright (C) 2003-2008 by the INDEPNET Development Team.
|
||
6 | |||
7 | http://indepnet.net/ http://glpi-project.org/
|
||
8 | ----------------------------------------------------------------------
|
||
9 | |||
10 | LICENSE
|
||
11 | |||
12 | This file is part of GLPI.
|
||
13 | |||
14 | GLPI is free software; you can redistribute it and/or modify
|
||
15 | it under the terms of the GNU General Public License as published by
|
||
16 | the Free Software Foundation; either version 2 of the License, or
|
||
17 | (at your option) any later version.
|
||
18 | |||
19 | GLPI is distributed in the hope that it will be useful,
|
||
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
22 | GNU General Public License for more details.
|
||
23 | |||
24 | You should have received a copy of the GNU General Public License
|
||
25 | along with GLPI; if not, write to the Free Software
|
||
26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
27 | ------------------------------------------------------------------------
|
||
28 | */
|
||
29 | |||
30 | // Original Author of file: BALPE Dévi
|
||
31 | // Purpose of file:
|
||
32 | // ----------------------------------------------------------------------
|
||
33 | |||
34 | function plugin_pdf_menu_computer($action,$compID,$export=true){ |
||
35 | global $LANGPDF,$LANG,$DB; |
||
36 | |||
37 | echo "<form name='computer' action='$action' target='blank' method='post'><table class='tab_cadre_fixe'>"; |
||
38 | $values = array(); |
||
39 | $result = $DB->query("select table_num from glpi_plugin_pdf_preference WHERE user_id =" . $_SESSION['glpiID'] . " and cat=" . COMPUTER_TYPE); |
||
40 | |||
41 | while ($data = $DB->fetch_array($result)) |
||
42 | $values["check".$data["table_num"]] = $data["table_num"]; |
||
43 | |||
44 | echo "<tr><th colspan='6'>" . $LANGPDF["title"][2]. " : ".$LANG["Menu"][0] . "</th></tr>"; |
||
45 | echo "<tr class='tab_bg_1'>"; |
||
46 | checkbox("check0",$LANG["Menu"][26],0,(isset($values["check0"])?true:false)); |
||
47 | checkbox("check2",$LANG["title"][30],2,(isset($values["check2"])?true:false)); |
||
48 | checkbox("check4",$LANG["title"][28],4,(isset($values["check4"])?true:false)); |
||
49 | checkbox("check6",$LANG["title"][43],6,(isset($values["check6"])?true:false)); |
||
50 | checkbox("check8",$LANG["title"][37],8,(isset($values["check8"])?true:false)); |
||
51 | checkbox("check10",$LANG["title"][38],10,(isset($values["check10"])?true:false)); |
||
52 | echo "</tr>"; |
||
53 | |||
54 | echo "<tr class='tab_bg_1'>"; |
||
55 | checkbox("check1",$LANG["title"][27],1,(isset($values["check1"])?true:false)); |
||
56 | checkbox("check3",$LANG["Menu"][4],3,(isset($values["check3"])?true:false)); |
||
57 | checkbox("check5",$LANG["Menu"][27],5,(isset($values["check5"])?true:false)); |
||
58 | checkbox("check7",$LANG["title"][34],7,(isset($values["check7"])?true:false)); |
||
59 | checkbox("check9",$LANG["Menu"][17],9,(isset($values["check9"])?true:false)); |
||
60 | echo "<td></td>"; |
||
61 | echo "</tr>"; |
||
62 | |||
63 | echo "<tr class='tab_bg_2'><td colspan='6' align='center'>"; |
||
64 | echo "<input type='hidden' name='plugin_pdf_inventory_type' value='" . COMPUTER_TYPE . "'>"; |
||
65 | echo "<input type='hidden' name='indice' value='11'>"; |
||
66 | echo "<input type='hidden' name='itemID' value='$compID'>"; |
||
67 | |||
68 | echo "<input type='submit' value='" . (!$export?$LANGPDF["button"][2]:$LANGPDF["button"][1]) . "' name='plugin_pdf_user_preferences_save' class='submit'></td></tr>"; |
||
69 | echo "</table></form>"; |
||
70 | } |
||
71 | |||
72 | function plugin_pdf_menu_software($action,$softID){ |
||
73 | global $LANGPDF,$LANG,$DB; |
||
74 | |||
75 | echo "<form name='software' action='$action' target='blank' method='post'><table class='tab_cadre_fixe'>"; |
||
76 | $values = array(); |
||
77 | $result = $DB->query("select table_num from glpi_plugin_pdf_preference WHERE user_id =" . $_SESSION['glpiID'] . " and cat=" . SOFTWARE_TYPE); |
||
78 | |||
79 | while ($data = $DB->fetch_array($result)) |
||
80 | $values["check".$data["table_num"]] = $data["table_num"]; |
||
81 | |||
82 | echo "<tr><th colspan='6'>" . $LANGPDF["title"][2]." : ".$LANG["Menu"][4] . "</th></tr>"; |
||
83 | |||
84 | echo "<tr class='tab_bg_1'>"; |
||
85 | checkbox("check0",$LANG["title"][26],0,(isset($values["check0"])?true:false)); |
||
86 | checkbox("check2",$LANG["Menu"][26],2,(isset($values["check2"])?true:false)); |
||
87 | checkbox("check4",$LANG["title"][28],4,(isset($values["check4"])?true:false)); |
||
88 | checkbox("check6",$LANG["title"][37],6,(isset($values["check6"])?true:false)); |
||
89 | checkbox("check8",$LANG["title"][38],8,(isset($values["check10"])?true:false)); |
||
90 | echo "<td></td>"; |
||
91 | echo "</tr>"; |
||
92 | |||
93 | echo "<tr class='tab_bg_1'>"; |
||
94 | |||
95 | checkbox("check1",$LANG["software"][19],1,(isset($values["check1"])?true:false)); |
||
96 | checkbox("check3",$LANG["Menu"][27],3,(isset($values["check3"])?true:false)); |
||
97 | checkbox("check5",$LANG["title"][34],5,(isset($values["check5"])?true:false)); |
||
98 | checkbox("check7",$LANG["Menu"][17],7,(isset($values["check7"])?true:false)); |
||
99 | echo "<td></td>"; |
||
100 | echo "<td></td>"; |
||
101 | echo "</tr>"; |
||
102 | |||
103 | echo "<tr class='tab_bg_2'><td colspan='6' align='center'>"; |
||
104 | echo "<input type='hidden' name='plugin_pdf_inventory_type' value='" . SOFTWARE_TYPE . "'>"; |
||
105 | echo "<input type='hidden' name='indice' value='7'>"; |
||
106 | echo "<input type='hidden' name='itemID' value='$softID'>"; |
||
107 | |||
108 | echo "<input type='submit' value='" . $LANGPDF["button"][2] . "' name='plugin_pdf_user_preferences_save' class='submit'></td></tr>"; |
||
109 | echo "</table></form>"; |
||
110 | } |
||
111 | |||
112 | function plugin_pdf_getDropdownName($table,$id){ |
||
113 | |||
114 | $name = getDropdownName($table,$id); |
||
115 | |||
116 | if($name==" ") |
||
117 | $name=""; |
||
118 | |||
119 | return $name; |
||
120 | } |
||
121 | |||
122 | |||
123 | function plugin_pdf_background($tab,$width){ |
||
124 | |||
125 | $start_tab = $tab["start_tab"]; |
||
126 | $pdf = $tab["pdf"]; |
||
127 | |||
128 | $height = $pdf->ez['pageHeight']; |
||
129 | $id_pdf=$pdf->openObject(); |
||
130 | $pdf->saveState();
|
||
131 | $pdf->ezStartPageNumbers(575,10,10,'left',convDate(date("Y-m-d"))." - {PAGENUM}/{TOTALPAGENUM}"); |
||
132 | $pdf->setStrokeColor(0,0,0); |
||
133 | $pdf->setLineStyle(1,'round','round'); |
||
134 | $pdf->rectangle(20,20,$width-40,$height-40); |
||
135 | $pdf->addJpegFromFile("../pics/fd_logo.jpg",25,$height-50); |
||
136 | $pdf->selectFont("../fonts/Times-Roman.afm"); |
||
137 | $pdf->setFontFamily('Times-Roman.afm',array('b'=>'Times-Bold.afm','i'=>'Times-Italic.afm','bi'=>'Times-BoldItalic.afm')); |
||
138 | $pdf->restoreState();
|
||
139 | $pdf->closeObject();
|
||
140 | $pdf->addObject($id_pdf,'all'); |
||
141 | |||
142 | $tab["start_tab"] = $start_tab; |
||
143 | $tab["pdf"] = $pdf; |
||
144 | |||
145 | return $tab; |
||
146 | } |
||
147 | |||
148 | function plugin_pdf_add_header($pdf,$ID,$type){ |
||
149 | |||
150 | global $LANG; |
||
151 | |||
152 | $height = $pdf->ez['pageHeight']; |
||
153 | |||
154 | switch($type){ |
||
155 | case COMPUTER_TYPE: |
||
156 | $computer = new Computer(); |
||
157 | $computer->getFromDB($ID); |
||
158 | 892c5791 | Eric Seigne | |
159 | //erics on ajoute un peu de texte et
|
||
160 | //erics on simplifie l'affichage
|
||
161 | 7b214c36 | Eric Seigne | if($computer->fields['name']) |
162 | 892c5791 | Eric Seigne | $pdf->addText(220,$height-45,14,utf8_decode('<b>Inventaire du matériel: '.$computer->fields['name'])); |
163 | 7b214c36 | Eric Seigne | else
|
164 | 892c5791 | Eric Seigne | $pdf->addText(220,$height-45,14,utf8_decode('<b>'.$LANG["common"][2].' '.$computer->fields['ID'].' ('.plugin_pdf_getDropdownName('glpi_entities',$computer->fields['FK_entities']).')</b>')); |
165 | |||
166 | 7b214c36 | Eric Seigne | break;
|
167 | case SOFTWARE_TYPE: |
||
168 | $software = new Software(); |
||
169 | $software->getFromDB($ID); |
||
170 | if($software->fields['name']) |
||
171 | $pdf->addText(200,$height-45,14,utf8_decode('<b>'.$software->fields['name'].' ('.plugin_pdf_getDropdownName('glpi_entities',$software->fields['FK_entities']).')</b>')); |
||
172 | else
|
||
173 | $pdf->addText(200,$height-45,14,utf8_decode('<b>'.$LANG["common"][2].' '.$software->fields['ID'].' ('.plugin_pdf_getDropdownName('glpi_entities',$software->fields['FK_entities']).')</b>')); |
||
174 | break;
|
||
175 | } |
||
176 | |||
177 | return $pdf; |
||
178 | } |
||
179 | |||
180 | function plugin_pdf_config_computer($tab,$width,$ID){ |
||
181 | |||
182 | global $LANG; |
||
183 | |||
184 | $start_tab = $tab["start_tab"]; |
||
185 | $pdf = $tab["pdf"]; |
||
186 | |||
187 | $computer=new Computer(); |
||
188 | $computer->getFromDB($ID); |
||
189 | |||
190 | $length_tab = (($width-50)/2)-2.5; |
||
191 | |||
192 | $pdf->saveState();
|
||
193 | $pdf->setColor(0.8,0.8,0.8); |
||
194 | $pdf->filledRectangle(25,$start_tab-5,$length_tab,15); |
||
195 | $pdf->filledRectangle(25+$length_tab+5,$start_tab-5,$length_tab,15); |
||
196 | $pdf->setColor(0.95,0.95,0.95); |
||
197 | |||
198 | for($i=0;$i<13;$i++) |
||
199 | { |
||
200 | if($i<11) |
||
201 | { |
||
202 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$length_tab,15); |
||
203 | $pdf->filledRectangle(25+$length_tab+5,($start_tab-25)-(20*$i),$length_tab,15); |
||
204 | } |
||
205 | else
|
||
206 | if($i==11) |
||
207 | { |
||
208 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),2*$length_tab+5,15); |
||
209 | } |
||
210 | else
|
||
211 | { |
||
212 | $i+=2; |
||
213 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),2*$length_tab+5,55); |
||
214 | } |
||
215 | } |
||
216 | $pdf->restoreState();
|
||
217 | 892c5791 | Eric Seigne | |
218 | //erics on simplifie pas besoin de ca
|
||
219 | // $pdf->addText(100,$start_tab,9,utf8_decode('<b>'.$LANG["common"][2].' '.$computer->fields['ID'].' ('.plugin_pdf_getDropdownName('glpi_entities',$computer->fields['FK_entities']).')</b>'));
|
||
220 | 7b214c36 | Eric Seigne | $pdf->addText(30,$start_tab-20,9,utf8_decode('<b><i>'.$LANG["common"][16].' :</i></b> '.$computer->fields['name'])); |
221 | $pdf->addText(30,$start_tab-40,9,utf8_decode('<b><i>'.$LANG["common"][17].' :</i></b> '.plugin_pdf_getDropdownName('glpi_type_computers',$computer->fields['type']))); |
||
222 | $pdf->addText(30,$start_tab-60,9,utf8_decode('<b><i>'.$LANG["common"][22].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_model',$computer->fields['model']))); |
||
223 | $pdf->addText(30,$start_tab-80,9,utf8_decode('<b><i>'.$LANG["common"][5].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_manufacturer',$computer->fields['FK_glpi_enterprise']))); |
||
224 | $pdf->addText(30,$start_tab-100,9,utf8_decode('<b><i>'.$LANG["computers"][9].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_os',$computer->fields['os']))); |
||
225 | $pdf->addText(30,$start_tab-120,9,utf8_decode('<b><i>'.$LANG["computers"][52].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_os_version',$computer->fields['os_version']))); |
||
226 | $pdf->addText(30,$start_tab-140,9,utf8_decode('<b><i>'.$LANG["computers"][53].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_os_sp',$computer->fields['os_sp']))); |
||
227 | $pdf->addText(30,$start_tab-160,9,utf8_decode('<b><i>'.$LANG["computers"][10].' :</i></b> '.$computer->fields['os_license_number'])); |
||
228 | $pdf->addText(30,$start_tab-180,9,utf8_decode('<b><i>'.$LANG["computers"][11].' :</i></b> '.$computer->fields['os_license_id'])); |
||
229 | |||
230 | if($computer->fields['ocs_import']) |
||
231 | $pdf->addText(30,$start_tab-200,9,utf8_decode('<b><i>'.$LANG["ocsng"][6].' '.$LANG["Menu"][33].' :</i></b> '.$LANG["choice"][1])); |
||
232 | else
|
||
233 | $pdf->addText(30,$start_tab-200,9,utf8_decode('<b><i>'.$LANG["ocsng"][6].' '.$LANG["Menu"][33].' :</i></b> '.$LANG["choice"][0])); |
||
234 | $pdf->addText(30,$start_tab-240,9,utf8_decode('<b><i>'.$LANG["common"][15].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_locations',$computer->fields['location']))); |
||
235 | $pdf->addText(30,$start_tab-260,9,utf8_decode('<b><i>'.$LANG["common"][25].' :</i></b> ')); |
||
236 | |||
237 | $y=$start_tab-260; |
||
238 | $temp=utf8_decode($computer->fields['comments']); |
||
239 | while($temp = $pdf->addTextWrap(105,$y,2*$length_tab-80,9,$temp)) |
||
240 | $y-=9; |
||
241 | |||
242 | 892c5791 | Eric Seigne | /*
|
243 | 7b214c36 | Eric Seigne | if(!empty($computer->fields['tplname']))
|
244 | $pdf->addText($length_tab+35,$start_tab,9,utf8_decode('<b>'.$LANG["common"][26].' : '.convDateTime($computer->fields["date_mod"]).' ('.$LANG["common"][13].' : '.$computer->fields['tplname'].')</b>'));
|
||
245 | elseif($computer->fields['ocs_import'])
|
||
246 | $pdf->addText($length_tab+35,$start_tab,9,utf8_decode('<b>'.$LANG["common"][26].' : '.convDateTime($computer->fields["date_mod"]).' ('.$LANG["ocsng"][7].')</b>'));
|
||
247 | else
|
||
248 | $pdf->addText($length_tab+80,$start_tab,9,utf8_decode('<b>'.$LANG["common"][26].' : '.convDateTime($computer->fields["date_mod"]).'</b>'));
|
||
249 | 892c5791 | Eric Seigne | */
|
250 | 7b214c36 | Eric Seigne | |
251 | $pdf->addText($length_tab+35,$start_tab-20,9,utf8_decode('<b><i>'.$LANG["common"][18].' :</i></b> '.$computer->fields['contact'])); |
||
252 | $pdf->addText($length_tab+35,$start_tab-40,9,utf8_decode('<b><i>'.$LANG["common"][21].' :</i></b> '.$computer->fields['contact_num'])); |
||
253 | $pdf->addText($length_tab+35,$start_tab-60,9,utf8_decode('<b><i>'.$LANG["common"][34].' :</i></b> '.plugin_pdf_getDropdownName('glpi_users',$computer->fields['FK_users']))); |
||
254 | $pdf->addText($length_tab+35,$start_tab-80,9,utf8_decode('<b><i>'.$LANG["common"][35].' :</i></b> '.plugin_pdf_getDropdownName('glpi_groups',$computer->fields['FK_groups']))); |
||
255 | $pdf->addText($length_tab+35,$start_tab-100,9,utf8_decode('<b><i>'.$LANG["common"][10].' :</i></b> '.plugin_pdf_getDropdownName('glpi_users',$computer->fields['tech_num']))); |
||
256 | $pdf->addText($length_tab+35,$start_tab-120,9,utf8_decode('<b><i>'.$LANG["setup"][88].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_network',$computer->fields['network']))); |
||
257 | $pdf->addText($length_tab+35,$start_tab-140,9,utf8_decode('<b><i>'.$LANG["setup"][89].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_domain',$computer->fields['domain']))); |
||
258 | $pdf->addText($length_tab+35,$start_tab-160,9,utf8_decode('<b><i>'.$LANG["common"][19].' :</i></b> '.$computer->fields['serial'])); |
||
259 | $pdf->addText($length_tab+35,$start_tab-180,9,utf8_decode('<b><i>'.$LANG["common"][20].' :</i></b> '.$computer->fields['otherserial'])); |
||
260 | $pdf->addText($length_tab+35,$start_tab-200,9,utf8_decode('<b><i>'.$LANG["state"][0].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_state',$computer->fields['state']))); |
||
261 | $pdf->addText($length_tab+35,$start_tab-220,9,utf8_decode('<b><i>'.$LANG["computers"][51].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_auto_update',$computer->fields['auto_update']))); |
||
262 | |||
263 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
264 | |||
265 | $tab["start_tab"] = $start_tab; |
||
266 | $tab["pdf"] = $pdf; |
||
267 | |||
268 | return $tab; |
||
269 | } |
||
270 | |||
271 | function plugin_pdf_config_software($tab,$width,$ID){ |
||
272 | |||
273 | global $LANG; |
||
274 | |||
275 | $start_tab = $tab["start_tab"]; |
||
276 | $pdf = $tab["pdf"]; |
||
277 | |||
278 | $software=new Software(); |
||
279 | $software->getFromDB($ID); |
||
280 | |||
281 | $length_tab = (($width-50)/2)-2.5; |
||
282 | |||
283 | $pdf->saveState();
|
||
284 | $pdf->setColor(0.8,0.8,0.8); |
||
285 | $pdf->filledRectangle(25,$start_tab-5,$length_tab,15); |
||
286 | $pdf->filledRectangle(25+$length_tab+5,$start_tab-5,$length_tab,15); |
||
287 | $pdf->setColor(0.95,0.95,0.95); |
||
288 | |||
289 | for($i=0;$i<7;$i++) |
||
290 | { |
||
291 | if($i<5) |
||
292 | { |
||
293 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$length_tab,15); |
||
294 | $pdf->filledRectangle(25+$length_tab+5,($start_tab-25)-(20*$i),$length_tab,15); |
||
295 | } |
||
296 | else
|
||
297 | if($i==5) |
||
298 | { |
||
299 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),2*$length_tab+5,15); |
||
300 | } |
||
301 | else
|
||
302 | { |
||
303 | $i+=2; |
||
304 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),2*$length_tab+5,55); |
||
305 | } |
||
306 | } |
||
307 | $pdf->restoreState();
|
||
308 | |||
309 | $pdf->addText(100,$start_tab,9,utf8_decode('<b>'.$LANG["common"][2].' '.$software->fields['ID'].' ('.plugin_pdf_getDropdownName('glpi_entities',$software->fields['FK_entities']).')</b>')); |
||
310 | $pdf->addText(30,$start_tab-20,9,utf8_decode('<b><i>'.$LANG["common"][16].' :</i></b> '.$software->fields['name'])); |
||
311 | $pdf->addText(30,$start_tab-40,9,utf8_decode('<b><i>'.$LANG["software"][3].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_os',$software->fields['platform']))); |
||
312 | $pdf->addText(30,$start_tab-60,9,utf8_decode('<b><i>'.$LANG["common"][34].' :</i></b> '.plugin_pdf_getDropdownName('glpi_users',$software->fields["FK_users"]))); |
||
313 | $pdf->addText(30,$start_tab-80,9,utf8_decode('<b><i>'.$LANG["common"][10].' :</i></b> '.plugin_pdf_getDropdownName('glpi_users',$software->fields["tech_num"]))); |
||
314 | $pdf->addText(30,$start_tab-100,9,utf8_decode('<b><i>'.$LANG["common"][15].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_locations',$software->fields['location']))); |
||
315 | |||
316 | if($software->fields['is_update']) |
||
317 | $pdf->addText(30,$start_tab-120,9,utf8_decode('<b><i>'.$LANG["software"][29].' :</i></b> '.$LANG["choice"][1])); |
||
318 | else
|
||
319 | $pdf->addText(30,$start_tab-120,9,utf8_decode('<b><i>'.$LANG["software"][29].' :</i></b> '.$LANG["choice"][0])); |
||
320 | |||
321 | if($software->fields["update_software"]!=null) |
||
322 | $pdf->addText(100,$start_tab-120,9,utf8_decode('<b><i> '.$LANG["pager"][2].' </i></b> '.plugin_pdf_getDropdownName('glpi_software',$software->fields["update_software"]))); |
||
323 | |||
324 | $pdf->addText(30,$start_tab-140,9,utf8_decode('<b><i>'.$LANG["common"][25].' :</i></b> ')); |
||
325 | |||
326 | $y=$start_tab-140; |
||
327 | $temp=utf8_decode($software->fields['comments']); |
||
328 | while($temp = $pdf->addTextWrap(105,$y,2*$length_tab-80,9,$temp)) |
||
329 | $y-=9; |
||
330 | |||
331 | if(!empty($software->fields['tplname'])) |
||
332 | $pdf->addText($length_tab+35,$start_tab,9,utf8_decode('<b>'.$LANG["common"][26].' : '.convDateTime($software->fields["date_mod"]).' ('.$LANG["common"][13].' : '.$software->fields['tplname'].')</b>')); |
||
333 | else
|
||
334 | $pdf->addText($length_tab+80,$start_tab,9,utf8_decode('<b>'.$LANG["common"][26].' : '.convDateTime($software->fields["date_mod"]).'</b>')); |
||
335 | |||
336 | $pdf->addText($length_tab+35,$start_tab-20,9,utf8_decode('<b><i>'.$LANG["common"][36].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_software_category',$software->fields["category"]))); |
||
337 | $pdf->addText($length_tab+35,$start_tab-40,9,utf8_decode('<b><i>'.$LANG["common"][5].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_manufacturer',$software->fields['FK_glpi_enterprise']))); |
||
338 | $pdf->addText($length_tab+35,$start_tab-60,9,utf8_decode('<b><i>'.$LANG["common"][35].' :</i></b> '.plugin_pdf_getDropdownName('glpi_groups',$software->fields['FK_groups']))); |
||
339 | $pdf->addText($length_tab+35,$start_tab-80,9,utf8_decode('<b><i>'.$LANG["state"][0].' :</i></b> '.plugin_pdf_getDropdownName('glpi_dropdown_state',$software->fields["state"]))); |
||
340 | |||
341 | if($software->fields['helpdesk_visible']) |
||
342 | $pdf->addText($length_tab+35,$start_tab-100,9,utf8_decode('<b><i>'.$LANG["software"][46].' :</i></b> '.$LANG["choice"][1])); |
||
343 | else
|
||
344 | $pdf->addText($length_tab+35,$start_tab-100,9,utf8_decode('<b><i>'.$LANG["software"][46].' :</i></b> '.$LANG["choice"][0])); |
||
345 | |||
346 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
347 | |||
348 | $tab["start_tab"] = $start_tab; |
||
349 | $tab["pdf"] = $pdf; |
||
350 | |||
351 | return $tab; |
||
352 | } |
||
353 | |||
354 | function plugin_pdf_device($tab,$width,$ID,$type){ |
||
355 | |||
356 | global $LANG; |
||
357 | |||
358 | $start_tab = $tab["start_tab"]; |
||
359 | $pdf = $tab["pdf"]; |
||
360 | |||
361 | $computer=new Computer(); |
||
362 | $computer->getFromDBwithDevices($ID); |
||
363 | |||
364 | $pdf->saveState();
|
||
365 | $pdf->setColor(0.8,0.8,0.8); |
||
366 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
367 | $pdf->restoreState();
|
||
368 | $pdf->addText(275,$start_tab,9,'<b>'.utf8_decode($LANG["title"][30].'</b>')); |
||
369 | |||
370 | $i=0; |
||
371 | |||
372 | foreach($computer->devices as $key => $val) { |
||
373 | $device = new Device($val["devType"]); |
||
374 | $device->getFromDB($val["devID"]); |
||
375 | |||
376 | $nb_x = 27 ; |
||
377 | $device_x = 47; |
||
378 | $design_x = 127; |
||
379 | $other_x = 362; |
||
380 | $spec_x = 468; |
||
381 | |||
382 | $pdf->saveState();
|
||
383 | $pdf->setColor(0.95,0.95,0.95); |
||
384 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),15,15); |
||
385 | $pdf->filledRectangle(45,($start_tab-25)-(20*$i),75,15); |
||
386 | $pdf->filledRectangle(125,($start_tab-25)-(20*$i),230,15); |
||
387 | $pdf->filledRectangle(360,($start_tab-25)-(20*$i),101,15); |
||
388 | $pdf->filledRectangle(466,($start_tab-25)-(20*$i),105,15); |
||
389 | $pdf->restoreState();
|
||
390 | |||
391 | switch($device->devtype) { |
||
392 | case HDD_DEVICE : |
||
393 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
394 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][1])); |
||
395 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
396 | $pdf->addTextWrap($spec_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["device_hdd"][4].' :</i></b> '.$val["specificity"])); |
||
397 | if (!empty($device->fields["rpm"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["device_hdd"][0].' :</i></b> '.$device->fields["rpm"])); |
||
398 | else if (!empty($device->fields["interface"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["common"][65].' :</i></b> '.plugin_pdf_getDropdownName("glpi_dropdown_interface",$device->fields["interface"]))); |
||
399 | else if (!empty($device->fields["cache"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["device_hdd"][1].' :</i></b> '.$device->fields["cache"])); |
||
400 | break;
|
||
401 | case GFX_DEVICE : |
||
402 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
403 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][2])); |
||
404 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
405 | if (!empty($device->fields["ram"])) $pdf->addTextWrap($spec_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["device_gfxcard"][0].' :</i></b> '.$device->fields["ram"])); |
||
406 | if (!empty($device->fields["interface"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["common"][65].' :</i></b> '.$device->fields["interface"])); |
||
407 | break;
|
||
408 | case NETWORK_DEVICE : |
||
409 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
410 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][3])); |
||
411 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
412 | $pdf->addTextWrap($spec_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["networking"][15].' :</i></b> '.$val["specificity"])); |
||
413 | if (!empty($device->fields["bandwidth"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["device_iface"][0].' :</i></b> '.$device->fields["bandwidth"])); |
||
414 | break;
|
||
415 | case MOBOARD_DEVICE : |
||
416 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
417 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][5])); |
||
418 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
419 | if (!empty($device->fields["chipset"])) $pdf->addTextWrap($spec_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["device_moboard"][0].' :</i></b> '.$device->fields["chipset"])); |
||
420 | break;
|
||
421 | case PROCESSOR_DEVICE : |
||
422 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
423 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][4])); |
||
424 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
425 | $pdf->addTextWrap($spec_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["device_ram"][1].' :</i></b> '.$val["specificity"])); |
||
426 | break;
|
||
427 | case RAM_DEVICE : |
||
428 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
429 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][6])); |
||
430 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
431 | $pdf->addTextWrap($spec_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["monitors"][21].' :</i></b> '.$val["specificity"])); |
||
432 | if (empty($device->fields["frequence"])) { |
||
433 | if (!empty($device->fields["type"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["common"][17].' :</i></b> '.plugin_pdf_getDropdownName("glpi_dropdown_ram_type",$device->fields["type"]))); |
||
434 | } else {
|
||
435 | if (!empty($device->fields["type"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),73,9,utf8_decode('<b><i>'.$LANG["common"][17].' :</i></b> '.plugin_pdf_getDropdownName("glpi_dropdown_ram_type",$device->fields["type"]))); |
||
436 | $pdf->addTextWrap($other_x+75,($start_tab-20)-(20*$i),28,9,utf8_decode($device->fields["frequence"])); |
||
437 | } |
||
438 | break;
|
||
439 | case SND_DEVICE : |
||
440 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
441 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][7])); |
||
442 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
443 | if (!empty($device->fields["type"])) $pdf->addTextWrap($spec_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["common"][17].' :</i></b> '.$device->fields["type"])); |
||
444 | break;
|
||
445 | case DRIVE_DEVICE : |
||
446 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
447 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][19])); |
||
448 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
449 | if (!empty($device->fields["is_writer"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["profiles"][11].' :</i></b> '.getYesNo($device->fields["is_writer"]))); |
||
450 | else if (!empty($device->fields["speed"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["device_drive"][1].' :</i></b> '.$device->fields["speed"])); |
||
451 | else if (!empty($device->fields["frequence"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["device_ram"][1].' :</i></b> '.$device->fields["frequence"])); |
||
452 | break;
|
||
453 | case CONTROL_DEVICE :; |
||
454 | $pdf->addTextWrap($nb_x,($start_tab-25)-(25*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
455 | $pdf->addTextWrap($device_x,($start_tab-25)-(25*$i),73,9,utf8_decode($LANG["devices"][20])); |
||
456 | $pdf->addTextWrap($design_x,($start_tab-25)-(25*$i),228,9,utf8_decode($device->fields["designation"])); |
||
457 | if (!empty($device->fields["interface"])) $pdf->addTextWrap($spec_x,($start_tab-20)-(20*$i),99,9,utf8_decode('<b><i>'.$LANG["common"][65].' :</i></b> '.plugin_pdf_getDropdownName("glpi_dropdown_interface",$device->fields["interface"]))); |
||
458 | if (!empty($device->fields["raid"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["device_control"][0].' :</i></b> '.getYesNo($device->fields["raid"]))); |
||
459 | break;
|
||
460 | case PCI_DEVICE : |
||
461 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
462 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][21])); |
||
463 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
464 | break;
|
||
465 | case POWER_DEVICE : |
||
466 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
467 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][23])); |
||
468 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
469 | if (!empty($device->fields["power"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["device_power"][0].' :</i></b> '.$device->fields["power"])); |
||
470 | else if (!empty($device->fields["atx"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["device_power"][1].' :</i></b> '.getYesNo($device->fields["atx"]))); |
||
471 | break;
|
||
472 | case CASE_DEVICE : |
||
473 | $pdf->addTextWrap($nb_x,($start_tab-20)-(20*$i),13,9,utf8_decode($val["quantity"].'x')); |
||
474 | $pdf->addTextWrap($device_x,($start_tab-20)-(20*$i),73,9,utf8_decode($LANG["devices"][22])); |
||
475 | $pdf->addTextWrap($design_x,($start_tab-20)-(20*$i),228,9,utf8_decode($device->fields["designation"])); |
||
476 | if (!empty($device->fields["type"])) $pdf->addTextWrap($other_x,($start_tab-20)-(20*$i),103,9,utf8_decode('<b><i>'.$LANG["common"][17].' :</i></b> '.plugin_pdf_getDropdownName("glpi_dropdown_case_type",$device->fields["type"]))); |
||
477 | break;
|
||
478 | } |
||
479 | $i++;
|
||
480 | |||
481 | if(($start_tab-20)-(20*$i)<50){ |
||
482 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
483 | $i=0; |
||
484 | $start_tab = 750; |
||
485 | } |
||
486 | } |
||
487 | |||
488 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
489 | |||
490 | $tab["start_tab"] = $start_tab; |
||
491 | $tab["pdf"] = $pdf; |
||
492 | |||
493 | return $tab; |
||
494 | } |
||
495 | |||
496 | function plugin_pdf_licenses($tab,$width,$ID,$show_computers,$type){ |
||
497 | |||
498 | global $DB,$LANG,$LANGPDF; |
||
499 | |||
500 | $start_tab = $tab["start_tab"]; |
||
501 | $pdf = $tab["pdf"]; |
||
502 | |||
503 | $ci=new CommonItem(); |
||
504 | $query = "SELECT count(*) AS COUNT FROM glpi_licenses WHERE (sID = '$ID')"; |
||
505 | $query_update = "SELECT count(glpi_licenses.ID) AS COUNT FROM glpi_licenses, glpi_software WHERE (glpi_software.ID = glpi_licenses.sID AND glpi_software.update_software = '$ID' and glpi_software.is_update='1')"; |
||
506 | |||
507 | $i=0; |
||
508 | |||
509 | if ($result = $DB->query($query)) { |
||
510 | if ($DB->result($result,0,0)!=0) { |
||
511 | $nb_licences=$DB->result($result, 0, "COUNT"); |
||
512 | $result_update = $DB->query($query_update); |
||
513 | $nb_updates=$DB->result($result_update, 0, "COUNT"); |
||
514 | $installed = getInstalledLicence($ID); |
||
515 | $tobuy=getLicenceToBuy($ID); |
||
516 | $isfreeorglobal=isFreeSoftware($ID)||isGlobalSoftware($ID); |
||
517 | |||
518 | $pdf->saveState();
|
||
519 | $pdf->setColor(0.8,0.8,0.8); |
||
520 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
521 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),100,15); |
||
522 | $pdf->filledRectangle(130,($start_tab-25)-(20*$i),90,15); |
||
523 | $pdf->filledRectangle(225,($start_tab-25)-(20*$i),30,15); |
||
524 | $pdf->filledRectangle(260,($start_tab-25)-(20*$i),80,15); |
||
525 | $pdf->filledRectangle(345,($start_tab-25)-(20*$i),30,15); |
||
526 | $pdf->filledRectangle(380,($start_tab-25)-(20*$i),30,15); |
||
527 | $pdf->filledRectangle(415,($start_tab-25)-(20*$i),155,15); |
||
528 | $pdf->restoreState();
|
||
529 | $pdf->addText(130,$start_tab,9,utf8_decode('<b>'.$nb_licences.' '.$LANG["software"][13].' '.$nb_updates.' '.$LANG["software"][36].' '.$installed.' '.$LANG["software"][19].' '.$tobuy.' '.$LANG["software"][37].'</b>')); |
||
530 | $pdf->addText(60,$start_tab-20,9,utf8_decode('<b>'.$LANG["software"][5].'</b>')); |
||
531 | $pdf->addText(145,$start_tab-20,9,utf8_decode('<b>'.$LANG["common"][19].'</b>')); |
||
532 | $pdf->addText(230,$start_tab-20,9,utf8_decode('<b>'.$LANG["common"][33].'</b>')); |
||
533 | $pdf->addText(280,$start_tab-20,9,utf8_decode('<b>'.$LANG["software"][32].'</b>')); |
||
534 | $pdf->addText(350,$start_tab-20,9,utf8_decode('<b>'.$LANG["software"][28].'</b>')); |
||
535 | $pdf->addText(382,$start_tab-20,9,utf8_decode('<b>'.$LANG["software"][35].'</b>')); |
||
536 | $pdf->addText(470,$start_tab-20,9,utf8_decode('<b>'.$LANG["software"][19].'</b>')); |
||
537 | |||
538 | $i++;
|
||
539 | } |
||
540 | else
|
||
541 | { |
||
542 | $pdf->saveState();
|
||
543 | $pdf->setColor(0.8,0.8,0.8); |
||
544 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
545 | $pdf->restoreState();
|
||
546 | $pdf->addText(240,$start_tab,9,'<b>'.utf8_decode($LANG["software"][14]).'</b>'); |
||
547 | } |
||
548 | } |
||
549 | |||
550 | $query = "SELECT count(ID) AS COUNT , version as VERSION, serial as SERIAL, expire as EXPIRE, oem as OEM, oem_computer as OEM_COMPUTER, buy as BUY FROM glpi_licenses WHERE (sID = '$ID') GROUP BY version, serial, expire, oem, oem_computer, buy ORDER BY version, serial,oem, oem_computer"; |
||
551 | |||
552 | if ($result = $DB->query($query)) { |
||
553 | while ($data=$DB->fetch_array($result)) { |
||
554 | $version=$data["VERSION"]; |
||
555 | $serial=$data["SERIAL"]; |
||
556 | $num_tot=$data["COUNT"]; |
||
557 | $expire=$data["EXPIRE"]; |
||
558 | $oem=$data["OEM"]; |
||
559 | $oem_computer=$data["OEM_COMPUTER"]; |
||
560 | $buy=$data["BUY"]; |
||
561 | |||
562 | $SEARCH_LICENCE="(glpi_licenses.sID = $ID AND glpi_licenses.serial = '".$serial."' AND glpi_licenses.oem = '$oem' AND glpi_licenses.oem_computer = '$oem_computer' AND glpi_licenses.buy = '$buy' "; |
||
563 | if ($expire=="") |
||
564 | $SEARCH_LICENCE.=" AND glpi_licenses.expire IS NULL"; |
||
565 | else $SEARCH_LICENCE.=" AND glpi_licenses.expire = '$expire'"; |
||
566 | |||
567 | if ($version=="") |
||
568 | $SEARCH_LICENCE.=" AND glpi_licenses.version='')"; |
||
569 | else $SEARCH_LICENCE.=" AND glpi_licenses.version = '$version')"; |
||
570 | |||
571 | $today=date("Y-m-d"); |
||
572 | $expirer=0; |
||
573 | if ($expire!=NULL&&$today>$expire) |
||
574 | $expirer=1; |
||
575 | |||
576 | $query_inst = "SELECT glpi_inst_software.ID AS ID, glpi_inst_software.license AS lID, glpi_computers.deleted as deleted, "; |
||
577 | $query_inst .= " glpi_infocoms.ID as infocoms, glpi_licenses.comments AS COMMENT, "; |
||
578 | $query_inst .= " glpi_computers.ID AS cID, glpi_computers.name AS cname FROM glpi_licenses"; |
||
579 | $query_inst .= " INNER JOIN glpi_inst_software "; |
||
580 | $query_inst .= " ON ( glpi_inst_software.license = glpi_licenses.ID )"; |
||
581 | $query_inst .= " INNER JOIN glpi_computers ON (glpi_computers.deleted='0' AND glpi_computers.is_template='0' AND glpi_inst_software.cID= glpi_computers.ID) "; |
||
582 | $query_inst .= " LEFT JOIN glpi_infocoms ON (glpi_infocoms.device_type='".LICENSE_TYPE."' AND glpi_infocoms.FK_device=glpi_licenses.ID) "; |
||
583 | $query_inst .= " WHERE $SEARCH_LICENCE ORDER BY cname"; |
||
584 | |||
585 | $result_inst = $DB->query($query_inst); |
||
586 | $num_inst=$DB->numrows($result_inst); |
||
587 | |||
588 | $pdf->saveState();
|
||
589 | $pdf->setColor(0.95,0.95,0.95); |
||
590 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),100,15); |
||
591 | $pdf->filledRectangle(130,($start_tab-25)-(20*$i),90,15); |
||
592 | $pdf->filledRectangle(225,($start_tab-25)-(20*$i),30,15); |
||
593 | $pdf->filledRectangle(260,($start_tab-25)-(20*$i),80,15); |
||
594 | $pdf->filledRectangle(345,($start_tab-25)-(20*$i),30,15); |
||
595 | $pdf->filledRectangle(380,($start_tab-25)-(20*$i),30,15); |
||
596 | $pdf->filledRectangle(415,($start_tab-25)-(20*$i),155,15); |
||
597 | $pdf->restoreState();
|
||
598 | |||
599 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($version)); |
||
600 | $pdf->addText(135,($start_tab-20)-(20*$i),9,utf8_decode($serial)); |
||
601 | $pdf->addText(235,($start_tab-20)-(20*$i),9,utf8_decode($num_tot)); |
||
602 | |||
603 | if ($expire==NULL) |
||
604 | $pdf->addText(265,($start_tab-20)-(20*$i),9,utf8_decode($LANG["software"][26])); |
||
605 | else{
|
||
606 | if ($expirer) |
||
607 | $pdf->addText(265,($start_tab-20)-(20*$i),9,utf8_decode($LANG["software"][27])); |
||
608 | else
|
||
609 | $pdf->addText(265,($start_tab-20)-(20*$i),9,utf8_decode($LANG["software"][25].' '.convDate($expire))); |
||
610 | } |
||
611 | |||
612 | if($oem) |
||
613 | $pdf->addText(350,($start_tab-20)-(20*$i),9,utf8_decode($LANG["choice"][1])); |
||
614 | else
|
||
615 | $pdf->addText(350,($start_tab-20)-(20*$i),9,utf8_decode($LANG["choice"][0])); |
||
616 | |||
617 | if ($serial!="free"){ |
||
618 | if($buy) |
||
619 | $pdf->addText(385,($start_tab-20)-(20*$i),9,utf8_decode($LANG["choice"][1])); |
||
620 | else
|
||
621 | $pdf->addText(385,($start_tab-20)-(20*$i),9,utf8_decode($LANG["choice"][0])); |
||
622 | } |
||
623 | |||
624 | if (!$show_computers) |
||
625 | $pdf->addText(420,($start_tab-20)-(20*$i),9,utf8_decode($LANG["software"][19].' '.$num_inst)); |
||
626 | else
|
||
627 | { |
||
628 | while ($data_inst=$DB->fetch_array($result_inst)) |
||
629 | { |
||
630 | |||
631 | $ci->getFromDB(COMPUTER_TYPE,$data_inst["cID"]); |
||
632 | $name=$ci->getNameID(); |
||
633 | $computer = new Computer(); |
||
634 | $computer->getFromDB($data_inst["cID"]); |
||
635 | |||
636 | $pdf->saveState();
|
||
637 | $pdf->setColor(0.95,0.95,0.95); |
||
638 | $pdf->filledRectangle(415,($start_tab-25)-(20*$i),155,15); |
||
639 | $pdf->restoreState();
|
||
640 | $pdf->addText(420,($start_tab-20)-(20*$i),9,utf8_decode($name.' ('.$computer->fields['serial'].')')); |
||
641 | |||
642 | $i++;
|
||
643 | |||
644 | if(($start_tab-20)-(20*$i)<50){ |
||
645 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
646 | $i=0; |
||
647 | $start_tab = 750; |
||
648 | } |
||
649 | } |
||
650 | $i--;
|
||
651 | } |
||
652 | $i++;
|
||
653 | |||
654 | if(($start_tab-20)-(20*$i)<50){ |
||
655 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
656 | $i=0; |
||
657 | $start_tab = 750; |
||
658 | } |
||
659 | } |
||
660 | } |
||
661 | |||
662 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
663 | |||
664 | $tab["start_tab"] = $start_tab; |
||
665 | $tab["pdf"] = $pdf; |
||
666 | |||
667 | return $tab; |
||
668 | } |
||
669 | |||
670 | function plugin_pdf_software($tab,$width,$ID,$type){ |
||
671 | |||
672 | global $DB,$LANG,$LANGPDF; |
||
673 | |||
674 | $start_tab = $tab["start_tab"]; |
||
675 | $pdf = $tab["pdf"]; |
||
676 | |||
677 | $comp=new Computer(); |
||
678 | $comp->getFromDB($ID); |
||
679 | $FK_entities=$comp->fields["FK_entities"]; |
||
680 | |||
681 | $query_cat = "SELECT 1 as TYPE, glpi_dropdown_software_category.name as category, glpi_software.category as category_id, glpi_software.name as softname, glpi_inst_software.license as license, glpi_inst_software.ID as ID,glpi_licenses.expire,glpi_software.deleted, glpi_licenses.sID, glpi_licenses.version, glpi_licenses.oem, glpi_licenses.oem_computer, glpi_licenses.serial, glpi_licenses.buy FROM glpi_inst_software LEFT JOIN glpi_licenses ON ( glpi_inst_software.license = glpi_licenses.ID ) |
||
682 | LEFT JOIN glpi_software ON (glpi_licenses.sID = glpi_software.ID)
|
||
683 | LEFT JOIN glpi_dropdown_software_category ON (glpi_dropdown_software_category.ID = glpi_software.category)";
|
||
684 | |||
685 | $query_cat.=" WHERE glpi_inst_software.cID = '$ID' AND glpi_software.category > 0 "; |
||
686 | $query_nocat = "SELECT 2 as TYPE, glpi_dropdown_software_category.name as category, glpi_software.category as category_id, glpi_software.name as softname, glpi_inst_software.license as license, glpi_inst_software.ID as ID,glpi_licenses.expire,glpi_software.deleted, glpi_licenses.sID, glpi_licenses.version, glpi_licenses.oem, glpi_licenses.oem_computer, glpi_licenses.serial, glpi_licenses.buy |
||
687 | FROM glpi_inst_software LEFT JOIN glpi_licenses ON ( glpi_inst_software.license = glpi_licenses.ID )
|
||
688 | LEFT JOIN glpi_software ON (glpi_licenses.sID = glpi_software.ID)
|
||
689 | LEFT JOIN glpi_dropdown_software_category ON (glpi_dropdown_software_category.ID = glpi_software.category)";
|
||
690 | $query_nocat.= " WHERE glpi_inst_software.cID = '$ID' AND (glpi_software.category <= 0 OR glpi_software.category IS NULL ) "; |
||
691 | $query="( $query_cat ) UNION ($query_nocat) ORDER BY TYPE, category, softname, version"; |
||
692 | |||
693 | $result = $DB->query($query); |
||
694 | $i = 0; |
||
695 | |||
696 | $pdf->saveState();
|
||
697 | $pdf->setColor(0.8,0.8,0.8); |
||
698 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
699 | $pdf->restoreState();
|
||
700 | $pdf->addText(250,$start_tab,9,utf8_decode('<b>'.$LANG["software"][17].'</b>')); |
||
701 | |||
702 | $cat=-1; |
||
703 | |||
704 | if ($DB->numrows($result)) |
||
705 | while ($data=$DB->fetch_array($result)) { |
||
706 | |||
707 | if($data["category_id"] != $cat) |
||
708 | { |
||
709 | $cat = $data["category_id"]; |
||
710 | $catname=$data["category"]; |
||
711 | |||
712 | if (!$cat) |
||
713 | $catname=$LANG["softwarecategories"][3]; |
||
714 | |||
715 | $pdf->saveState();
|
||
716 | $pdf->setColor(0.8,0.8,0.8); |
||
717 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50,15); |
||
718 | $pdf->restoreState();
|
||
719 | $pdf->addText(240,($start_tab-20)-(20*$i),9,utf8_decode('<b>'.$catname.'</b>')); |
||
720 | |||
721 | $i++;
|
||
722 | |||
723 | $pdf->saveState();
|
||
724 | $pdf->setColor(0.8,0.8,0.8); |
||
725 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),385,15); |
||
726 | $pdf->filledRectangle(415,($start_tab-25)-(20*$i),65,15); |
||
727 | $pdf->filledRectangle(485,($start_tab-25)-(20*$i),40,15); |
||
728 | $pdf->filledRectangle(530,($start_tab-25)-(20*$i),40,15); |
||
729 | $pdf->restoreState();
|
||
730 | $pdf->addText(180,($start_tab-20)-(20*$i),9,utf8_decode('<b>'.$LANG["common"][16].'</b>')); |
||
731 | $pdf->addText(425,($start_tab-20)-(20*$i),9,utf8_decode('<b>'.$LANG["financial"][98].'</b>')); |
||
732 | $pdf->addText(493,($start_tab-20)-(20*$i),9,utf8_decode('<b>'.$LANG["software"][28].'</b>')); |
||
733 | $pdf->addText(536,($start_tab-20)-(20*$i),9,utf8_decode('<b>'.$LANG["software"][35].'</b>')); |
||
734 | |||
735 | $i++;
|
||
736 | } |
||
737 | |||
738 | $sw = new Software(); |
||
739 | $sw->getFromDB($data['sID']); |
||
740 | |||
741 | $pdf->saveState();
|
||
742 | $pdf->setColor(0.95,0.95,0.95); |
||
743 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),385,15); |
||
744 | $pdf->filledRectangle(415,($start_tab-25)-(20*$i),65,15); |
||
745 | $pdf->filledRectangle(485,($start_tab-25)-(20*$i),40,15); |
||
746 | $pdf->filledRectangle(530,($start_tab-25)-(20*$i),40,15); |
||
747 | $pdf->restoreState();
|
||
748 | |||
749 | $pdf->addText(27,($start_tab-20)-(20*$i),8,utf8_decode($sw->fields["name"].' ( '.$data["version"].' ) - '.$data['serial'])); |
||
750 | |||
751 | if($data['expire']==null) |
||
752 | $pdf->addText(420,($start_tab-20)-(20*$i),9,utf8_decode($LANG["software"][26])); |
||
753 | else{
|
||
754 | if($data['deleted']) |
||
755 | $pdf->addText(420,($start_tab-20)-(20*$i),9,utf8_decode($LANG["software"][27])); |
||
756 | else
|
||
757 | $pdf->addText(420,($start_tab-20)-(20*$i),9,utf8_decode($data["expire"])); |
||
758 | } |
||
759 | |||
760 | if($data['serial']!="free" && $data['serial']!="global") |
||
761 | { |
||
762 | if($data["oem"]) |
||
763 | $pdf->addText(495,($start_tab-20)-(20*$i),9,utf8_decode($LANG["choice"][1])); |
||
764 | else
|
||
765 | $pdf->addText(495,($start_tab-20)-(20*$i),9,utf8_decode($LANG["choice"][0])); |
||
766 | |||
767 | if($data["buy"]) |
||
768 | $pdf->addText(543,($start_tab-20)-(20*$i),9,utf8_decode($LANG["choice"][1])); |
||
769 | else
|
||
770 | $pdf->addText(543,($start_tab-20)-(20*$i),9,utf8_decode($LANG["choice"][0])); |
||
771 | } |
||
772 | $i++;
|
||
773 | |||
774 | if(($start_tab-20)-(20*$i)<50){ |
||
775 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
776 | $i=0; |
||
777 | $start_tab = 750; |
||
778 | } |
||
779 | } |
||
780 | else
|
||
781 | { |
||
782 | if(($start_tab-20)-(20*$i)<50){ |
||
783 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
784 | $i=0; |
||
785 | $start_tab = 750; |
||
786 | } |
||
787 | $pdf->saveState();
|
||
788 | $pdf->setColor(0.8,0.8,0.8); |
||
789 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
790 | $pdf->restoreState();
|
||
791 | $pdf->addText(250,$start_tab,9,'<b>'.utf8_decode($LANGPDF["software"][1]).'</b>'); |
||
792 | } |
||
793 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
794 | |||
795 | $tab["start_tab"] = $start_tab; |
||
796 | $tab["pdf"] = $pdf; |
||
797 | |||
798 | return $tab; |
||
799 | } |
||
800 | |||
801 | function plugin_pdf_connection($tab,$width,$ID,$type){ |
||
802 | |||
803 | global $DB,$LANG; |
||
804 | |||
805 | $start_tab = $tab["start_tab"]; |
||
806 | $pdf = $tab["pdf"]; |
||
807 | |||
808 | $items=array(PRINTER_TYPE=>$LANG["computers"][39],MONITOR_TYPE=>$LANG["computers"][40],PERIPHERAL_TYPE=>$LANG["computers"][46],PHONE_TYPE=>$LANG["computers"][55]); |
||
809 | |||
810 | $ci=new CommonItem(); |
||
811 | $comp=new Computer(); |
||
812 | $info=new InfoCom(); |
||
813 | $comp->getFromDB($ID); |
||
814 | |||
815 | $i=0; |
||
816 | |||
817 | $pdf->saveState();
|
||
818 | $pdf->setColor(0.8,0.8,0.8); |
||
819 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
820 | $pdf->restoreState();
|
||
821 | $pdf->addText(250,$start_tab,9,utf8_decode('<b>'.$LANG["connect"][0].' :</b>')); |
||
822 | |||
823 | foreach ($items as $type=>$title){ |
||
824 | $query = "SELECT * from glpi_connect_wire WHERE end2='$ID' AND type='".$type."'"; |
||
825 | |||
826 | if ($result=$DB->query($query)) { |
||
827 | $resultnum = $DB->numrows($result); |
||
828 | if ($resultnum>0) { |
||
829 | |||
830 | for ($j=0; $j < $resultnum; $j++, $i++) { |
||
831 | $tID = $DB->result($result, $j, "end1"); |
||
832 | $connID = $DB->result($result, $j, "ID"); |
||
833 | $ci->getFromDB($type,$tID); |
||
834 | $info->getFromDBforDevice($type,$tID) || $info->getEmpty(); |
||
835 | |||
836 | $pdf->saveState();
|
||
837 | $pdf->setColor(0.95,0.95,0.95); |
||
838 | if ($ci->getField("otherserial")!=null || $info->fields["num_immo"]) { |
||
839 | $pdf->filledRectangle(25,($start_tab-45)-(20*$i),$width-50, 35); |
||
840 | } else {
|
||
841 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50, 15); |
||
842 | } |
||
843 | $pdf->restoreState();
|
||
844 | if ($j==0) { |
||
845 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode('<b><i>'.$ci->getType().' :</i></b>')); |
||
846 | } |
||
847 | |||
848 | $tempo=$ci->getName()." - "; |
||
849 | if($ci->getField("serial")!=null) { |
||
850 | $tempo .=$LANG["common"][19] . " : " .$ci->getField("serial")." - "; |
||
851 | } |
||
852 | $pdf->addText(120,($start_tab-20)-(20*$i),9,utf8_decode($tempo . plugin_pdf_getDropdownName("glpi_dropdown_state",$ci->getField('state')))); |
||
853 | |||
854 | $tempo=""; |
||
855 | if($ci->getField("otherserial")!=null) { |
||
856 | $tempo .=$LANG["common"][20] . " : " . $ci->getField("otherserial"); |
||
857 | } |
||
858 | if ($info->fields["num_immo"]) { |
||
859 | if ($tempo) $tempo .= " - "; |
||
860 | $tempo .=$LANG["financial"][20] . " : " . $info->fields["num_immo"]; |
||
861 | } |
||
862 | if ($tempo) { |
||
863 | $i++;
|
||
864 | $pdf->addText(200,($start_tab-20)-(20*$i),9,utf8_decode($tempo)); |
||
865 | } |
||
866 | }// each device of current type
|
||
867 | |||
868 | } else { // No row |
||
869 | |||
870 | $pdf->saveState();
|
||
871 | $pdf->setColor(0.95,0.95,0.95); |
||
872 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50,15); |
||
873 | $pdf->restoreState();
|
||
874 | |||
875 | switch ($type){ |
||
876 | case PRINTER_TYPE: |
||
877 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($LANG["computers"][38])); |
||
878 | break;
|
||
879 | case MONITOR_TYPE: |
||
880 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($LANG["computers"][37])); |
||
881 | break;
|
||
882 | case PERIPHERAL_TYPE: |
||
883 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($LANG["computers"][47])); |
||
884 | break;
|
||
885 | case PHONE_TYPE: |
||
886 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($LANG["computers"][54])); |
||
887 | break;
|
||
888 | } |
||
889 | $i++;
|
||
890 | } // No row
|
||
891 | } // Result
|
||
892 | |||
893 | if(($start_tab-20)-(20*$i)<50){ |
||
894 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
895 | $i=0; |
||
896 | $start_tab = 750; |
||
897 | } |
||
898 | } // each type
|
||
899 | |||
900 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
901 | |||
902 | $tab["start_tab"] = $start_tab; |
||
903 | $tab["pdf"] = $pdf; |
||
904 | |||
905 | return $tab; |
||
906 | |||
907 | } |
||
908 | |||
909 | function plugin_pdf_port($tab,$width,$ID,$type){ |
||
910 | |||
911 | global $DB,$LANG; |
||
912 | |||
913 | $start_tab = $tab["start_tab"]; |
||
914 | $pdf = $tab["pdf"]; |
||
915 | |||
916 | $query = "SELECT ID FROM glpi_networking_ports WHERE (on_device = ".$ID." AND device_type = ".COMPUTER_TYPE.") ORDER BY name, logical_number"; |
||
917 | |||
918 | $i=0; |
||
919 | |||
920 | if ($result = $DB->query($query)) |
||
921 | { |
||
922 | |||
923 | $nb_connect = $DB->numrows($result); |
||
924 | |||
925 | if ($nb_connect!=0) |
||
926 | { |
||
927 | |||
928 | $pdf->saveState();
|
||
929 | $pdf->setColor(0.8,0.8,0.8); |
||
930 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
931 | $pdf->restoreState();
|
||
932 | |||
933 | $pdf->addText(250,$start_tab,9,utf8_decode('<b>'.$nb_connect.' '.$LANG["networking"][13].' :</b>')); |
||
934 | |||
935 | while ($devid=$DB->fetch_row($result)) |
||
936 | { |
||
937 | |||
938 | $netport = new Netport; |
||
939 | $netport->getfromDB(current($devid)); |
||
940 | |||
941 | for($j=0,$deb=0;$j<8;$j++,$deb++){ |
||
942 | |||
943 | if(($start_tab-20)-(20*($i+$j))<50){ |
||
944 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
945 | $i=0; |
||
946 | $start_tab = 750; |
||
947 | $deb=0; |
||
948 | } |
||
949 | |||
950 | if(!($nb_connect==1 && $j==7)){ |
||
951 | $pdf->saveState();
|
||
952 | if($j<7) |
||
953 | $pdf->setColor(0.95,0.95,0.95); |
||
954 | else
|
||
955 | $pdf->setColor(0.8,0.8,0.8); |
||
956 | $pdf->filledRectangle(25,($start_tab-25)-(20*($deb+$i)),$width-50,15); |
||
957 | $pdf->restoreState();
|
||
958 | } |
||
959 | |||
960 | switch($j){ |
||
961 | case 0: |
||
962 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>#</i></b> '.$netport->fields["logical_number"].' <b><i> '.$LANG["common"][16].' :</i></b> '.$netport->fields["name"])); |
||
963 | break;
|
||
964 | case 1: |
||
965 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["networking"][51].' :</i></b> '.plugin_pdf_getDropdownName("glpi_dropdown_netpoint",$netport->fields["netpoint"]))); |
||
966 | break;
|
||
967 | case 2: |
||
968 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["networking"][14].' / '.$LANG["networking"][15].' :</i></b> '.$netport->fields["ifaddr"].' / '.$netport->fields["ifmac"])); |
||
969 | break;
|
||
970 | case 3: |
||
971 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["networking"][60].' / '.$LANG["networking"][61].' / '.$LANG["networking"][59].' :</i></b> '.$netport->fields["netmask"].' / '.$netport->fields["subnet"].' / '.$netport->fields["gateway"])); |
||
972 | break;
|
||
973 | case 4: |
||
974 | $query="SELECT * from glpi_networking_vlan WHERE FK_port='$ID'"; |
||
975 | $result2=$DB->query($query); |
||
976 | if ($DB->numrows($result2)>0) |
||
977 | while ($line=$DB->fetch_array($result2)) |
||
978 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["networking"][56].' :</i></b> '.plugin_pdf_getDropdownName("glpi_dropdown_vlan",$line["FK_vlan"]))); |
||
979 | else
|
||
980 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["networking"][56].' :</i></b> ')); |
||
981 | break;
|
||
982 | case 5: |
||
983 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][65].' :</i></b> '.plugin_pdf_getDropdownName("glpi_dropdown_iface",$netport->fields["iface"]))); |
||
984 | break;
|
||
985 | case 6: |
||
986 | $contact = new Netport; |
||
987 | $netport2 = new Netport; |
||
988 | |||
989 | if ($contact->getContact($netport->fields["ID"])) |
||
990 | { |
||
991 | $netport2->getfromDB($contact->contact_id); |
||
992 | $netport2->getDeviceData($netport2->fields["on_device"],$netport2->fields["device_type"]); |
||
993 | |||
994 | if($netport2->device_name!=null) |
||
995 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["networking"][17].' :</i></b> '.$netport2->device_name)); |
||
996 | else
|
||
997 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["networking"][17].' :</i></b>'.$LANG["connect"][1])); |
||
998 | } |
||
999 | else
|
||
1000 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["networking"][17].' :</i></b>'.$LANG["connect"][1])); |
||
1001 | break;
|
||
1002 | case 7: |
||
1003 | $i+=$deb+1; |
||
1004 | break;
|
||
1005 | } |
||
1006 | } |
||
1007 | } |
||
1008 | if($nb_connect==1) |
||
1009 | $i--;
|
||
1010 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1011 | } |
||
1012 | } |
||
1013 | else
|
||
1014 | { |
||
1015 | if(($start_tab-20)-(20*$i)<50){ |
||
1016 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1017 | $i=0; |
||
1018 | $start_tab = 750; |
||
1019 | } |
||
1020 | $pdf->saveState();
|
||
1021 | $pdf->setColor(0.8,0.8,0.8); |
||
1022 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1023 | $pdf->restoreState();
|
||
1024 | $pdf->addText(250,$start_tab,9,utf8_decode('<b>0 '.$LANG["networking"][37].'</b>')); |
||
1025 | } |
||
1026 | |||
1027 | $tab["start_tab"] = $start_tab; |
||
1028 | $tab["pdf"] = $pdf; |
||
1029 | |||
1030 | return $tab; |
||
1031 | } |
||
1032 | |||
1033 | function plugin_pdf_financial($tab,$width,$ID,$type){ |
||
1034 | |||
1035 | global $CFG_GLPI,$LANG,$LANGPDF; |
||
1036 | |||
1037 | $start_tab = $tab["start_tab"]; |
||
1038 | $pdf = $tab["pdf"]; |
||
1039 | |||
1040 | $ic = new Infocom(); |
||
1041 | $ci=new CommonItem(); |
||
1042 | |||
1043 | $i=0; |
||
1044 | |||
1045 | if ($ci->getFromDB($type,$ID)) |
||
1046 | if ($ic->getFromDBforDevice($type,$ID)){ |
||
1047 | |||
1048 | $length_tab = (($width-50)/2)-2.5; |
||
1049 | |||
1050 | $pdf->saveState();
|
||
1051 | $pdf->setColor(0.8,0.8,0.8); |
||
1052 | $pdf->filledRectangle(25,$start_tab-5,2*$length_tab+5,15); |
||
1053 | $pdf->setColor(0.95,0.95,0.95); |
||
1054 | |||
1055 | for($i=0;$i<11;$i++) |
||
1056 | { |
||
1057 | if($i<10) |
||
1058 | { |
||
1059 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$length_tab,15); |
||
1060 | $pdf->filledRectangle(25+$length_tab+5,($start_tab-25)-(20*$i),$length_tab,15); |
||
1061 | } |
||
1062 | else
|
||
1063 | { |
||
1064 | $i+=2; |
||
1065 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),2*$length_tab+5,55); |
||
1066 | } |
||
1067 | } |
||
1068 | $pdf->restoreState();
|
||
1069 | |||
1070 | $pdf->addText(250,$start_tab,9,"<b>".utf8_decode($LANG["financial"][3])."</b>"); |
||
1071 | |||
1072 | $pdf->addText(30,$start_tab-20,9,utf8_decode("<b><i>".$LANG["financial"][26]." :</i></b> ".plugin_pdf_getDropdownName("glpi_enterprises",$ic->fields["FK_enterprise"]))); |
||
1073 | $pdf->addText(30,$start_tab-40,9,utf8_decode("<b><i>".$LANG["financial"][18]." :</i></b> ".$ic->fields["num_commande"])); |
||
1074 | $pdf->addText(30,$start_tab-60,9,utf8_decode("<b><i>".$LANG["financial"][14]." :</i></b> ".convDate($ic->fields["buy_date"]))); |
||
1075 | $pdf->addText(30,$start_tab-80,9,utf8_decode("<b><i>".$LANG["financial"][15]." :</i></b> ".$ic->fields["warranty_duration"]." mois <b><i> Expire le</i></b> ".getWarrantyExpir($ic->fields["buy_date"],$ic->fields["warranty_duration"]))); |
||
1076 | $pdf->addText(30,$start_tab-100,9,utf8_decode("<b><i>".$LANG["financial"][78]." :</i></b> ".formatNumber($ic->fields["warranty_value"]))); |
||
1077 | $pdf->addText(30,$start_tab-120,9,utf8_decode("<b><i>".$LANG["rulesengine"][13]." :</i></b> ".formatNumber($ic->fields["value"]))); |
||
1078 | $pdf->addText(30,$start_tab-140,9,utf8_decode("<b><i>".$LANG["financial"][20]." :</i></b> ".$ic->fields["num_immo"])); |
||
1079 | $pdf->addText(30,$start_tab-160,9,utf8_decode("<b><i>".$LANG["financial"][23]." :</i></b> ".$ic->fields["amort_time"]." an(s)")); |
||
1080 | $pdf->addText(30,$start_tab-180,9,utf8_decode("<b><i>".$LANG["financial"][89]." :</i></b> ".showTco($ci->getField('ticket_tco'),$ic->fields["value"]))); |
||
1081 | if($ic->fields["alert"]==0) |
||
1082 | $pdf->addText(30,$start_tab-200,9,utf8_decode("<b><i>".$LANG["setup"][247]." :</i></b> ")); |
||
1083 | elseif($ic->fields["alert"]==4) |
||
1084 | $pdf->addText(30,$start_tab-200,9,utf8_decode("<b><i>".$LANG["setup"][247]." :</i></b> ".$LANG["financial"][80])); |
||
1085 | $pdf->addText(30,$start_tab-220,9,utf8_decode("<b><i>".$LANG["common"][25]." :</i></b> ")); |
||
1086 | |||
1087 | $y=$start_tab-220; |
||
1088 | $mytext=$ic->fields["comments"]; |
||
1089 | while($mytext = $pdf->addTextWrap(105,$y,2*$length_tab-80,10,utf8_decode($mytext))) |
||
1090 | $y-=10; |
||
1091 | |||
1092 | $pdf->addText($length_tab+35,$start_tab-20,9,utf8_decode("<b><i>".$LANG["financial"][82]." :</i></b> ".$ic->fields["facture"])); |
||
1093 | $pdf->addText($length_tab+35,$start_tab-40,9,utf8_decode("<b><i>".$LANG["financial"][19]." :</i></b> ".$ic->fields["bon_livraison"])); |
||
1094 | $pdf->addText($length_tab+35,$start_tab-60,9,utf8_decode("<b><i>".$LANG["financial"][76]." :</i></b> ".convDate($ic->fields["use_date"]))); |
||
1095 | $pdf->addText($length_tab+35,$start_tab-80,9,utf8_decode("<b><i>".$LANG["financial"][87]." :</i></b> ".plugin_pdf_getDropdownName("glpi_dropdown_budget",$ic->fields["budget"]))); |
||
1096 | $pdf->addText($length_tab+35,$start_tab-100,9,utf8_decode("<b><i>".$LANG["financial"][16]." :</i></b> ".$ic->fields["warranty_info"])); |
||
1097 | $pdf->addText($length_tab+35,$start_tab-120,9,utf8_decode("<b><i>".$LANG["financial"][81]." :</i></b> ".TableauAmort($ic->fields["amort_type"],$ic->fields["value"],$ic->fields["amort_time"],$ic->fields["amort_coeff"],$ic->fields["buy_date"],$ic->fields["use_date"],$CFG_GLPI["date_fiscale"],"n"))); |
||
1098 | $pdf->addText($length_tab+35,$start_tab-140,9,utf8_decode("<b><i>".$LANG["financial"][22]." :</i></b> ".getAmortTypeName($ic->fields["amort_type"]))); |
||
1099 | $pdf->addText($length_tab+35,$start_tab-160,9,utf8_decode("<b><i>".$LANG["financial"][77]." :</i></b> ".$ic->fields["amort_coeff"])); |
||
1100 | $pdf->addText($length_tab+35,$start_tab-180,9,utf8_decode("<b><i>".$LANG["financial"][90]." :</i></b> ".showTco($ci->getField('ticket_tco'),$ic->fields["value"],$ic->fields["buy_date"]))); |
||
1101 | |||
1102 | } |
||
1103 | else
|
||
1104 | { |
||
1105 | if(($start_tab-20)-(20*$i)<50){ |
||
1106 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1107 | $i=0; |
||
1108 | $start_tab = 750; |
||
1109 | } |
||
1110 | $pdf->saveState();
|
||
1111 | $pdf->setColor(0.8,0.8,0.8); |
||
1112 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1113 | $pdf->restoreState();
|
||
1114 | $pdf->addText(245,$start_tab,9,utf8_decode("<b>".$LANGPDF["financial"][1]."</b>")); |
||
1115 | } |
||
1116 | |||
1117 | |||
1118 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1119 | |||
1120 | $tab["start_tab"] = $start_tab; |
||
1121 | $tab["pdf"] = $pdf; |
||
1122 | |||
1123 | return $tab; |
||
1124 | } |
||
1125 | |||
1126 | function plugin_pdf_contract($tab,$width,$ID,$type){ |
||
1127 | |||
1128 | global $DB,$CFG_GLPI,$LANG,$LANGPDF; |
||
1129 | |||
1130 | $start_tab = $tab["start_tab"]; |
||
1131 | $pdf = $tab["pdf"]; |
||
1132 | |||
1133 | $ci=new CommonItem(); |
||
1134 | $ci->getFromDB($type,$ID); |
||
1135 | |||
1136 | $query = "SELECT * FROM glpi_contract_device WHERE glpi_contract_device.FK_device = ".$ID." AND glpi_contract_device.device_type = ".$type; |
||
1137 | |||
1138 | $result = $DB->query($query); |
||
1139 | $number = $DB->numrows($result); |
||
1140 | |||
1141 | $i=$j=0; |
||
1142 | |||
1143 | if($number>0){ |
||
1144 | |||
1145 | $pdf->saveState();
|
||
1146 | $pdf->setColor(0.8,0.8,0.8); |
||
1147 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1148 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),100,15); |
||
1149 | $pdf->filledRectangle(130,($start_tab-25)-(20*$i),100,15); |
||
1150 | $pdf->filledRectangle(235,($start_tab-25)-(20*$i),100,15); |
||
1151 | $pdf->filledRectangle(340,($start_tab-25)-(20*$i),80,15); |
||
1152 | $pdf->filledRectangle(425,($start_tab-25)-(20*$i),60,15); |
||
1153 | $pdf->filledRectangle(490,($start_tab-25)-(20*$i),80,15); |
||
1154 | $pdf->restoreState();
|
||
1155 | $pdf->addText(260,$start_tab,9,'<b>'.utf8_decode($LANG["financial"][66]).' :</b>'); |
||
1156 | $pdf->addText(65,$start_tab-20,9,'<b>'.utf8_decode($LANG["common"][16]).'</b>'); |
||
1157 | $pdf->addText(138,$start_tab-20,9,'<b>'.utf8_decode($LANG["financial"][4]).'</b>'); |
||
1158 | $pdf->addText(255,$start_tab-20,9,'<b>'.utf8_decode($LANG["financial"][6]).'</b>'); |
||
1159 | $pdf->addText(355,$start_tab-20,9,'<b>'.utf8_decode($LANG["financial"][26]).'</b>'); |
||
1160 | $pdf->addText(428,$start_tab-20,9,'<b>'.utf8_decode($LANG["search"][8]).'</b>'); |
||
1161 | $pdf->addText(515,$start_tab-20,9,'<b>'.utf8_decode($LANG["financial"][8]).'</b>'); |
||
1162 | |||
1163 | $i++;
|
||
1164 | |||
1165 | while ($j < $number) { |
||
1166 | $cID=$DB->result($result, $j, "FK_contract"); |
||
1167 | $assocID=$DB->result($result, $j, "ID"); |
||
1168 | $con=new Contract; |
||
1169 | $con->getFromDB($cID); |
||
1170 | |||
1171 | $pdf->saveState();
|
||
1172 | $pdf->setColor(0.95,0.95,0.95); |
||
1173 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),100,15); |
||
1174 | $pdf->filledRectangle(130,($start_tab-25)-(20*$i),100,15); |
||
1175 | $pdf->filledRectangle(235,($start_tab-25)-(20*$i),100,15); |
||
1176 | $pdf->filledRectangle(340,($start_tab-25)-(20*$i),80,15); |
||
1177 | $pdf->filledRectangle(425,($start_tab-25)-(20*$i),60,15); |
||
1178 | $pdf->filledRectangle(490,($start_tab-25)-(20*$i),80,15); |
||
1179 | $pdf->restoreState();
|
||
1180 | |||
1181 | if (empty($con->fields["name"])) |
||
1182 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($con->fields["ID"])); |
||
1183 | else
|
||
1184 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($con->fields["name"])); |
||
1185 | |||
1186 | $pdf->addText(135,($start_tab-20)-(20*$i),9,utf8_decode($con->fields["num"])); |
||
1187 | $pdf->addText(240,($start_tab-20)-(20*$i),9,utf8_decode(plugin_pdf_getDropdownName("glpi_dropdown_contract_type",$con->fields["contract_type"]))); |
||
1188 | |||
1189 | $temp = str_replace("<br>", "", getContractEnterprises($cID)); |
||
1190 | |||
1191 | if(strlen($temp)<14) |
||
1192 | $pdf->addText(345,($start_tab-20)-(20*$i),9,utf8_decode($temp)); |
||
1193 | else
|
||
1194 | { |
||
1195 | $temp=$pdf->addTextWrap(345,($start_tab-20)-(20*$i)+4,70,8,utf8_decode($temp)); |
||
1196 | $pdf->addTextWrap(345,($start_tab-20)-(20*$i)-4,70,8,utf8_decode($temp)); |
||
1197 | } |
||
1198 | |||
1199 | $pdf->addText(430,($start_tab-20)-(20*$i),9,utf8_decode(convDate($con->fields["begin_date"]))); |
||
1200 | |||
1201 | if ($con->fields["begin_date"]!='' && $con->fields["begin_date"]!="0000-00-00") |
||
1202 | { |
||
1203 | $pdf->addText(515,($start_tab-20)-(20*$i)+4,7,utf8_decode($con->fields["duration"]." ".$LANG["financial"][57])); |
||
1204 | $pdf->addText(505,($start_tab-20)-(20*$i)-4,7,"-> ".utf8_decode(getWarrantyExpir($con->fields["begin_date"],$con->fields["duration"]))); |
||
1205 | } |
||
1206 | else
|
||
1207 | $pdf->addText(510,($start_tab-20)-(20*$i),9,utf8_decode($con->fields["duration"]." ".$LANG["financial"][57])); |
||
1208 | |||
1209 | $i++;
|
||
1210 | $j++;
|
||
1211 | |||
1212 | if(($start_tab-20)-(20*$i)<50){ |
||
1213 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1214 | $i=0; |
||
1215 | $start_tab = 750; |
||
1216 | } |
||
1217 | } |
||
1218 | } |
||
1219 | else
|
||
1220 | { |
||
1221 | if(($start_tab-20)-(20*$i)<50){ |
||
1222 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1223 | $i=0; |
||
1224 | $start_tab = 750; |
||
1225 | } |
||
1226 | $pdf->saveState();
|
||
1227 | $pdf->setColor(0.8,0.8,0.8); |
||
1228 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1229 | $pdf->restoreState();
|
||
1230 | $pdf->addText(260,$start_tab,9,utf8_decode('<b>'.$LANGPDF["financial"][2].'</b>')); |
||
1231 | } |
||
1232 | |||
1233 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1234 | |||
1235 | $tab["start_tab"] = $start_tab; |
||
1236 | $tab["pdf"] = $pdf; |
||
1237 | |||
1238 | return $tab; |
||
1239 | } |
||
1240 | |||
1241 | function plugin_pdf_document($tab,$width,$ID,$type){ |
||
1242 | |||
1243 | global $DB,$LANG,$LANGPDF; |
||
1244 | |||
1245 | $start_tab = $tab["start_tab"]; |
||
1246 | $pdf = $tab["pdf"]; |
||
1247 | |||
1248 | $query = "SELECT glpi_doc_device.ID as assocID, glpi_docs.* FROM glpi_doc_device "; |
||
1249 | $query .= "LEFT JOIN glpi_docs ON (glpi_doc_device.FK_doc=glpi_docs.ID)"; |
||
1250 | $query .= "WHERE glpi_doc_device.FK_device = ".$ID." AND glpi_doc_device.device_type = ".$type; |
||
1251 | |||
1252 | $result = $DB->query($query); |
||
1253 | $number = $DB->numrows($result); |
||
1254 | |||
1255 | $i=0; |
||
1256 | |||
1257 | if($number>0){ |
||
1258 | |||
1259 | $pdf->saveState();
|
||
1260 | $pdf->setColor(0.8,0.8,0.8); |
||
1261 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1262 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),125,15); |
||
1263 | $pdf->filledRectangle(155,($start_tab-25)-(20*$i),120,15); |
||
1264 | $pdf->filledRectangle(280,($start_tab-25)-(20*$i),110,15); |
||
1265 | $pdf->filledRectangle(395,($start_tab-25)-(20*$i),100,15); |
||
1266 | $pdf->filledRectangle(500,($start_tab-25)-(20*$i),70,15); |
||
1267 | $pdf->restoreState();
|
||
1268 | $pdf->addText(250,$start_tab,9,'<b>'.utf8_decode($LANG["document"][21]).' :</b>'); |
||
1269 | $pdf->addText(80,$start_tab-20,9,'<b>'.utf8_decode($LANG["common"][16]).'</b>'); |
||
1270 | $pdf->addText(195,$start_tab-20,9,'<b>'.utf8_decode($LANG["document"][2]).'</b>'); |
||
1271 | $pdf->addText(315,$start_tab-20,9,'<b>'.utf8_decode($LANG["document"][33]).'</b>'); |
||
1272 | $pdf->addText(425,$start_tab-20,9,'<b>'.utf8_decode($LANG["document"][3]).'</b>'); |
||
1273 | $pdf->addText(510,$start_tab-20,9,'<b>'.utf8_decode($LANG["document"][4]).'</b>'); |
||
1274 | |||
1275 | $i++;
|
||
1276 | |||
1277 | while ($data=$DB->fetch_assoc($result)) { |
||
1278 | |||
1279 | $pdf->saveState();
|
||
1280 | $pdf->setColor(0.95,0.95,0.95); |
||
1281 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),125,15); |
||
1282 | $pdf->filledRectangle(155,($start_tab-25)-(20*$i),120,15); |
||
1283 | $pdf->filledRectangle(280,($start_tab-25)-(20*$i),110,15); |
||
1284 | $pdf->filledRectangle(395,($start_tab-25)-(20*$i),100,15); |
||
1285 | $pdf->filledRectangle(500,($start_tab-25)-(20*$i),70,15); |
||
1286 | $pdf->restoreState();
|
||
1287 | |||
1288 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($data["name"])); |
||
1289 | $pdf->addText(160,($start_tab-20)-(20*$i),9,utf8_decode($data["filename"])); |
||
1290 | $pdf->addText(285,($start_tab-20)-(20*$i),9,utf8_decode($data["link"])); |
||
1291 | $pdf->addText(400,($start_tab-20)-(20*$i),9,utf8_decode(plugin_pdf_getDropdownName("glpi_dropdown_rubdocs",$data["rubrique"]))); |
||
1292 | $pdf->addText(505,($start_tab-20)-(20*$i),9,utf8_decode($data["mime"])); |
||
1293 | |||
1294 | $i++;
|
||
1295 | |||
1296 | if(($start_tab-20)-(20*$i)<50){ |
||
1297 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1298 | $i=0; |
||
1299 | $start_tab = 750; |
||
1300 | } |
||
1301 | } |
||
1302 | } |
||
1303 | else
|
||
1304 | { |
||
1305 | if(($start_tab-20)-(20*$i)<50){ |
||
1306 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1307 | $i=0; |
||
1308 | $start_tab = 750; |
||
1309 | } |
||
1310 | $pdf->saveState();
|
||
1311 | $pdf->setColor(0.8,0.8,0.8); |
||
1312 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1313 | $pdf->restoreState();
|
||
1314 | $pdf->addText(250,$start_tab,9,'<b>'.utf8_decode($LANGPDF["document"][1]).'</b>'); |
||
1315 | } |
||
1316 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1317 | |||
1318 | $tab["start_tab"] = $start_tab; |
||
1319 | $tab["pdf"] = $pdf; |
||
1320 | |||
1321 | return $tab; |
||
1322 | } |
||
1323 | |||
1324 | function plugin_pdf_registry($tab,$width,$ID,$type){ |
||
1325 | |||
1326 | global $DB,$LANG; |
||
1327 | |||
1328 | $start_tab = $tab["start_tab"]; |
||
1329 | $pdf = $tab["pdf"]; |
||
1330 | |||
1331 | $REGISTRY_HIVE=array("HKEY_CLASSES_ROOT", |
||
1332 | "HKEY_CURRENT_USER",
|
||
1333 | "HKEY_LOCAL_MACHINE",
|
||
1334 | "HKEY_USERS",
|
||
1335 | "HKEY_CURRENT_CONFIG",
|
||
1336 | "HKEY_DYN_DATA");
|
||
1337 | |||
1338 | $query = "SELECT ID FROM glpi_registry WHERE computer_id='".$ID."'"; |
||
1339 | |||
1340 | $i=0; |
||
1341 | |||
1342 | if ($result = $DB->query($query)) { |
||
1343 | if ($DB->numrows($result)!=0) { |
||
1344 | |||
1345 | $pdf->saveState();
|
||
1346 | $pdf->setColor(0.8,0.8,0.8); |
||
1347 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1348 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),130,15); |
||
1349 | $pdf->filledRectangle(160,($start_tab-25)-(20*$i),130,15); |
||
1350 | $pdf->filledRectangle(295,($start_tab-25)-(20*$i),140,15); |
||
1351 | $pdf->filledRectangle(440,($start_tab-25)-(20*$i),130,15); |
||
1352 | $pdf->restoreState();
|
||
1353 | $pdf->addText(240,$start_tab,9,'<b>'.utf8_decode($DB->numrows($result)." ".$LANG["registry"][4]).' :</b>'); |
||
1354 | $pdf->addText(65,$start_tab-20,9,'<b>'.utf8_decode($LANG["registry"][6]).'</b>'); |
||
1355 | $pdf->addText(215,$start_tab-20,9,'<b>'.utf8_decode($LANG["registry"][1]).'</b>'); |
||
1356 | $pdf->addText(345,$start_tab-20,9,'<b>'.utf8_decode($LANG["registry"][2]).'</b>'); |
||
1357 | $pdf->addText(490,$start_tab-20,9,'<b>'.utf8_decode($LANG["registry"][3]).'</b>'); |
||
1358 | |||
1359 | $i++;
|
||
1360 | |||
1361 | while ($regid=$DB->fetch_row($result)) { |
||
1362 | $reg = new Registry; |
||
1363 | $reg->getfromDB(current($regid)); |
||
1364 | |||
1365 | $pdf->saveState();
|
||
1366 | $pdf->setColor(0.95,0.95,0.95); |
||
1367 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),130,15); |
||
1368 | $pdf->filledRectangle(160,($start_tab-25)-(20*$i),130,15); |
||
1369 | $pdf->filledRectangle(295,($start_tab-25)-(20*$i),140,15); |
||
1370 | $pdf->filledRectangle(440,($start_tab-25)-(20*$i),130,15); |
||
1371 | $pdf->restoreState();
|
||
1372 | |||
1373 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($reg->fields["registry_ocs_name"])); |
||
1374 | $pdf->addText(165,($start_tab-20)-(20*$i),9,utf8_decode($REGISTRY_HIVE[$reg->fields["registry_hive"]])); |
||
1375 | $pdf->addText(300,($start_tab-20)-(20*$i),9,utf8_decode($reg->fields["registry_path"])); |
||
1376 | $pdf->addText(445,($start_tab-20)-(20*$i),9,utf8_decode($reg->fields["registry_value"])); |
||
1377 | |||
1378 | $i++;
|
||
1379 | |||
1380 | if(($start_tab-20)-(20*$i)<50){ |
||
1381 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1382 | $i=0; |
||
1383 | $start_tab = 750; |
||
1384 | } |
||
1385 | } |
||
1386 | } |
||
1387 | else
|
||
1388 | { |
||
1389 | if(($start_tab-20)-(20*$i)<50){ |
||
1390 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1391 | $i=0; |
||
1392 | $start_tab = 750; |
||
1393 | } |
||
1394 | $pdf->saveState();
|
||
1395 | $pdf->setColor(0.8,0.8,0.8); |
||
1396 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1397 | $pdf->restoreState();
|
||
1398 | $pdf->addText(230,$start_tab,9,'<b>'.utf8_decode($LANG["registry"][5]).'</b>'); |
||
1399 | } |
||
1400 | } |
||
1401 | |||
1402 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1403 | |||
1404 | $tab["start_tab"] = $start_tab; |
||
1405 | $tab["pdf"] = $pdf; |
||
1406 | |||
1407 | return $tab; |
||
1408 | } |
||
1409 | |||
1410 | function plugin_pdf_ticket($tab,$width,$ID,$type){ |
||
1411 | |||
1412 | global $DB,$CFG_GLPI, $LANG; |
||
1413 | |||
1414 | $start_tab = $tab["start_tab"]; |
||
1415 | $pdf = $tab["pdf"]; |
||
1416 | |||
1417 | $sort="glpi_tracking.date"; |
||
1418 | $order=getTrackingOrderPrefs($_SESSION["glpiID"]); |
||
1419 | |||
1420 | $where = "(status = 'new' OR status= 'assign' OR status='plan' OR status='waiting')"; |
||
1421 | |||
1422 | $query = "SELECT ".getCommonSelectForTrackingSearch()." FROM glpi_tracking ".getCommonLeftJoinForTrackingSearch()." WHERE $where and (computer = '$ID' and device_type= ".$type.") ORDER BY $sort $order"; |
||
1423 | |||
1424 | $result = $DB->query($query); |
||
1425 | |||
1426 | $i = 0; |
||
1427 | |||
1428 | $number = $DB->numrows($result); |
||
1429 | |||
1430 | if ($number > 0) |
||
1431 | { |
||
1432 | $pdf->saveState();
|
||
1433 | $pdf->setColor(0.8,0.8,0.8); |
||
1434 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1435 | $pdf->restoreState();
|
||
1436 | $pdf->addText(260,$start_tab,9,'<b>'.utf8_decode($number.' '.$LANG["job"][17].' '.$LANG["job"][16]).' :</b>'); |
||
1437 | |||
1438 | while ($data=$DB->fetch_assoc($result)) |
||
1439 | { |
||
1440 | for($j=0,$deb=0;$j<9;$j++,$deb++){ |
||
1441 | |||
1442 | if(($start_tab-20)-(20*($i+$j))<50){ |
||
1443 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1444 | $i=0; |
||
1445 | $start_tab = 750; |
||
1446 | $deb=0; |
||
1447 | } |
||
1448 | |||
1449 | if(!($number==1 && $j==8)){ |
||
1450 | $pdf->saveState();
|
||
1451 | if($j<8) |
||
1452 | $pdf->setColor(0.95,0.95,0.95); |
||
1453 | else
|
||
1454 | $pdf->setColor(0.8,0.8,0.8); |
||
1455 | $pdf->filledRectangle(25,($start_tab-25)-(20*($deb+$i)),$width-50,15); |
||
1456 | $pdf->restoreState();
|
||
1457 | } |
||
1458 | |||
1459 | switch($j){ |
||
1460 | case 0: |
||
1461 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["state"][0].' :</i></b> ID'.$data["ID"].' '.getStatusName($data["status"]))); |
||
1462 | break;
|
||
1463 | case 1: |
||
1464 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][27].' :</i></b> '.$LANG["joblist"][11].' : '.$data["date"])); |
||
1465 | break;
|
||
1466 | case 2: |
||
1467 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["joblist"][2].' :</i></b> '.getPriorityName($data["priority"]))); |
||
1468 | break;
|
||
1469 | case 3: |
||
1470 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["job"][4].' :</i></b> '.getUserName($data["author"]))); |
||
1471 | break;
|
||
1472 | case 4: |
||
1473 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["job"][5].' :</i></b> '.getUserName($data["assign"]))); |
||
1474 | break;
|
||
1475 | case 5: |
||
1476 | $ci=new CommonItem(); |
||
1477 | $ci->getFromDB($data["device_type"],$data["computer"]); |
||
1478 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][1].' :</i></b> '.$ci->getType())); |
||
1479 | break;
|
||
1480 | case 6: |
||
1481 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][36].' :</i></b> '.$data["catname"])); |
||
1482 | break;
|
||
1483 | case 7: |
||
1484 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][57].' :</i></b> '.$data["name"])); |
||
1485 | break;
|
||
1486 | case 8: |
||
1487 | $i+=$deb+1; |
||
1488 | break;
|
||
1489 | } |
||
1490 | } |
||
1491 | if($number==1) |
||
1492 | $i--;
|
||
1493 | } |
||
1494 | } |
||
1495 | else
|
||
1496 | { |
||
1497 | if(($start_tab-20)-(20*$i)<50){ |
||
1498 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1499 | $i=0; |
||
1500 | $start_tab = 750; |
||
1501 | } |
||
1502 | $pdf->saveState();
|
||
1503 | $pdf->setColor(0.8,0.8,0.8); |
||
1504 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1505 | $pdf->restoreState();
|
||
1506 | $pdf->addText(260,$start_tab,9,'<b>'.utf8_decode($LANG["joblist"][8]).'</b>'); |
||
1507 | } |
||
1508 | |||
1509 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1510 | |||
1511 | $tab["start_tab"] = $start_tab; |
||
1512 | $tab["pdf"] = $pdf; |
||
1513 | |||
1514 | return $tab; |
||
1515 | |||
1516 | } |
||
1517 | |||
1518 | function plugin_pdf_oldticket($tab,$width,$ID,$type){ |
||
1519 | |||
1520 | global $DB,$CFG_GLPI, $LANG; |
||
1521 | |||
1522 | $start_tab = $tab["start_tab"]; |
||
1523 | $pdf = $tab["pdf"]; |
||
1524 | |||
1525 | $sort="glpi_tracking.date"; |
||
1526 | $order=getTrackingOrderPrefs($_SESSION["glpiID"]); |
||
1527 | |||
1528 | $where = "(status = 'old_done' OR status = 'old_notdone')"; |
||
1529 | $query = "SELECT ".getCommonSelectForTrackingSearch()." FROM glpi_tracking ".getCommonLeftJoinForTrackingSearch()." WHERE $where and (device_type = ".$type." and computer = '$ID') ORDER BY $sort $order"; |
||
1530 | |||
1531 | $result = $DB->query($query); |
||
1532 | |||
1533 | $i = 0; |
||
1534 | |||
1535 | $number = $DB->numrows($result); |
||
1536 | |||
1537 | if ($number > 0) |
||
1538 | { |
||
1539 | $pdf->saveState();
|
||
1540 | $pdf->setColor(0.8,0.8,0.8); |
||
1541 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1542 | $pdf->restoreState();
|
||
1543 | $pdf->addText(240,$start_tab,9,'<b>'.utf8_decode($number.' '.$LANG["job"][18].' '.$LANG["job"][17].' '.$LANG["job"][16]).' :</b>'); |
||
1544 | |||
1545 | while ($data=$DB->fetch_assoc($result)) |
||
1546 | { |
||
1547 | for($j=0,$deb=0;$j<9;$j++,$deb++){ |
||
1548 | |||
1549 | if(($start_tab-20)-(20*($i+$j))<50 && !($number==1 && $j==8)){ |
||
1550 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1551 | $i=0; |
||
1552 | $start_tab = 750; |
||
1553 | $deb=0; |
||
1554 | } |
||
1555 | |||
1556 | if(!($number==1 && $j==8)){ |
||
1557 | $pdf->saveState();
|
||
1558 | if($j<8) |
||
1559 | $pdf->setColor(0.95,0.95,0.95); |
||
1560 | else
|
||
1561 | $pdf->setColor(0.8,0.8,0.8); |
||
1562 | $pdf->filledRectangle(25,($start_tab-25)-(20*($deb+$i)),$width-50,15); |
||
1563 | $pdf->restoreState();
|
||
1564 | } |
||
1565 | |||
1566 | switch($j){ |
||
1567 | case 0: |
||
1568 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["state"][0].' :</i></b> ID'.$data["ID"].' '.getStatusName($data["status"]))); |
||
1569 | break;
|
||
1570 | case 1: |
||
1571 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][27].' :</i></b> '.$LANG["joblist"][11].' : '.$data["date"])); |
||
1572 | break;
|
||
1573 | case 2: |
||
1574 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["joblist"][2].' :</i></b> '.getPriorityName($data["priority"]))); |
||
1575 | break;
|
||
1576 | case 3: |
||
1577 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["job"][4].' :</i></b> '.getUserName($data["author"]))); |
||
1578 | break;
|
||
1579 | case 4: |
||
1580 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["job"][5].' :</i></b> '.getUserName($data["assign"]))); |
||
1581 | break;
|
||
1582 | case 5: |
||
1583 | $ci=new CommonItem(); |
||
1584 | $ci->getFromDB($data["device_type"],$data["computer"]); |
||
1585 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][1].' :</i></b> '.$ci->getType())); |
||
1586 | break;
|
||
1587 | case 6: |
||
1588 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][36].' :</i></b> '.$data["catname"])); |
||
1589 | break;
|
||
1590 | case 7: |
||
1591 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,utf8_decode('<b><i>'.$LANG["common"][57].' :</i></b> '.$data["name"])); |
||
1592 | break;
|
||
1593 | case 8: |
||
1594 | $i+=$deb+1; |
||
1595 | break;
|
||
1596 | } |
||
1597 | } |
||
1598 | if($number==1) |
||
1599 | $i--;
|
||
1600 | } |
||
1601 | } |
||
1602 | else
|
||
1603 | { |
||
1604 | if(($start_tab-20)-(20*$i)<50){ |
||
1605 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1606 | $i=0; |
||
1607 | $start_tab = 750; |
||
1608 | } |
||
1609 | $pdf->saveState();
|
||
1610 | $pdf->setColor(0.8,0.8,0.8); |
||
1611 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1612 | $pdf->restoreState();
|
||
1613 | $pdf->addText(240,$start_tab,9,'<b>'.utf8_decode($LANG["joblist"][22]).'</b>'); |
||
1614 | } |
||
1615 | |||
1616 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1617 | |||
1618 | $tab["start_tab"] = $start_tab; |
||
1619 | $tab["pdf"] = $pdf; |
||
1620 | |||
1621 | return $tab; |
||
1622 | |||
1623 | } |
||
1624 | |||
1625 | function plugin_pdf_link($tab,$width,$ID,$type){ |
||
1626 | |||
1627 | global $DB,$LANG; |
||
1628 | |||
1629 | $start_tab = $tab["start_tab"]; |
||
1630 | $pdf = $tab["pdf"]; |
||
1631 | |||
1632 | $query="SELECT glpi_links.ID as ID, glpi_links.link as link, glpi_links.name as name , glpi_links.data as data from glpi_links INNER JOIN glpi_links_device ON glpi_links.ID= glpi_links_device.FK_links WHERE glpi_links_device.device_type=".$type." ORDER BY glpi_links.name"; |
||
1633 | |||
1634 | $result=$DB->query($query); |
||
1635 | |||
1636 | $pdf->ezSetMargins(100,0,200,0); |
||
1637 | |||
1638 | $i=0; |
||
1639 | |||
1640 | $ci=new CommonItem; |
||
1641 | if ($DB->numrows($result)>0){ |
||
1642 | |||
1643 | $pdf->saveState();
|
||
1644 | $pdf->setColor(0.8,0.8,0.8); |
||
1645 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1646 | $pdf->restoreState();
|
||
1647 | $pdf->addText(230,$start_tab,9,'<b>'.utf8_decode($LANG["title"][33]).'</b>'); |
||
1648 | |||
1649 | while ($data=$DB->fetch_assoc($result)){ |
||
1650 | |||
1651 | $pdf->saveState();
|
||
1652 | $pdf->setColor(0.95,0.95,0.95); |
||
1653 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50,15); |
||
1654 | $pdf->restoreState();
|
||
1655 | |||
1656 | $name=$data["name"]; |
||
1657 | if (empty($name)) |
||
1658 | $name=$data["link"]; |
||
1659 | |||
1660 | $link=$data["link"]; |
||
1661 | $file=trim($data["data"]); |
||
1662 | if (empty($file)){ |
||
1663 | |||
1664 | $ci->getFromDB($type,$ID); |
||
1665 | if (ereg("\[NAME\]",$link)){ |
||
1666 | $link=ereg_replace("\[NAME\]",$ci->getName(),$link); |
||
1667 | } |
||
1668 | if (ereg("\[ID\]",$link)){ |
||
1669 | $link=ereg_replace("\[ID\]",$ID,$link); |
||
1670 | } |
||
1671 | |||
1672 | if (ereg("\[SERIAL\]",$link)){ |
||
1673 | if ($tmp=$ci->getField('serial')){ |
||
1674 | $link=ereg_replace("\[SERIAL\]",$tmp,$link); |
||
1675 | } |
||
1676 | } |
||
1677 | if (ereg("\[OTHERSERIAL\]",$link)){ |
||
1678 | if ($tmp=$ci->getField('otherserial')){ |
||
1679 | $link=ereg_replace("\[OTHERSERIAL\]",$tmp,$link); |
||
1680 | } |
||
1681 | } |
||
1682 | |||
1683 | if (ereg("\[LOCATIONID\]",$link)){ |
||
1684 | if ($tmp=$ci->getField('location')){ |
||
1685 | $link=ereg_replace("\[LOCATIONID\]",$tmp,$link); |
||
1686 | } |
||
1687 | } |
||
1688 | |||
1689 | if (ereg("\[LOCATION\]",$link)){ |
||
1690 | if ($tmp=$ci->getField('location')){ |
||
1691 | $link=ereg_replace("\[LOCATION\]",plugin_pdf_getDropdownName("glpi_dropdown_locations",$tmp),$link); |
||
1692 | } |
||
1693 | } |
||
1694 | if (ereg("\[NETWORK\]",$link)){ |
||
1695 | if ($tmp=$ci->getField('network')){ |
||
1696 | $link=ereg_replace("\[NETWORK\]",plugin_pdf_getDropdownName("glpi_dropdown_network",$tmp),$link); |
||
1697 | } |
||
1698 | } |
||
1699 | if (ereg("\[DOMAIN\]",$link)){ |
||
1700 | if ($tmp=$ci->getField('domain')) |
||
1701 | $link=ereg_replace("\[DOMAIN\]",plugin_pdf_getDropdownName("glpi_dropdown_domain",$tmp),$link); |
||
1702 | } |
||
1703 | $ipmac=array(); |
||
1704 | $j=0; |
||
1705 | if (ereg("\[IP\]",$link)||ereg("\[MAC\]",$link)){ |
||
1706 | $query2 = "SELECT ifaddr,ifmac FROM glpi_networking_ports WHERE (on_device = $ID AND device_type = ".$type.") ORDER BY logical_number"; |
||
1707 | $result2=$DB->query($query2); |
||
1708 | if ($DB->numrows($result2)>0) |
||
1709 | while ($data2=$DB->fetch_array($result2)){ |
||
1710 | $ipmac[$j]['ifaddr']=$data2["ifaddr"]; |
||
1711 | $ipmac[$j]['ifmac']=$data2["ifmac"]; |
||
1712 | $j++;
|
||
1713 | } |
||
1714 | } |
||
1715 | |||
1716 | if (ereg("\[IP\]",$link)||ereg("\[MAC\]",$link)){ |
||
1717 | if (count($ipmac)>0){ |
||
1718 | foreach ($ipmac as $key => $val){ |
||
1719 | $tmplink=$link; |
||
1720 | $tmplink=ereg_replace("\[IP\]",$val['ifaddr'],$tmplink); |
||
1721 | $tmplink=ereg_replace("\[MAC\]",$val['ifmac'],$tmplink); |
||
1722 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($tmplink)); |
||
1723 | } |
||
1724 | } |
||
1725 | } else
|
||
1726 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($name)); |
||
1727 | } else {
|
||
1728 | $link=$data['name']; |
||
1729 | $ci->getFromDB($type,$ID); |
||
1730 | |||
1731 | if (ereg("\[NAME\]",$link)){ |
||
1732 | $link=ereg_replace("\[NAME\]",$ci->getName(),$link); |
||
1733 | } |
||
1734 | |||
1735 | if (ereg("\[ID\]",$link)){ |
||
1736 | $link=ereg_replace("\[ID\]",$_GET["ID"],$link); |
||
1737 | } |
||
1738 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode($name)); |
||
1739 | } |
||
1740 | } |
||
1741 | $i++;
|
||
1742 | |||
1743 | if(($start_tab-20)-(20*$i)<50){ |
||
1744 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1745 | $i=0; |
||
1746 | $start_tab = 750; |
||
1747 | } |
||
1748 | } |
||
1749 | else
|
||
1750 | { |
||
1751 | if(($start_tab-20)-(20*$i)<50){ |
||
1752 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1753 | $i=0; |
||
1754 | $start_tab = 750; |
||
1755 | } |
||
1756 | $pdf->saveState();
|
||
1757 | $pdf->setColor(0.8,0.8,0.8); |
||
1758 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1759 | $pdf->restoreState();
|
||
1760 | $pdf->addText(260,$start_tab,9,'<b>'.utf8_decode($LANG["links"][7]).'</b>'); |
||
1761 | } |
||
1762 | |||
1763 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1764 | |||
1765 | $tab["start_tab"] = $start_tab; |
||
1766 | $tab["pdf"] = $pdf; |
||
1767 | |||
1768 | return $tab; |
||
1769 | } |
||
1770 | |||
1771 | function plugin_pdf_note($tab,$width,$ID,$type){ |
||
1772 | |||
1773 | global $LANGPDF,$LANG; |
||
1774 | |||
1775 | $start_tab = $tab["start_tab"]; |
||
1776 | $pdf = $tab["pdf"]; |
||
1777 | |||
1778 | $ci =new CommonItem; |
||
1779 | $ci->getfromDB ($type,$ID); |
||
1780 | |||
1781 | $length = strlen($ci->getField('notes')); |
||
1782 | |||
1783 | $i=0; |
||
1784 | |||
1785 | if($length>0) |
||
1786 | { |
||
1787 | |||
1788 | $pdf->saveState();
|
||
1789 | $pdf->setColor(0.8,0.8,0.8); |
||
1790 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1791 | $pdf->restoreState();
|
||
1792 | $pdf->addText(280,$start_tab,9,'<b>'.utf8_decode($LANG["title"][37]).'</b>'); |
||
1793 | |||
1794 | $nbline = $length/140; |
||
1795 | $temp=utf8_decode($ci->getField('notes')); |
||
1796 | $i=$j=0; |
||
1797 | while($j<$nbline) |
||
1798 | { |
||
1799 | $pdf->saveState();
|
||
1800 | $pdf->setColor(0.95,0.95,0.95); |
||
1801 | if($j==0) |
||
1802 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50,15); |
||
1803 | else
|
||
1804 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50,20); |
||
1805 | $pdf->restoreState();
|
||
1806 | |||
1807 | $temp = $pdf->addTextWrap(40,($start_tab-20)-(20*$i),$width-80,9,$temp); |
||
1808 | $i++;
|
||
1809 | $j++;
|
||
1810 | |||
1811 | if(($start_tab-20)-(20*$i)<50){ |
||
1812 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1813 | $i=0; |
||
1814 | $start_tab = 750; |
||
1815 | } |
||
1816 | } |
||
1817 | } |
||
1818 | else
|
||
1819 | { |
||
1820 | if(($start_tab-20)-(20*$i)<50){ |
||
1821 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1822 | $i=0; |
||
1823 | $start_tab = 750; |
||
1824 | } |
||
1825 | $pdf->saveState();
|
||
1826 | $pdf->setColor(0.8,0.8,0.8); |
||
1827 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1828 | $pdf->restoreState();
|
||
1829 | $pdf->addText(260,$start_tab,9,'<b>'.utf8_decode($LANGPDF["note"][1]).'</b>'); |
||
1830 | } |
||
1831 | |||
1832 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
1833 | |||
1834 | $tab["start_tab"] = $start_tab; |
||
1835 | $tab["pdf"] = $pdf; |
||
1836 | |||
1837 | return $tab; |
||
1838 | } |
||
1839 | |||
1840 | function plugin_pdf_reservation($tab,$width,$ID,$type){ |
||
1841 | |||
1842 | global $DB,$LANG,$CFG_GLPI; |
||
1843 | |||
1844 | $start_tab = $tab["start_tab"]; |
||
1845 | $pdf = $tab["pdf"]; |
||
1846 | |||
1847 | $resaID=0; |
||
1848 | |||
1849 | $i=0; |
||
1850 | |||
1851 | $pdf->ezSetMargins(200,0,200,0); |
||
1852 | |||
1853 | if ($resaID=isReservable($type,$ID)) |
||
1854 | { |
||
1855 | $ri=new ReservationItem; |
||
1856 | $ri->getFromDB($resaID); |
||
1857 | |||
1858 | $now=$_SESSION["glpi_currenttime"]; |
||
1859 | $query = "SELECT * FROM glpi_reservation_resa WHERE end > '".$now."' AND id_item='$resaID' ORDER BY begin"; |
||
1860 | $result=$DB->query($query); |
||
1861 | |||
1862 | $pdf->saveState();
|
||
1863 | $pdf->setColor(0.8,0.8,0.8); |
||
1864 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
1865 | $pdf->restoreState();
|
||
1866 | $pdf->addText(245,$start_tab,9,'<b>'.utf8_decode($LANG["reservation"][35]).'</b>'); |
||
1867 | |||
1868 | if(($start_tab-20)-(20*$i)<50){ |
||
1869 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1870 | $i=0; |
||
1871 | $start_tab = 750; |
||
1872 | } |
||
1873 | |||
1874 | if ($DB->numrows($result)==0) |
||
1875 | { |
||
1876 | $pdf->saveState();
|
||
1877 | $pdf->setColor(0.95,0.95,0.95); |
||
1878 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50,15); |
||
1879 | $pdf->restoreState();
|
||
1880 | $pdf->addText(265,($start_tab-20)-(20*$i),9,utf8_decode($LANG["reservation"][37])); |
||
1881 | $i++;
|
||
1882 | |||
1883 | if(($start_tab-20)-(20*$i)<50){ |
||
1884 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1885 | $i=0; |
||
1886 | $start_tab = 750; |
||
1887 | } |
||
1888 | } |
||
1889 | else
|
||
1890 | { |
||
1891 | $pdf->saveState();
|
||
1892 | $pdf->setColor(0.8,0.8,0.8); |
||
1893 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),90,15); |
||
1894 | $pdf->filledRectangle(120,($start_tab-25)-(20*$i),90,15); |
||
1895 | $pdf->filledRectangle(215,($start_tab-25)-(20*$i),140,15); |
||
1896 | $pdf->filledRectangle(360,($start_tab-25)-(20*$i),210,15); |
||
1897 | $pdf->restoreState();
|
||
1898 | |||
1899 | $pdf->addText(45,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["search"][8]).'</b>'); |
||
1900 | $pdf->addText(150,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["search"][9]).'</b>'); |
||
1901 | $pdf->addText(280,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["reservation"][31]).'</b>'); |
||
1902 | $pdf->addText(435,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["common"][25]).'</b>'); |
||
1903 | |||
1904 | $i++;
|
||
1905 | |||
1906 | if(($start_tab-20)-(20*$i)<50){ |
||
1907 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1908 | $i=0; |
||
1909 | $start_tab = 750; |
||
1910 | } |
||
1911 | |||
1912 | while ($data=$DB->fetch_assoc($result)) |
||
1913 | { |
||
1914 | $pdf->saveState();
|
||
1915 | $pdf->setColor(0.95,0.95,0.95); |
||
1916 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),90,15); |
||
1917 | $pdf->filledRectangle(120,($start_tab-25)-(20*$i),90,15); |
||
1918 | $pdf->filledRectangle(215,($start_tab-25)-(20*$i),140,15); |
||
1919 | $pdf->filledRectangle(360,($start_tab-25)-(20*$i),210,15); |
||
1920 | $pdf->restoreState();
|
||
1921 | |||
1922 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode(convDateTime($data["begin"]))); |
||
1923 | $pdf->addText(125,($start_tab-20)-(20*$i),9,utf8_decode($data["end"])); |
||
1924 | $pdf->addText(220,($start_tab-20)-(20*$i),9,utf8_decode($data["id_user"])); |
||
1925 | $pdf->addText(365,($start_tab-20)-(20*$i),9,utf8_decode($data["comment"])); |
||
1926 | |||
1927 | $i++;
|
||
1928 | |||
1929 | if(($start_tab-20)-(20*$i)<50){ |
||
1930 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1931 | $i=0; |
||
1932 | $start_tab = 750; |
||
1933 | } |
||
1934 | } |
||
1935 | } |
||
1936 | |||
1937 | $i++;
|
||
1938 | |||
1939 | if(($start_tab-20)-(20*$i)<50){ |
||
1940 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1941 | $i=0; |
||
1942 | $start_tab = 750; |
||
1943 | } |
||
1944 | |||
1945 | $query = "SELECT * FROM glpi_reservation_resa WHERE end <= '".$now."' AND id_item='$resaID' ORDER BY begin DESC"; |
||
1946 | $result=$DB->query($query); |
||
1947 | |||
1948 | $pdf->saveState();
|
||
1949 | $pdf->setColor(0.8,0.8,0.8); |
||
1950 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50,15); |
||
1951 | $pdf->restoreState();
|
||
1952 | $pdf->addText(260,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["reservation"][36]).'</b>'); |
||
1953 | |||
1954 | $i++;
|
||
1955 | |||
1956 | if(($start_tab-20)-(20*$i)<50){ |
||
1957 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1958 | $i=0; |
||
1959 | $start_tab = 750; |
||
1960 | } |
||
1961 | |||
1962 | if ($DB->numrows($result)==0) |
||
1963 | { |
||
1964 | $pdf->saveState();
|
||
1965 | $pdf->setColor(0.95,0.95,0.95); |
||
1966 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),$width-50,15); |
||
1967 | $pdf->restoreState();
|
||
1968 | $pdf->addText(265,$start_tab,9,utf8_decode($LANG["reservation"][37])); |
||
1969 | } |
||
1970 | else
|
||
1971 | { |
||
1972 | $pdf->saveState();
|
||
1973 | $pdf->setColor(0.8,0.8,0.8); |
||
1974 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),90,15); |
||
1975 | $pdf->filledRectangle(120,($start_tab-25)-(20*$i),90,15); |
||
1976 | $pdf->filledRectangle(215,($start_tab-25)-(20*$i),140,15); |
||
1977 | $pdf->filledRectangle(360,($start_tab-25)-(20*$i),210,15); |
||
1978 | $pdf->restoreState();
|
||
1979 | |||
1980 | $pdf->addText(45,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["search"][8]).'</b>'); |
||
1981 | $pdf->addText(150,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["search"][9]).'</b>'); |
||
1982 | $pdf->addText(280,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["reservation"][31]).'</b>'); |
||
1983 | $pdf->addText(435,($start_tab-20)-(20*$i),9,'<b>'.utf8_decode($LANG["common"][25]).'</b>'); |
||
1984 | |||
1985 | $i++;
|
||
1986 | |||
1987 | if(($start_tab-20)-(20*$i)<50){ |
||
1988 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
1989 | $i=0; |
||
1990 | $start_tab = 750; |
||
1991 | } |
||
1992 | |||
1993 | while ($data=$DB->fetch_assoc($result)) |
||
1994 | { |
||
1995 | $pdf->saveState();
|
||
1996 | $pdf->setColor(0.95,0.95,0.95); |
||
1997 | $pdf->filledRectangle(25,($start_tab-25)-(20*$i),90,15); |
||
1998 | $pdf->filledRectangle(120,($start_tab-25)-(20*$i),90,15); |
||
1999 | $pdf->filledRectangle(215,($start_tab-25)-(20*$i),140,15); |
||
2000 | $pdf->filledRectangle(360,($start_tab-25)-(20*$i),210,15); |
||
2001 | $pdf->restoreState();
|
||
2002 | |||
2003 | $pdf->addText(30,($start_tab-20)-(20*$i),9,utf8_decode(convDateTime($data["begin"]))); |
||
2004 | $pdf->addText(125,($start_tab-20)-(20*$i),9,utf8_decode($data["end"])); |
||
2005 | $pdf->addText(220,($start_tab-20)-(20*$i),9,utf8_decode($data["id_user"])); |
||
2006 | $pdf->addText(365,($start_tab-20)-(20*$i),9,utf8_decode($data["comment"])); |
||
2007 | |||
2008 | $i++;
|
||
2009 | |||
2010 | if(($start_tab-20)-(20*$i)<50){ |
||
2011 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
2012 | $i=0; |
||
2013 | $start_tab = 750; |
||
2014 | } |
||
2015 | } |
||
2016 | } |
||
2017 | |||
2018 | } |
||
2019 | else
|
||
2020 | { |
||
2021 | if(($start_tab-20)-(20*$i)<50){ |
||
2022 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
2023 | $i=0; |
||
2024 | $start_tab = 750; |
||
2025 | } |
||
2026 | $pdf->saveState();
|
||
2027 | $pdf->setColor(0.8,0.8,0.8); |
||
2028 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
2029 | $pdf->restoreState();
|
||
2030 | $pdf->addText(250,$start_tab,9,'<b>'.utf8_decode($LANG["reservation"][34]).'</b>'); |
||
2031 | } |
||
2032 | |||
2033 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
2034 | |||
2035 | $tab["start_tab"] = $start_tab; |
||
2036 | $tab["pdf"] = $pdf; |
||
2037 | |||
2038 | return $tab; |
||
2039 | } |
||
2040 | |||
2041 | function plugin_pdf_history($tab,$width,$ID,$type){ |
||
2042 | |||
2043 | global $DB,$LANG; |
||
2044 | |||
2045 | $start_tab = $tab["start_tab"]; |
||
2046 | $pdf = $tab["pdf"]; |
||
2047 | |||
2048 | $SEARCH_OPTION=getSearchOptions();
|
||
2049 | |||
2050 | $query="SELECT * FROM glpi_history WHERE FK_glpi_device='".$ID."' AND device_type='".$type."' ORDER BY ID DESC;"; |
||
2051 | |||
2052 | $result = $DB->query($query); |
||
2053 | $number = $DB->numrows($result); |
||
2054 | |||
2055 | $pdf->saveState();
|
||
2056 | $pdf->setColor(0.8,0.8,0.8); |
||
2057 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
2058 | $pdf->restoreState();
|
||
2059 | $pdf->addText(280,$start_tab,9,'<b>'.utf8_decode($LANG["title"][38]).'</b>'); |
||
2060 | |||
2061 | $i=0; |
||
2062 | |||
2063 | if($number!=0){ |
||
2064 | while ($data =$DB->fetch_array($result)){ |
||
2065 | $field=""; |
||
2066 | if($data["linked_action"]){ |
||
2067 | switch ($data["linked_action"]){ |
||
2068 | |||
2069 | case HISTORY_ADD_DEVICE : |
||
2070 | $field = getDeviceTypeLabel($data["device_internal_type"]); |
||
2071 | $change = $LANG["devices"][25]." ".$data[ "new_value"]; |
||
2072 | break;
|
||
2073 | |||
2074 | case HISTORY_UPDATE_DEVICE : |
||
2075 | $field = getDeviceTypeLabel($data["device_internal_type"]); |
||
2076 | $change = getDeviceSpecifityLabel($data["device_internal_type"]).$data[ "old_value"].$data[ "new_value"]; |
||
2077 | break;
|
||
2078 | |||
2079 | case HISTORY_DELETE_DEVICE : |
||
2080 | $field = getDeviceTypeLabel($data["device_internal_type"]); |
||
2081 | $change = $LANG["devices"][26]." ".$data["old_value"]; |
||
2082 | break;
|
||
2083 | case HISTORY_INSTALL_SOFTWARE : |
||
2084 | $field = $LANG["help"][31]; |
||
2085 | $change = $LANG["software"][44]." ".$data["new_value"]; |
||
2086 | break;
|
||
2087 | case HISTORY_UNINSTALL_SOFTWARE : |
||
2088 | $field = $LANG["help"][31]; |
||
2089 | $change = $LANG["software"][45]." ".$data["old_value"]; |
||
2090 | break;
|
||
2091 | case HISTORY_DISCONNECT_DEVICE: |
||
2092 | $ci = new CommonItem(); |
||
2093 | $ci->setType($data["device_internal_type"]); |
||
2094 | $field = $ci->getType(); |
||
2095 | $change = $LANG["central"][6]." ".$data["old_value"]; |
||
2096 | break;
|
||
2097 | case HISTORY_CONNECT_DEVICE: |
||
2098 | $ci = new CommonItem(); |
||
2099 | $ci->setType($data["device_internal_type"]); |
||
2100 | $field = $ci->getType(); |
||
2101 | $change = $LANG["log"][55]." ".$data["new_value"]; |
||
2102 | break;
|
||
2103 | case HISTORY_OCS_IMPORT: |
||
2104 | $ci = new CommonItem(); |
||
2105 | $ci->setType($data["device_internal_type"]); |
||
2106 | $field = $ci->getType(); |
||
2107 | $change = $LANG["ocsng"][7]." ".$LANG["ocsng"][45]." : ".$data["new_value"]; |
||
2108 | break;
|
||
2109 | case HISTORY_OCS_DELETE: |
||
2110 | $ci = new CommonItem(); |
||
2111 | $ci->setType($data["device_internal_type"]); |
||
2112 | $field = $ci->getType(); |
||
2113 | $change = $LANG["ocsng"][46]." ".$LANG["ocsng"][45]." : ".$data["old_value"]; |
||
2114 | break;
|
||
2115 | case HISTORY_OCS_LINK: |
||
2116 | $ci = new CommonItem(); |
||
2117 | $ci->setType($data["device_internal_type"]); |
||
2118 | $field = $ci->getType(); |
||
2119 | $change = $LANG["ocsng"][47]." ".$LANG["ocsng"][45]." : ".$data["new_value"]; |
||
2120 | break;
|
||
2121 | case HISTORY_OCS_IDCHANGED: |
||
2122 | $ci = new CommonItem(); |
||
2123 | $ci->setType($data["device_internal_type"]); |
||
2124 | $field = $ci->getType(); |
||
2125 | $change = $LANG["ocsng"][48].$data["old_value"].$data["new_value"]; |
||
2126 | break;
|
||
2127 | } |
||
2128 | } |
||
2129 | else{
|
||
2130 | $fieldname=""; |
||
2131 | foreach($SEARCH_OPTION[COMPUTER_TYPE] as $key2 => $val2) |
||
2132 | if($key2==$data["id_search_option"]){ |
||
2133 | $field = $val2["name"]; |
||
2134 | $fieldname = $val2["field"]; |
||
2135 | } |
||
2136 | |||
2137 | if ($fieldname=="comments") |
||
2138 | $change = $LANG["log"][64]; |
||
2139 | else
|
||
2140 | $change = $data[ "old_value"].$data[ "new_value"]; |
||
2141 | } |
||
2142 | |||
2143 | for($j=0,$deb=0;$j<6;$j++,$deb++){ |
||
2144 | |||
2145 | if(($start_tab-20)-(20*($i+$j))<50){ |
||
2146 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
2147 | $i=0; |
||
2148 | $start_tab = 750; |
||
2149 | $deb=0; |
||
2150 | } |
||
2151 | |||
2152 | $pdf->saveState();
|
||
2153 | if($j<5) |
||
2154 | $pdf->setColor(0.95,0.95,0.95); |
||
2155 | else
|
||
2156 | $pdf->setColor(0.8,0.8,0.8); |
||
2157 | $pdf->filledRectangle(25,($start_tab-25)-(20*($deb+$i)),$width-50,15); |
||
2158 | $pdf->restoreState();
|
||
2159 | |||
2160 | switch($j){ |
||
2161 | case 0: |
||
2162 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,'<b><i>'.utf8_decode($LANG["common"][2].' : </i></b> '.$data["ID"])); |
||
2163 | break;
|
||
2164 | case 1: |
||
2165 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,'<b><i>'.utf8_decode($LANG["common"][27].' : </i></b> '.convDateTime($data["date_mod"]))); |
||
2166 | break;
|
||
2167 | case 2: |
||
2168 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,'<b><i>'.utf8_decode($LANG["common"][34].' : </i></b> '.$data["user_name"])); |
||
2169 | break;
|
||
2170 | case 3: |
||
2171 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,'<b><i>'.utf8_decode($LANG["event"][18].' : </i></b> '.$field)); |
||
2172 | break;
|
||
2173 | case 4: |
||
2174 | $pdf->addText(27,($start_tab-20)-(20*($i+$deb)),9,'<b><i>'.utf8_decode($LANG["event"][19].' : </i></b> '.$change)); |
||
2175 | break;
|
||
2176 | case 5: |
||
2177 | $i+=$deb+1; |
||
2178 | break;
|
||
2179 | } |
||
2180 | } |
||
2181 | } |
||
2182 | } |
||
2183 | else
|
||
2184 | { |
||
2185 | if(($start_tab-20)-(20*$i)<50){ |
||
2186 | $pdf = plugin_pdf_newPage($pdf,$ID,$type); |
||
2187 | $i=0; |
||
2188 | $start_tab = 750; |
||
2189 | } |
||
2190 | $pdf->saveState();
|
||
2191 | $pdf->setColor(0.8,0.8,0.8); |
||
2192 | $pdf->filledRectangle(25,$start_tab-5,$width-50,15); |
||
2193 | $pdf->restoreState();
|
||
2194 | $pdf->addText(260,$start_tab,9,"<b>".utf8_decode($LANG["event"][20])."</b>"); |
||
2195 | } |
||
2196 | |||
2197 | $start_tab = ($start_tab-20)-(20*$i) - 20; |
||
2198 | |||
2199 | $tab["start_tab"] = $start_tab; |
||
2200 | $tab["pdf"] = $pdf; |
||
2201 | |||
2202 | return $tab; |
||
2203 | } |
||
2204 | |||
2205 | function plugin_pdf_newPage($pdf,$ID,$type){ |
||
2206 | $pdf->ezText("",1000); |
||
2207 | $pdf->ezText("",9); |
||
2208 | if($type!=-1) |
||
2209 | $pdf = plugin_pdf_add_header($pdf,$ID,$type); |
||
2210 | return $pdf; |
||
2211 | } |
||
2212 | |||
2213 | function plugin_pdf_general($type,$tab_id,$tab){ |
||
2214 | |||
2215 | $pdf= new Cezpdf('a4','portrait'); |
||
2216 | $width = $pdf->ez['pageWidth']; |
||
2217 | $pdf->openHere('Fit'); |
||
2218 | $start_tab = 750; |
||
2219 | $tab_pdf = array("pdf"=>$pdf,"start_tab"=>$start_tab); |
||
2220 | |||
2221 | $nb_id = count($tab_id); |
||
2222 | |||
2223 | $tab_pdf = plugin_pdf_background($tab_pdf,$width); |
||
2224 | |||
2225 | foreach($tab_id as $key => $ID) |
||
2226 | { |
||
2227 | switch($type){ |
||
2228 | case COMPUTER_TYPE: |
||
2229 | |||
2230 | $tab_pdf["pdf"] = plugin_pdf_add_header($tab_pdf["pdf"],$ID,COMPUTER_TYPE); |
||
2231 | $tab_pdf = plugin_pdf_config_computer($tab_pdf,$width,$ID); |
||
2232 | 892c5791 | Eric Seigne | //erics, on ajoute systematiquement le contenu materiel ...
|
2233 | $tab_pdf = plugin_pdf_device($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2234 | 7b214c36 | Eric Seigne | |
2235 | for($i=0;$i<count($tab);$i++) |
||
2236 | { |
||
2237 | switch($tab[$i]){ |
||
2238 | case 0: |
||
2239 | $tab_pdf = plugin_pdf_financial($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2240 | $tab_pdf = plugin_pdf_contract($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2241 | break;
|
||
2242 | case 1: |
||
2243 | $tab_pdf = plugin_pdf_connection($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2244 | $tab_pdf = plugin_pdf_port($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2245 | break;
|
||
2246 | case 2: |
||
2247 | $tab_pdf = plugin_pdf_device($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2248 | break;
|
||
2249 | case 3: |
||
2250 | $tab_pdf = plugin_pdf_software($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2251 | break;
|
||
2252 | case 4: |
||
2253 | $tab_pdf = plugin_pdf_ticket($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2254 | $tab_pdf = plugin_pdf_oldticket($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2255 | break;
|
||
2256 | case 5: |
||
2257 | $tab_pdf = plugin_pdf_document($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2258 | break;
|
||
2259 | case 6: |
||
2260 | $tab_pdf = plugin_pdf_registry($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2261 | break;
|
||
2262 | case 7: |
||
2263 | $tab_pdf = plugin_pdf_link($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2264 | break;
|
||
2265 | case 8: |
||
2266 | $tab_pdf = plugin_pdf_note($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2267 | break;
|
||
2268 | case 9: |
||
2269 | $tab_pdf = plugin_pdf_reservation($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2270 | break;
|
||
2271 | case 10: |
||
2272 | $tab_pdf = plugin_pdf_history($tab_pdf,$width,$ID,COMPUTER_TYPE); |
||
2273 | break;
|
||
2274 | default:
|
||
2275 | break;
|
||
2276 | } |
||
2277 | } |
||
2278 | break;
|
||
2279 | |||
2280 | case SOFTWARE_TYPE: |
||
2281 | |||
2282 | $tab_pdf["pdf"] = plugin_pdf_add_header($tab_pdf["pdf"],$ID,SOFTWARE_TYPE); |
||
2283 | $tab_pdf = plugin_pdf_config_software($tab_pdf,$width,$ID); |
||
2284 | |||
2285 | for($i=0;$i<count($tab);$i++) |
||
2286 | { |
||
2287 | switch($tab[$i]){ |
||
2288 | case 0: |
||
2289 | $tab_pdf = plugin_pdf_licenses($tab_pdf,$width,$ID,0,SOFTWARE_TYPE); |
||
2290 | break;
|
||
2291 | case 1: |
||
2292 | $tab_pdf = plugin_pdf_licenses($tab_pdf,$width,$ID,1,SOFTWARE_TYPE); |
||
2293 | break;
|
||
2294 | case 2: |
||
2295 | $tab_pdf = plugin_pdf_financial($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2296 | $tab_pdf = plugin_pdf_contract($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2297 | break;
|
||
2298 | case 3: |
||
2299 | $tab_pdf = plugin_pdf_document($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2300 | break;
|
||
2301 | case 4: |
||
2302 | $tab_pdf = plugin_pdf_ticket($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2303 | $tab_pdf = plugin_pdf_oldticket($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2304 | break;
|
||
2305 | case 5: |
||
2306 | $tab_pdf = plugin_pdf_link($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2307 | break;
|
||
2308 | case 6: |
||
2309 | $tab_pdf = plugin_pdf_note($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2310 | break;
|
||
2311 | case 7: |
||
2312 | $tab_pdf = plugin_pdf_reservation($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2313 | break;
|
||
2314 | case 8: |
||
2315 | $tab_pdf = plugin_pdf_history($tab_pdf,$width,$ID,SOFTWARE_TYPE); |
||
2316 | break;
|
||
2317 | default:
|
||
2318 | break;
|
||
2319 | } |
||
2320 | } |
||
2321 | break;
|
||
2322 | } |
||
2323 | if($nb_id!=$key+1) |
||
2324 | { |
||
2325 | $tab_pdf["pdf"] = plugin_pdf_newPage($tab_pdf["pdf"],$ID,-1); |
||
2326 | $tab_pdf["start_tab"] = 750; |
||
2327 | } |
||
2328 | } |
||
2329 | |||
2330 | $tab_pdf["pdf"]->ezStream(); |
||
2331 | } |
||
2332 | |||
2333 | /**
|
||
2334 | * Print out an HTML checkbox
|
||
2335 | * @param
|
||
2336 | */
|
||
2337 | function checkbox($myname,$label,$value,$checked=false) |
||
2338 | { |
||
2339 | echo "<td><input type='checkbox' ".($checked==true?"checked='checked'":'')." name='$myname' value='$value'>".$label."</td>"; |
||
2340 | } |
||
2341 | |||
2342 | ?> |