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