Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / plugins / manageentity / inc / plugin_manageentity.functions_display.php @ 7ae025a9

Historique | Voir | Annoter | Télécharger (21,1 ko)

1 b67d8923 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-manageentity.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
// ----------------------------------------------------------------------
31
// Original Author of file: GRISARD Jean Marc & CAILLAUD Xavier
32
// Purpose of file:
33
// ----------------------------------------------------------------------
34
35
if (!defined('GLPI_ROOT')){
36
        die("Sorry. You can't access directly to this file");
37
        }
38
39
function plugin_manageentity_showcontractsassociated($instID) {
40
        GLOBAL $DB,$CFG_GLPI, $LANG, $LANGMANAGEENTITY;
41
42
        $query = "SELECT glpi_contracts.*, glpi_plugin_manageentity_contracts.ID as ID_us FROM glpi_plugin_manageentity_contracts, glpi_contracts WHERE glpi_plugin_manageentity_contracts.FK_contracts=glpi_contracts.ID AND glpi_plugin_manageentity_contracts.FK_entity = '$instID' ORDER BY glpi_contracts.name";
43
        $result = $DB->query($query);
44
        $number = $DB->numrows($result);
45
        
46
        if($number !="0"){
47
                echo "<form method='post' action=\"./index.php\">";
48
                echo "<div align='center'><table class='tab_cadre' align='center' width='95%'>";
49
                echo "<tr><th colspan='4'>".$LANGMANAGEENTITY["manageentity"][3]."</th></tr>";
50
                echo "<tr><th>".$LANG["common"][16]."</th>";
51
                echo "<th>".$LANG["financial"][4]."</th>";
52
                echo "<th>".$LANG["common"][25]."</th>";        
53
                if(plugin_manageentity_HaveRight("manageentity","w"))
54
                        echo "<th>&nbsp;</th>";
55
                echo "</tr>";
56
57
                while ($data=$DB->fetch_array($result)){
58
59
                        echo "<tr class='tab_bg_1".($data["deleted"]=='1'?"_2":"")."'>";
60
                        echo "<td><a href=\"".$CFG_GLPI["root_doc"]."/front/contract.form.php?ID=".$data["ID"]."\">".$data["name"]."";
61
                        if ($CFG_GLPI["view_ID"]||empty($data["name"])) echo " (".$data["ID"].")";
62
                        echo "</a></td>";
63
                        echo "<td align='center'>".$data["num"]."</td>";
64
                        echo "<td align='center'>".nl2br($data["comments"])."</td>";
65
                        if(plugin_manageentity_HaveRight("manageentity","w"))
66
                                echo "<td align='center' class='tab_bg_2'><a href=\"".$_SERVER["PHP_SELF"]."?deletecontracts=deletecontracts&amp;ID=".$data["ID_us"]."&amp;manageentity=$instID\">".$LANG["buttons"][6]."</a></td>";
67
                        else echo "";
68
                        echo "</tr>";
69
70
                }
71
                echo "</table></div>" ;
72
                echo"</form>";
73
        }
74
        else{
75
                echo "<form method='post' action=\"./index.php\">";
76
                echo "<div align='center'><table class='tab_cadre' align='center' width='95%'>";
77 1b365d67 Eric Seigne
                echo "<tr><th colspan='3'>".$LANGMANAGEENTITY["manageentity"][3]." - <a href=\"" . $CFG_GLPI["root_doc"] . "/front/contract.form.php\">[créer un contrat]</a> :</th></tr>";
78 b67d8923 Eric Seigne
                echo "<tr><th>".$LANG["common"][16]."</th>";
79
                echo "<th>".$LANG["financial"][4]."</th>";
80
                echo "<th>".$LANG["common"][25]."</th>";
81
82
                echo "</tr>";
83
                if(plugin_manageentity_HaveRight("manageentity","w")){
84
                        echo "<tr class='tab_bg_1'><td align='center'>";
85
                        echo "<input type='hidden' name='conID' value='$instID'>";
86
87
                        dropdown("glpi_contracts","entID",1,$instID);
88
                        echo "</td><td align='center'><input type='submit' name='addcontracts' value=\"".$LANG["buttons"][8]."\" class='submit'>";
89
                        echo "</td><td></td>";
90
                        echo "</tr>";
91
                }
92
                echo "</table></div></form>";
93
        }
94
}
95
96
function plugin_manageentity_showreports($instID) {
97
        GLOBAL $DB,$CFG_GLPI, $LANG, $LANGMANAGEENTITY;
98
                
99
        $plugin_ticketreport= new plugin_ticketreport();
100
        $plugin_ticketreport->GetFromDB(1);
101
        
102
        $query = "SELECT glpi_docs.* FROM glpi_docs WHERE glpi_docs.FK_entities='".$instID."' AND rubrique='".$plugin_ticketreport->fields["rubrique"]."' ORDER BY glpi_docs.date_mod DESC LIMIT 10";
103
        $result = $DB->query($query);
104
        $number = $DB->numrows($result);
105
                        
106
        if($number !="0"){
107
                echo "<br><form method='post' action=\"./index.php\">";
108
                echo "<div align='center'><table class='tab_cadre' align='center' width='95%'>";
109
                echo "<tr><th colspan='6'>".$LANGMANAGEENTITY["manageentity"][4]." <a href='".$CFG_GLPI["root_doc"]."/front/document.php?contains%5B0%5D=cri&amp;field%5B0%5D=7&amp;sort=19&amp;deleted=0&amp;start=0'>".$LANGMANAGEENTITY["manageentity"][9]."</a></th></tr>";
110
                echo "<tr><th>".$LANG["common"][16]."</th>";
111
                echo "<th width='100px'>".$LANG["document"][2]."</th>";
112
                echo "<th>".$LANG["common"][27]."</th>";
113
                echo "<th>".$LANGMANAGEENTITY["manageentity"][8]."</th>";
114
                
115
116
                echo "</tr>";
117
118
                while ($data=$DB->fetch_array($result)){
119
                        
120
                        echo "<tr class='tab_bg_1".($data["deleted"]=='1'?"_2":"")."'>";
121
                        echo "<td align='left'><a href='".$CFG_GLPI["root_doc"]."/front/document.form.php?ID=".$data["ID"]."'><b>".$data["name"];
122
                        if ($CFG_GLPI["view_ID"]) echo " (".$data["ID"].")";
123
                        echo "</b></a></td>";
124
125
                        echo "<td align='center'  width='100px'>".getDocumentLink($data["filename"])."</td>";
126
                        echo "<td align='center'>".convdate($data["date_mod"])."</td>";
127
                        $job=new job();
128
                        if($job->getFromDB($data["FK_tracking"])){
129
                                if($job->fields["assign"])
130
                                        echo "<td align='center'>".getUserName($job->fields["assign"])."</td>";
131
                                else echo "<td align='center'>".$LANG["mailing"][105]."</td>";
132
                                }else echo "<td align='center'></td>";
133
                        echo "</tr>";
134
135
                }
136
                echo "</table></div></form>";
137
        }
138
}
139
140
function plugin_manageentity_showJobVeryShort($ID) {
141
        // Prints a job in short form
142
        // Should be called in a <table>-segment
143
        // Print links or not in case of user view
144
145
        global $CFG_GLPI, $LANG;
146
147
        // Make new job object and fill it from database, if success, print it
148
        $job = new Job;
149
        $viewusers=haveRight("user","r");
150
        if ($job->getfromDBwithData($ID,0))
151
        {
152 0495c36a Eric Seigne
          //print_r($job);
153 b67d8923 Eric Seigne
                $bgcolor=$CFG_GLPI["priority_".$job->fields["priority"]];
154
                
155
                echo "<tr class='tab_bg_2'>";
156
                echo "<td align='center' bgcolor='$bgcolor' >ID: ".$job->fields["ID"]."</td>";
157
                
158 0495c36a Eric Seigne
                echo "<td ><a href=\"".$CFG_GLPI["root_doc"]."/front/tracking.form.php?ID=".$job->fields["ID"]."\">".$job->fields["date"] . ": " . $job->fields["name"]."</a> <br /> Durée: " . getRealtime($job->fields["realtime"]) . "</td>";
159 b67d8923 Eric Seigne
                
160
                echo "<td align='center'>";
161
                if ($job->fields['assign']){
162
                        if ($viewusers){
163
                                        $userdata=getUserName($job->fields['assign'],2);
164
                
165
                                        $comments_display="";
166
                                        $comments_display="<a href='".$userdata["link"]."'>";
167
                                        $comments_display.="<img alt='' src='".$CFG_GLPI["root_doc"]."/pics/aide.png' onmouseout=\"cleanhide('comments_trackassign".$ID."')\" onmouseover=\"cleandisplay('comments_trackassign".$ID."')\">";
168
                                        $comments_display.="</a>";
169
                                        $comments_display.="<span class='over_link' id='comments_trackassign".$ID."'>".$userdata["comments"]."</span>";
170
                
171
                                        echo "<strong>".$userdata['name']."&nbsp;".$comments_display."</strong>";
172
                        } else {
173
                                echo "<strong>".$job->getAssignName()."</strong>";
174
                        }
175
                }else echo $LANG["mailing"][105];
176
177
                echo "</td>";
178
                echo "<td align='center'>".getStatusName($job->fields["status"])."</td>";
179
                
180
                echo "<td ><strong>".resume_text($job->fields["contents"],$CFG_GLPI["cut"]);
181
                echo "</strong>";
182
                echo "</td>";
183
        
184
                // Finish Line
185
                echo "</tr>";
186
        }
187
        else
188
        {
189
                echo "<tr class='tab_bg_2'><td colspan='6' ><i>".$LANG["joblist"][16]."</i></td></tr>";
190
        }
191
}
192
193
function plugin_manageentity_showtickets($instID) {
194
195
        global $DB,$CFG_GLPI, $LANG,$LANGMANAGEENTITY;
196
197
        if (!haveRight("show_all_ticket","1")&&!haveRight("show_assign_ticket","1")) return false;
198
199
        //ryxeo show all tickets
200 0495c36a Eric Seigne
        $query = "SELECT ID,realtime FROM glpi_tracking WHERE glpi_tracking.FK_entities=".$instID." ORDER BY date DESC";
201
        //print $query;
202
        $title=$LANG["central"][9];
203 b67d8923 Eric Seigne
204
        $result = $DB->query($query);
205
        $i = 0;
206
        $number = $DB->numrows($result);
207
208
        if ($number > 0) {
209 0495c36a Eric Seigne
                echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>\n";
210 7ae025a9 Eric Seigne
//https://secure.ryxeo.com/glpi/plugins/anet_epacks/front/plugin_anet_epacks.view_recap_mensuel_rvd.php?year=2011&month=10
211
                echo "<tr><th colspan='6'>".$LANGMANAGEENTITY["manageentity"][5]." -- <a href=\"../../front/helpdesk.php\">[ouvrir un nouveau ticket]</a> -- <a href=\"../anet_epacks/front/plugin_anet_epacks.view_recap_interventions.php\">[synthèse et calcul de temps passé]</a> </th></tr>\n";
212 0495c36a Eric Seigne
                echo "<tr><th></th>\n";
213
                echo "<th>".$LANG["common"][57]."</th>\n";
214
                echo "<th width='75px'>".$LANG["job"][5]."</th>\n";
215
                echo "<th>".$LANG["joblist"][0]."</th>\n";
216
                echo "<th colspan='2'>".$LANG["joblist"][6]."</th></tr>\n";
217 b67d8923 Eric Seigne
                while ($i < $number) {
218
                        $ID = $DB->result($result, $i, "ID");
219
                        plugin_manageentity_showJobVeryShort($ID);
220
                        $i++;
221
                }
222 0495c36a Eric Seigne
                echo "</table></div>\n";
223 b67d8923 Eric Seigne
        }
224
        else
225
        {
226 0495c36a Eric Seigne
                echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>\n";
227
                echo "<tr><th>".$LANGMANAGEENTITY["manageentity"][5]." -- <a href=\"../../front/helpdesk.php\">[ouvrir un nouveau ticket]</a></th></tr>\n";
228
                echo "</table></div>\n";
229 b67d8923 Eric Seigne
        }
230 0495c36a Eric Seigne
231 b67d8923 Eric Seigne
}
232
233
function plugin_manageentity_showdocuments($instID) {
234
        GLOBAL $DB,$CFG_GLPI, $LANG, $LANGMANAGEENTITY;
235
236
        $query = "SELECT glpi_docs.*, glpi_plugin_manageentity_documents.ID as ID_us FROM glpi_plugin_manageentity_documents, glpi_docs WHERE glpi_plugin_manageentity_documents.FK_documents=glpi_docs.ID AND glpi_plugin_manageentity_documents.FK_entity = '$instID' ORDER BY glpi_docs.name";
237
        $result = $DB->query($query);
238
        $number = $DB->numrows($result);
239
        $i = 0;
240
        if($number !="0"){
241
                echo "<form method='post' action=\"./index.php\">";
242
                echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>";
243
                echo "<tr><th colspan='6'>".$LANGMANAGEENTITY["manageentity"][6]."</th></tr>";
244
                echo "<tr><th>".$LANG["common"][16]."</th>";
245
                echo "<th width='100px'>".$LANG["document"][2]."</th>";
246
                echo "<th>".$LANG["document"][33]."</th>";
247
                echo "<th>".$LANG["document"][3]."</th>";
248
                echo "<th>".$LANG["document"][4]."</th>";
249
                if(plugin_manageentity_HaveRight("manageentity","w"))
250
                        echo "<th>&nbsp;</th>";
251
                echo "</tr>";
252
253
                while ($data=$DB->fetch_array($result)){
254
                        
255
                        echo "<tr class='tab_bg_1".($data["deleted"]=='1'?"_2":"")."'>";
256
                        echo "<td align='left'><a href='".$CFG_GLPI["root_doc"]."/front/document.form.php?ID=".$data["ID"]."'><b>".$data["name"];
257
                        if ($CFG_GLPI["view_ID"]) echo " (".$data["ID"].")";
258
                        echo "</b></a></td>";
259
260
                        echo "<td align='center' width='100px'>".getDocumentLink($data["filename"])."</td>";
261
262
                        echo "<td align='center'>";
263
                        if (!empty($data["link"]))
264
                                echo "<a target=_blank href='".$data["link"]."'>".$data["link"]."</a>";
265
                        else echo "&nbsp;";
266
                        echo "</td>";
267
                        echo "<td align='center'>".getDropdownName("glpi_dropdown_rubdocs",$data["rubrique"])."</td>";
268
                        echo "<td align='center'>".$data["mime"]."</td>";
269
                        if(plugin_manageentity_HaveRight("manageentity","w"))
270
                                echo "<td align='center' class='tab_bg_2'><a href='".$_SERVER["PHP_SELF"]."?deletedocuments=deletedocuments&amp;ID=".$data["ID_us"]."'><b>".$LANG["buttons"][6]."</b></a></td>";
271
                        echo "</tr>";
272
273
                }
274
                if(plugin_manageentity_HaveRight("manageentity","w")){
275
                        echo "<tr class='tab_bg_1'><td colspan='5' align='center'>";
276
                        echo "<input type='hidden' name='conID' value='$instID'>";
277
                        dropdownDocument("entID",$instID);
278
                        echo "</td><td align='center'><input type='submit' name='adddocuments' value=\"".$LANG["buttons"][8]."\" class='submit'></td>";
279
                        echo "</tr>";
280
                }
281
282
                echo "</table></div></form>";
283
        }
284
        else{
285
286
                echo "<form method='post' action=\"./index.php\">";
287
                echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>";
288
                echo "<tr><th colspan='5'>".$LANGMANAGEENTITY["manageentity"][6]."</th></tr>";
289
                echo "<tr><th>".$LANG["common"][16]."</th>";
290
                echo "<th width='100px'>".$LANG["document"][2]."</th>";
291
                echo "<th>".$LANG["document"][33]."</th>";
292
                echo "<th>".$LANG["document"][3]."</th>";
293
                echo "<th>".$LANG["document"][4]."</th>";
294
                echo "</tr>";
295
                if(plugin_manageentity_HaveRight("manageentity","w")){
296
                        echo "<tr class='tab_bg_1'><td colspan='4' align='center'>";
297
                        echo "<input type='hidden' name='conID' value='$instID'>";
298
                        dropdownDocument("entID",$instID);
299
                        echo "</td><td align='center'><input type='submit' name='adddocuments' value=\"".$LANG["buttons"][8]."\" class='submit'></td>";
300
301
                        echo "</tr>";
302
303
                }
304
                echo "</table></div></form>";
305
        }
306
307
}
308
309
function plugin_manageentity_showcontacts($instID) {
310
        global $DB,$CFG_GLPI, $LANG,$LANGMANAGEENTITY;
311
312
313
        $query = "SELECT glpi_contacts.*, glpi_plugin_manageentity_contacts.ID as ID_ent FROM glpi_plugin_manageentity_contacts, glpi_contacts WHERE glpi_plugin_manageentity_contacts.FK_contacts=glpi_contacts.ID AND glpi_plugin_manageentity_contacts.FK_entity = '$instID' order by glpi_contacts.name";
314
315
        $result = $DB->query($query);
316
        $number = $DB->numrows($result);
317
        $i = 0;
318
        if ($number){
319
        echo "<form method='post' action=\"./index.php\">";
320
        echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>";
321
        echo "<tr><th colspan='8'>".$LANGMANAGEENTITY["manageentity"][7]."</th></tr>";
322
        echo "<tr><th>".$LANG["common"][16]."</th><th>".$LANG["help"][35]."</th>";
323
        echo "<th>".$LANG["help"][35]." 2</th><th>".$LANG["common"][42]."</th><th>".$LANG["financial"][30]."</th>";
324
        echo "<th>".$LANG["setup"][14]."</th><th>".$LANG["common"][17]."</th>";
325
        echo "<th>&nbsp;</th></tr>";
326
327
        
328
                while ($data=$DB->fetch_array($result)) {
329
                        $ID=$data["ID_ent"];
330
                        echo "<tr class='tab_bg_1'>";
331
                        echo "<td align='left'><a href='".$CFG_GLPI["root_doc"]."/front/contact.form.php?ID=".$data["ID"]."'>".$data["name"]." ".$data["firstname"]."</a></td>";
332
                        echo "<td align='center'  width='100'>".$data["phone"]."</td>";
333
                        echo "<td align='center'  width='100'>".$data["phone2"]."</td>";
334
                        echo "<td align='center'  width='100'>".$data["mobile"]."</td>";
335
                        echo "<td align='center'  width='100'>".$data["fax"]."</td>";
336
                        echo "<td align='center'><a href='mailto:".$data["email"]."'>".$DB->result($result, $i, "glpi_contacts.email")."</a></td>";
337
                        echo "<td align='center'>".getDropdownName("glpi_dropdown_contact_type",$data["type"])."</td>";
338
                        echo "<td align='center' class='tab_bg_2'>";
339
                        if(plugin_manageentity_HaveRight("manageentity","w"))
340
                                echo "<a href='".$_SERVER['PHP_SELF']."?deletecontacts=deletecontacts&amp;ID=$ID&amp;eID=$instID'><strong>".$LANG["buttons"][6]."</strong></a>";
341
                        else echo "&nbsp;";
342
                        echo "</td></tr>";
343
                        $i++;
344
                }
345
                if(plugin_manageentity_HaveRight("manageentity","w")){
346
                        echo "<tr class='tab_bg_1'><td colspan='7' align='center'>";
347
                        echo "<input type='hidden' name='eID' value='$instID'>";
348
                        dropdown("glpi_contacts","cID");
349
                        echo "</td><td align='center'><input type='submit' name='addcontacts' value=\"".$LANG["buttons"][8]."\" class='submit'></td>";
350
                        echo "</tr>";
351
                }
352
        echo "</table></div></form>";
353
        }
354
        else{
355
        
356
                if(plugin_manageentity_HaveRight("manageentity","w")){
357
                        echo "<form method='post' action=\"./index.php\">";
358
                        echo "<br><table class='tab_cadre' align='center' width='95%'>";
359
        
360
                        echo "<tr class='tab_bg_1'><th colspan='2'>".$LANGMANAGEENTITY["manageentity"][7]."</tr><tr><td class='tab_bg_2' align='center'>";
361
                        echo "<input type='hidden' name='eID' value='$instID'>";
362
                        dropdown("glpi_contacts","cID");
363
                        echo "</td><td align='center' class='tab_bg_2'>";
364
                        echo "<input type='submit' name='addcontacts' value=\"".$LANG["buttons"][8]."\" class='submit'>";
365
                        echo "</td></tr>";
366
        
367
                        echo "</table></form>";
368
                }
369
        }
370
}
371
372
373
//ryxeo ... add show inventory
374
375
function plugin_manageentity_showinventory($instID) {
376
377
        global $DB,$CFG_GLPI, $LANG,$LANGMANAGEENTITY;
378
379
        if (!haveRight("computer","r")) return false;
380
381
        $query = "SELECT ID FROM glpi_computers WHERE glpi_computers.FK_entities=".$instID." ORDER BY name";
382
383
        $title=$LANG["central"][9];
384
385
        $result = $DB->query($query);
386
        $i = 0;
387
        $number = $DB->numrows($result);
388
389
        if ($number > 0) {
390
                echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>";
391
392
                echo "<tr>";
393
                echo "<th colspan='5'>".$LANGMANAGEENTITY["manageentity"][12]."</th>";
394
                echo "</tr>";
395
                echo "<tr>";
396
                echo "<th>".$LANG["common"][16]."</th>";
397
                echo "<th width='75px'>".$LANG["common"][17]."</th>";
398
                echo "<th>".$LANG["common"][5]."</th>";
399
                echo "<th>".$LANG["common"][22]."</th>";
400
                echo "<th>".$LANG["common"][19]."</th>";
401
                echo "</tr>";
402
                while ($i < $number) {
403
                        $ID = $DB->result($result, $i, "ID");
404
                        plugin_manageentity_showInventoryVeryShort($ID);
405
                        $i++;
406
                }
407
                echo "</table></div>";
408
        }
409
        else
410
        {
411
                echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>";
412
                echo "<tr><th>".$LANGMANAGEENTITY["manageentity"][5]." -- <a href=\"../../front/helpdesk.php\">[ouvrir un nouveau ticket]</a></th></tr>";
413
                echo "</table></div>";
414
        }
415
        echo "<br />";
416
}
417
418
419
function plugin_manageentity_showInventoryVeryShort($ID) {
420
        // Prints an inventory in short form
421
        // Should be called in a <table>-segment
422
        // Print links or not in case of user view
423
424
        global $CFG_GLPI, $LANG;
425
426
        // Make new job object and fill it from database, if success, print it
427
        $computer = new Computer;
428
429
        if ($computer->getfromDB($ID))
430
        {
431
                echo "<tr class='tab_bg_2'>";
432
                echo "<td ><a href=\"".$CFG_GLPI["root_doc"]."/front/computer.form.php?ID=".$computer->fields["ID"]."\">".$computer->fields["name"]."</a></td>";
433
                //                echo "<td>" . $computer->fields["model"] . "</td>";
434
                //                echo "<td>" . $computer->fields["type"] . "</td>";
435
                echo "<td>" . $computer->fields[""] . "</td>";
436
                echo "<td>" . $computer->fields[""] . "</td>";
437
                echo "<td>" . $computer->fields[""] . "</td>";
438
439
                //                echo "<td><pre>";
440
                //                print_r($computer);
441
                //                echo "</pre></td>";
442
                echo "<td>".$computer->fields["serial"]."</td>";
443
                // Finish Line
444
                echo "</tr>";
445
        }
446
        else
447
        {
448
                echo "<tr class='tab_bg_2'><td colspan='6' ><i>".$LANG["joblist"][16]."</i></td></tr>";
449
        }
450
}
451
452
//ryxeo
453
function plugin_manageentity_showanetepack($instID) {
454
455
        global $DB,$CFG_GLPI, $LANG,$LANGMANAGEENTITY;
456
457
        if (!haveRight("computer","r")) return false;
458
459 92ce0ffe Eric Seigne
        $query = "SELECT code,activation_date,FK_contract as contract,g.name as installateur FROM glpi_plugin_anet_epacks
460 b67d8923 Eric Seigne
LEFT JOIN glpi_entities AS g ON FK_activation=g.ID
461
WHERE FK_enduser=".$instID;
462
        //        print $query;
463
        $title=$LANG["central"][9];
464
465
        $result = $DB->query($query);
466
        $i = 0;
467
        $number = $DB->numrows($result);
468
469
        if ($number > 0) {
470 d9c543bd Eric Seigne
          echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>";
471
          echo "<tr>";
472 92ce0ffe Eric Seigne
          echo "<th colspan='4'>Epack et Installation</th>";
473 d9c543bd Eric Seigne
          echo "</tr>";
474
          while($i < $number) {
475
            echo "<tr class='tab_bg_2'>";
476 92ce0ffe Eric Seigne
            echo "<td width=\"20%\">".$DB->result($result, $i, "code")."</td>";
477
            echo "<td width=\"20%\">Date d'activation: ".$DB->result($result, $i, "activation_date")."</td>";
478
            echo "<td width=\"20%\">Installateur: ".$DB->result($result, $i, "installateur")."</td>";
479
            if($DB->result($result, $i, "contract") < 0)
480
              echo "<td width=\"20%\"><a href=\"".$CFG_GLPI["root_doc"]."/plugins/anet_epacks/front/plugin_anet_epacks.out_of_maintenance.php?status=renewmaintenance&code=" . $DB->result($result, $i, "code") . "\" target=\"_blank\">[remarquer sous maintenance]</a> </td>";
481
            if($DB->result($result, $i, "contract") >= 0)
482
              echo "<td width=\"20%\"><a href=\"".$CFG_GLPI["root_doc"]."/plugins/anet_epacks/front/plugin_anet_epacks.out_of_maintenance.php?status=outofmaintenance&code=" . $DB->result($result, $i, "code") . "\" target=\"_blank\">[marquer hors maintenance]</a> </td>";
483 d9c543bd Eric Seigne
            echo "</tr>";
484
            $i++;
485
          }
486
          echo "</table></div>";
487 b67d8923 Eric Seigne
        }
488
        echo "<br />";
489
}
490
491 57ea0d38 Eric Seigne
//ryxeo
492
function plugin_manageentity_showanetnextupgrade($instID) {
493
494
        global $DB,$CFG_GLPI, $LANG,$LANGMANAGEENTITY;
495
496
        if (!haveRight("computer","r")) return false;
497
498
        $query = "SELECT upgradecmd FROM glpi_plugin_anet_epacks_upgrade as u
499
LEFT JOIN glpi_plugin_anet_epacks AS g ON g.FK_serveur=u.FK_serveur
500
WHERE FK_enduser=".$instID;
501
        //print $query;
502
        $title=$LANG["central"][9];
503
504
        $result = $DB->query($query);
505
        $number = $DB->numrows($result);
506
        $upgradecmd = $DB->result($result, 0, "upgradecmd");
507
508
        $query = "SELECT FK_serveur as srvID FROM glpi_plugin_anet_epacks WHERE FK_enduser=".$instID;
509
        //        print $query;
510
        $result = $DB->query($query);
511
        $srvID = $DB->result($result, 0, "srvID");
512
513
        echo "<form method='post' action=\"./index.php\">";
514
        echo "<input type='hidden' name='srvID' value='$srvID'>";
515
        echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>";
516
        echo "<tr>";
517
        echo "<th colspan='4'>Commande à lancer lors de la prochaine mise à jour de ce serveur </th>";
518
        echo "</tr>";
519
        
520
        echo "<tr class='tab_bg_2'>";
521
        echo "<td width=\"100%\"><u>Note:</u> Cette commande doit-être gpg signée par une clé GPG acceptée par ce serveur !<br /><textarea name=\"upgradecmd\" cols=\"100\" rows=\"10\">".$upgradecmd."</textarea></td>";
522
        echo "</tr>";
523
        echo "<tr class='tab_bg_2'>";
524
        echo "<td width=\"100%\"><input type=\"submit\" name=\"anetinsertnextupgrade\" value=\"Enregistrer\" class=\"submit\"></td>";
525
        echo "</tr>";
526
        
527
        echo "</table></div>";
528
        echo"</form>";
529
        echo "<br />";
530
}
531
532 b67d8923 Eric Seigne
533
/**/
534
?>
Redmine Appliance - Powered by TurnKey Linux