Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / plugins / anet_epacks / front / plugin_anet_epacks.view.php @ 8c2a3d1e

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

1 b67d8923 Eric Seigne
<?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 8c2a3d1e Eric Seigne
    print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - ";
24
    for($i=2008; $i <= date("Y"); $i++) {
25
        print "<a href=\"" . $PHP_SELF . "?year=$i\">$i</a> - ";
26
      }
27
    print "</p>";
28 b67d8923 Eric Seigne
29
//Les packs attribués
30
//Permet de limiter un peu l'affichage, il faudra faire un système de recherche ou pagination à terme
31
if($_GET['year'])
32
  $condition = "AND YEAR(creation_date)='" . $_GET['year'] . "'";
33
$query="SELECT e.*,g2.name as activation ,g3.name as client, g4.name as serveur FROM glpi_plugin_anet_epacks AS e
34
LEFT JOIN glpi_entities AS g2 ON FK_activation=g2.ID
35
LEFT JOIN glpi_entities AS g3 ON FK_client=g3.ID
36
LEFT JOIN glpi_computers AS g4 ON FK_serveur=g4.ID
37
WHERE creation_date>'0000-00-00'
38
AND e.FK_clientderyxeo='" . $entityid . "'
39
$condition
40
ORDER BY activation,creation_date
41
LIMIT 500;";
42
//print $query;
43
$result = $DB->query($query) or die($DB->error());
44
45
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n";
46
  print "<tr class='tab_bg_3'>
47
  <td>#</td>
48
  <td>Création</td>
49
  <td>Activation</td>
50
  <td>Activé par</td>
51
  <td>Expiration</td>
52
  <td>Client final</td>
53
  <td>Code</td>
54
  <td>Documents</td>
55
</tr>\n";
56
for($i = 0; $i < $DB->numrows($result); $i++) {
57
  $data=$DB->fetch_array($result);
58
  print "<tr class='tab_bg_3'>\n";
59
  print "  <td>". $i . "</td>
60
  <td>" . $data['creation_date'] . "</td>
61
  <td>" . $data['activation_date'] . "</td>
62
  <td>" . $data['activation'] . "</td>
63
  <td>" . $data['expiration_date'] . "</td>
64 61a52590 Eric Seigne
  <td>" . $data['client'] . "<br />Serveur <a href=\"../../manageentity/index.php?active_entity=" . $data['FK_enduser'] . "\">" . $data['serveur'] . "</a></td>
65 b67d8923 Eric Seigne
  <td>" . $data['code'] . "</td>
66
  <td>&nbsp;</td>
67
</tr>\n";
68
 }
69
70
print "</table>";
71
72
73
    commonFooter();
74
    exit;
75
  }
76
 }
77
78
checkRight("config","w");
79
//checkSeveralRightsOr(array("config" => "w", "profile" => "w"));
80
81 8c2a3d1e Eric Seigne
//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>";
82
83
 print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - ";
84
 for($i=2008; $i <= date("Y"); $i++) {
85
     print "<a href=\"" . $PHP_SELF . "?year=$i\">$i</a> - ";
86
   }
87
 print "</p>";
88
89 b67d8923 Eric Seigne
90
global $DB;
91
92
//Les packs attribués
93
//Permet de limiter un peu l'affichage, il faudra faire un système de recherche ou pagination à terme
94
if($_GET['year'])
95
  $condition = "AND YEAR(creation_date)='" . $_GET['year'] . "'";
96
$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
97
LEFT JOIN glpi_entities AS g2 ON FK_activation=g2.ID
98
LEFT JOIN glpi_entities AS g3 ON FK_client=g3.ID
99
LEFT JOIN glpi_computers AS g4 ON FK_serveur=g4.ID
100
WHERE creation_date>'0000-00-00'
101
$condition
102
ORDER BY clientderyxeo,activation,creation_date
103
LIMIT 500;";
104
//print $query;
105
$result = $DB->query($query) or die($DB->error());
106
107
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n";
108
  print "<tr class='tab_bg_3'>
109 8c2a3d1e Eric Seigne
  <td>N°</td>
110 b67d8923 Eric Seigne
  <td>Nom</td>
111
  <td>Création</td>
112
  <td>Activation</td>
