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