Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / plugins / anet_epacks / front / plugin_anet_epacks.view.php @ 97e94661

Historique | Voir | Annoter | Télécharger (6,62 ko)

1
<?php
2

    
3
// Génère le fichier ODT/PDF pour le revendeur avec son numéro de pack à utiliser. Ce fichier doit contenir un certain nombre d'informations (url pour enregistrer son pack etc.)
4

    
5
if(!defined('GLPI_ROOT')){
6
  define('GLPI_ROOT', '../../..');
7
}
8
include_once (GLPI_ROOT . "/inc/includes.php");
9

    
10
commonHeader("anet_epacks",$_SERVER['PHP_SELF'],"config","plugins");
11

    
12
$glpiid = $_SESSION['glpiID'];
13

    
14
global $DB;
15
$query = "SELECT name,FK_entities FROM glpi_profiles,glpi_users_profiles WHERE glpi_users_profiles.FK_users='" . $glpiid . "'
16
       AND glpi_users_profiles.FK_profiles=glpi_profiles.ID";
17
$result = $DB->query($query);
18
if($result) {
19
  $data=$DB->fetch_array($result);
20
  if($data['name'] == "revendeur") {
21
    print "<h1>Liste synthétique de vos epacks</h1>";
22
    $entityid = $data['FK_entities'];
23
print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - <a href=\"" . $PHP_SELF . "?year=2008\">2008</a> - <a href=\"" . $PHP_SELF . "?year=2009\">2009</a> - <a href=\"" . $PHP_SELF . "?year=2010\">2010</a> - <a href=\"" . $PHP_SELF . "?year=2011\">2011</a>.</p>";
24

    
25
//Les packs attribués
26
//Permet de limiter un peu l'affichage, il faudra faire un système de recherche ou pagination à terme
27
if($_GET['year'])
28
  $condition = "AND YEAR(creation_date)='" . $_GET['year'] . "'";
29
$query="SELECT e.*,g2.name as activation ,g3.name as client, g4.name as serveur FROM glpi_plugin_anet_epacks AS e
30
LEFT JOIN glpi_entities AS g2 ON FK_activation=g2.ID
31
LEFT JOIN glpi_entities AS g3 ON FK_client=g3.ID
32
LEFT JOIN glpi_computers AS g4 ON FK_serveur=g4.ID
33
WHERE creation_date>'0000-00-00'
34
AND e.FK_clientderyxeo='" . $entityid . "'
35
$condition
36
ORDER BY activation,creation_date
37
LIMIT 500;";
38
//print $query;
39
$result = $DB->query($query) or die($DB->error());
40

    
41
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n";
42
  print "<tr class='tab_bg_3'>
43
  <td>#</td>
44
  <td>Création</td>
45
  <td>Activation</td>
46
  <td>Activé par</td>
47
  <td>Expiration</td>
48
  <td>Client final</td>
49
  <td>Code</td>
50
  <td>Documents</td>
51
</tr>\n";
52
for($i = 0; $i < $DB->numrows($result); $i++) {
53
  $data=$DB->fetch_array($result);
54
  print "<tr class='tab_bg_3'>\n";
55
  print "  <td>". $i . "</td>
56
  <td>" . $data['creation_date'] . "</td>
57
  <td>" . $data['activation_date'] . "</td>
58
  <td>" . $data['activation'] . "</td>
59
  <td>" . $data['expiration_date'] . "</td>
60
  <td>" . $data['client'] . "<br />Serveur <a href=\"../../manageentity/index.php?active_entity=" . $data['FK_enduser'] . "\">" . $data['serveur'] . "</a></td>
61
  <td>" . $data['code'] . "</td>
62
  <td>&nbsp;</td>
63
</tr>\n";
64
 }
65

    
66
print "</table>";
67

    
68

    
69
    commonFooter();
70
    exit;
71
  }
72
 }
73

    
74
checkRight("config","w");
75
//checkSeveralRightsOr(array("config" => "w", "profile" => "w"));
76

    
77
print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - <a href=\"" . $PHP_SELF . "?year=2008\">2008</a> - <a href=\"" . $PHP_SELF . "?year=2009\">2009</a> - <a href=\"" . $PHP_SELF . "?year=2010\">2010</a> - <a href=\"" . $PHP_SELF . "?year=2011\">2011</a>.</p>";
78

    
79
global $DB;
80

    
81
//Les packs attribués
82
//Permet de limiter un peu l'affichage, il faudra faire un système de recherche ou pagination à terme
83
if($_GET['year'])
84
  $condition = "AND YEAR(creation_date)='" . $_GET['year'] . "'";
