/
class.demandeListe.php
174 lines (147 loc) · 5.67 KB
/
class.demandeListe.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
error_reporting(E_ALL);
/**
* demandesEnLigne - class.demandeListe.php
*
* @author Jean-Francois Levesque, <jf.levesque@step.polymtl.ca>
*/
if (0 > version_compare(PHP_VERSION, '5')) {
die('This file was generated for PHP 5');
}
require_once('class.log.php');
require_once('class.database.php');
require_once('class.demande.php');
require_once('class.liste.php');
require_once('class.config.php');
/**
* Short description of class vehicule
*
* @access public
* @author Jean-Francois Levesque, <jf.levesque@step.polymtl.ca>
*/
class demandeListe extends liste
{
// --- ATTRIBUTES ---
private $objDatabase = null;
private $objLog = null;
// --- OPERATIONS ---
public function __construct()
{
parent::__construct();
$this->objDatabase = database::instance();
$this->objLog = log::instance();
}
public function rechercheParAnnee($annee = config::CurrentYear,
$texte = '',
$limiteDebut = '0',
$limiteNb = '20',
$ordrePar = 'id',
$ordreSens = 'asc')
{
return $this->recherche($texte, $limiteDebut, $limiteNb, $ordrePar, $ordreSens, " AND (annee = '$annee') ");
}
public function rechercheParStatus($status = '0',
$texte = '',
$limiteDebut = '0',
$limiteNb = '20',
$ordrePar = 'id',
$ordreSens = 'asc')
{
return $this->recherche($texte, $limiteDebut, $limiteNb, $ordrePar, $ordreSens, " AND (status = '$status') ");
}
public function rechercheParAnneeEtStatus($annee = config::CurrentYear,
$status = '0',
$texte = '',
$limiteDebut = '0',
$limiteNb = '20',
$ordrePar = 'id',
$ordreSens = 'asc')
{
return $this->recherche($texte, $limiteDebut, $limiteNb, $ordrePar, $ordreSens, " AND (status = '$status') AND (annee = '$annee') ");
}
public function rechercheParEmail($email = '%',
$texte = '',
$limiteDebut = '0',
$limiteNb = '20',
$ordrePar = 'id',
$ordreSens = 'asc')
{
return $this->recherche($texte, $limiteDebut, $limiteNb, $ordrePar, $ordreSens, " AND (email LIKE '%$email%') ");
}
public function recherche($texte = '',
$limiteDebut = '0',
$limiteNb = '20',
$ordrePar = 'matricule',
$ordreSens = 'asc',
$whereParticulier = '')
{
$requeteWhere = " (matricule LIKE '$texte' OR "
."payment LIKE '$texte' OR "
."licenseNumber LIKE '$texte' OR "
."licenseClass LIKE '$texte') ";
$this->liste = array();
$resultat = $this->objDatabase->requete("SELECT matricule from st_demande WHERE $requeteWhere $whereParticulier ORDER BY $ordrePar $ordreSens LIMIT $limiteDebut,$limiteNb");
if (mysql_num_rows($resultat) < 1 )
{
return false;
}
else
{
$this->objLog->ajoutLog(LOG_NIVEAU_INFO,LOG_MODULE_DEMANDELISTE, null, "Recherche : '$texte' : ".mysql_num_rows($resultat).' resultats');
}
while ($ligne = mysql_fetch_array($resultat))
{
$demandeTemp = new demande();
$demandeTemp->ouvrir($ligne['matricule']);
array_push($this->liste, $demandeTemp);
}
$this->reset();
return true;
}
public function getNbParStatus($status = '0', $annee = config::CurrentYear)
{
$resultat = $this->objDatabase->requete("SELECT count(id) as nb from st_demande WHERE status = '$status' AND annee = '$annee'");
if ($ligne = mysql_fetch_array($resultat))
{
return $ligne['nb'];
}
return -1;
}
public function getNb($annee = config::CurrentYear)
{
$resultat = $this->objDatabase->requete("SELECT count(id) as nb from st_demande WHERE annee = '$annee'");
if ($ligne = mysql_fetch_array($resultat))
{
return $ligne['nb'];
}
return -1;
}
public function getNbCovoiturage($annee = config::CurrentYear)
{
$resultat = $this->objDatabase->requete("SELECT count(id) as nb from st_demande WHERE covoiturage = 1 AND annee = '$annee'");
if ($ligne = mysql_fetch_array($resultat))
{
return $ligne['nb'];
}
return -1;
}
public function getNbBanqueCovoiturage($annee = config::CurrentYear)
{
$resultat = $this->objDatabase->requete("SELECT count(id) as nb from st_demande WHERE banqueCovoiturage = 1 AND annee = '$annee'");
if ($ligne = mysql_fetch_array($resultat))
{
return $ligne['nb'];
}
return -1;
}
public function getNbVehiculeBranchable($annee = config::CurrentYear)
{
$resultat = $this->objDatabase->requete("SELECT count(id) as nb from st_demande WHERE vehiculeBranchable = 1 AND annee = '$annee'");
if ($ligne = mysql_fetch_array($resultat))
{
return $ligne['nb'];
}
return -1;
}
} /* end of class vehicule */
?>