113
  <td>Activé par</td>
114
  <td>Expiration</td>
115
  <td>Client final</td>
116
  <td>Code</td>
117
  <td>Documents</td>
118
</tr>\n";
119
for($i = 0; $i < $DB->numrows($result); $i++) {
120
  $data=$DB->fetch_array($result);
121
  print "<tr class='tab_bg_3'>\n";
122 8c2a3d1e Eric Seigne
  print "  <td>" . ($i+1) . "</td>";
123 b67d8923 Eric Seigne
  print "  <td>" . $data['clientderyxeo'] . "</td>
124
  <td>" . $data['creation_date'] . "</td>
125
  <td>" . $data['activation_date'] . "</td>
126
  <td>" . $data['activation'] . "</td>
127
  <td>" . $data['expiration_date'] . "</td>
128 61a52590 Eric Seigne
  <td>" . $data['client'] . "<br />Serveur <a href=\"../../manageentity/index.php?active_entity=" . $data['FK_enduser'] . "\">" . $data['serveur'] . "</a></td>
129 b67d8923 Eric Seigne
  <td>" . $data['code'] . "</td>
130 ce399d47 Eric Seigne
  <td>\n";
131
132
  $ficepack="archives/" . $data['creation_date'] . "-" . $data['code'] . ".odt";
133
  if(!file_exists($ficepack))
134
    $ficepack="archives/" . str_replace("-","",$data['creation_date']) . "-" . $data['code'] . ".odt";
135
136
print "
137
    <a href=\"" . $ficepack . "\">ePack</a> (fichier initial) - <a href=\"plugin_anet_epacks.generate_odt_client2.form.php?code=" . $data['code'] . "\">Actualiser</a><br />
138 b67d8923 Eric Seigne
    <a href=\"plugin_anet_epacks.generate_odt_activated.form.php?date=" . $data['activation_date'] . "&code=" . $data['code'] . "\">ePack activé</a> (après activation) <br />
139
    <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>
140
  </td>
141
</tr>\n";
142
 }
143
144
print "</table>";
145
146
print "<p>Liste des packs anonymes ...</p>\n";
147
148
//Les packs anonymes
149
$query="SELECT e.* FROM glpi_plugin_anet_epacks AS e 
150
WHERE creation_date>'0000-00-00'
151
AND FK_clientderyxeo='0'
152
$condition
153
LIMIT 500;";
154
//print $query;
155
$result = $DB->query($query) or die($DB->error());
156
157
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n";
158
  print "<tr class='tab_bg_3'>
159 8c2a3d1e Eric Seigne
  <td>N°</td>
160 b67d8923 Eric Seigne
  <td>Nom</td>
161
  <td>Date de création du pack</td>
162
  <td>Date d'activation du pack</td>
163
  <td>Activé par</td>
164
  <td>Date d'expiration du pack</td>
165
  <td>Client final</td>
166
  <td>Code</td>
167
  <td>Documents</td>
168
</tr>\n";
169
for($i = 0; $i < $DB->numrows($result); $i++) {
170
  $data=$DB->fetch_array($result);
171
  print "<tr class='tab_bg_3'>\n";
172 8c2a3d1e Eric Seigne
  print "  <td>" . ($i+1) . "</td>";
173 b67d8923 Eric Seigne
  print "  <td>" . $data['clientderyxeo'] . "</td>
174
  <td>" . $data['creation_date'] . "</td>
175
  <td>" . $data['activation_date'] . "</td>
176
  <td>" . $data['activation'] . "</td>
177
  <td>" . $data['expiration_date'] . "</td>
178
  <td>" . $data['client'] . "</td>
179
  <td>" . $data['code'] . "</td>
180
  <td>
181
    <a href=\"archives/" . $data['creation_date'] . "-" . $data['code'] . ".odt\">ePack</a> (fichier initial)<br />
182
    <a href=\"plugin_anet_epacks.generate_odt_activated.form.php?date=" . $data['activation_date'] . "&code=" . $data['code'] . "\">ePack activé</a> (après activation)
183
  </td>
184
</tr>\n";
185
 }
186
187
print "</table>";
188
189
190
commonFooter();
191
?>
Redmine Appliance - Powered by TurnKey Linux