85
$query="SELECT e.*,g.name as clientderyxeo ,g2.name as activation ,g3.name as client, g4.name as serveur FROM glpi_plugin_anet_epacks AS e LEFT JOIN glpi_entities AS g ON FK_clientderyxeo=g.ID
86
LEFT JOIN glpi_entities AS g2 ON FK_activation=g2.ID
87
LEFT JOIN glpi_entities AS g3 ON FK_client=g3.ID
88
LEFT JOIN glpi_computers AS g4 ON FK_serveur=g4.ID
89
WHERE creation_date>'0000-00-00'
90
$condition
91
ORDER BY clientderyxeo,activation,creation_date
92
LIMIT 500;";
93
//print $query;
94
$result = $DB->query($query) or die($DB->error());
95

    
96
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n";
97
  print "<tr class='tab_bg_3'>
98
  <td>Nom</td>
99
  <td>Création</td>
100
  <td>Activation</td>
101
  <td>Activé par</td>
102
  <td>Expiration</td>
103
  <td>Client final</td>
104
  <td>Code</td>
105
  <td>Documents</td>
106
</tr>\n";
107
for($i = 0; $i < $DB->numrows($result); $i++) {
108
  $data=$DB->fetch_array($result);
109
  print "<tr class='tab_bg_3'>\n";
110
  print "  <td>" . $data['clientderyxeo'] . "</td>
111
  <td>" . $data['creation_date'] . "</td>
112
  <td>" . $data['activation_date'] . "</td>
113
  <td>" . $data['activation'] . "</td>
114
  <td>" . $data['expiration_date'] . "</td>
115
  <td>" . $data['client'] . "<br />Serveur <a href=\"../../manageentity/index.php?active_entity=" . $data['FK_enduser'] . "\">" . $data['serveur'] . "</a></td>
116
  <td>" . $data['code'] . "</td>
117
  <td>\n";
118

    
119
  $ficepack="archives/" . $data['creation_date'] . "-" . $data['code'] . ".odt";
120
  if(!file_exists($ficepack))
121
    $ficepack="archives/" . str_replace("-","",$data['creation_date']) . "-" . $data['code'] . ".odt";
122

    
123
print "
124
    <a href=\"" . $ficepack . "\">ePack</a> (fichier initial) - <a href=\"plugin_anet_epacks.generate_odt_client2.form.php?code=" . $data['code'] . "\">Actualiser</a><br />
125
    <a href=\"plugin_anet_epacks.generate_odt_activated.form.php?date=" . $data['activation_date'] . "&code=" . $data['code'] . "\">ePack activé</a> (après activation) <br />
126
    <a href=\"plugin_anet_epacks.generate_odt_activated.form.php?date=" . $data['activation_date'] . "&code=" . $data['code'] . "&mode=-avenant_contrat_partenaire_enr2009\">ePack activé pour un partenaire ENR2009</a>
127
  </td>
128
</tr>\n";
129
 }
130

    
131
print "</table>";
132

    
133
print "<p>Liste des packs anonymes ...</p>\n";
134

    
135
//Les packs anonymes
136
$query="SELECT e.* FROM glpi_plugin_anet_epacks AS e 
137
WHERE creation_date>'0000-00-00'
138
AND FK_clientderyxeo='0'
139
$condition
140
LIMIT 500;";
141
//print $query;
142
$result = $DB->query($query) or die($DB->error());
143

    
144
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n";
145
  print "<tr class='tab_bg_3'>
146
  <td>Nom</td>
147
  <td>Date de création du pack</td>
148
  <td>Date d'activation du pack</td>
149
  <td>Activé par</td>
150
  <td>Date d'expiration du pack</td>
151
  <td>Client final</td>
152
  <td>Code</td>
153
  <td>Documents</td>
154
</tr>\n";
155
for($i = 0; $i < $DB->numrows($result); $i++) {
156
  $data=$DB->fetch_array($result);
157
  print "<tr class='tab_bg_3'>\n";
158
  print "  <td>" . $data['clientderyxeo'] . "</td>
159
  <td>" . $data['creation_date'] . "</td>
160
  <td>" . $data['activation_date'] . "</td>
161
  <td>" . $data['activation'] . "</td>
162
  <td>" . $data['expiration_date'] . "</td>
163
  <td>" . $data['client'] . "</td>
164
  <td>" . $data['code'] . "</td>
165
  <td>
166
    <a href=\"archives/" . $data['creation_date'] . "-" . $data['code'] . ".odt\">ePack</a> (fichier initial)<br />
167
    <a href=\"plugin_anet_epacks.generate_odt_activated.form.php?date=" . $data['activation_date'] . "&code=" . $data['code'] . "\">ePack activé</a> (après activation)
168
  </td>
169
</tr>\n";
170
 }
171

    
172
print "</table>";
173

    
174

    
175
commonFooter();
176
?>
Redmine Appliance - Powered by TurnKey Linux