|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* oledrion |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright {@link http://xoops.org/ XOOPS Project} |
|
16
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
17
|
|
|
* @author Hervé Thouzard (http://www.herve-thouzard.com/) |
|
18
|
|
|
*/ |
|
19
|
|
|
/** |
|
20
|
|
|
* Classe interne dont le but est de passer des paramètres à la classe oeldrion_shelf |
|
21
|
|
|
*/ |
|
22
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
|
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Utilisé comme paramètre dans la façcade oledrion_shelf |
|
26
|
|
|
*/ |
|
27
|
|
|
class Oledrion_shelf_parameters |
|
|
|
|
|
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* Le conteneur de paramètres |
|
31
|
|
|
* |
|
32
|
|
|
* @var array |
|
33
|
|
|
*/ |
|
34
|
|
|
private $parameters = array(); |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Oledrion_shelf_parameters constructor. |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct() |
|
40
|
|
|
{ |
|
41
|
|
|
$this->resetDefaultValues(); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Réinitialisation des valeurs |
|
46
|
|
|
* |
|
47
|
|
|
* @return object |
|
48
|
|
|
*/ |
|
49
|
|
|
public function resetDefaultValues() |
|
50
|
|
|
{ |
|
51
|
|
|
$this->parameters['start'] = 0; |
|
52
|
|
|
$this->parameters['limit'] = 0; |
|
53
|
|
|
$this->parameters['category'] = 0; |
|
54
|
|
|
$this->parameters['sort'] = 'product_submitted DESC, product_title'; |
|
55
|
|
|
$this->parameters['order'] = 'ASC'; |
|
56
|
|
|
$this->parameters['excluded'] = 0; |
|
57
|
|
|
$this->parameters['withXoopsUser'] = false; |
|
58
|
|
|
$this->parameters['withRelatedProducts'] = false; |
|
59
|
|
|
$this->parameters['withQuantity'] = false; |
|
60
|
|
|
$this->parameters['thisMonthOnly'] = false; |
|
61
|
|
|
$this->parameters['productsType'] = ''; |
|
62
|
|
|
|
|
63
|
|
|
return $this; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Retourne le tableau des paramètres |
|
68
|
|
|
* |
|
69
|
|
|
* @return array |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getParameters() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->parameters; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Positione la valeur de début |
|
78
|
|
|
* |
|
79
|
|
|
* @param integer $value |
|
80
|
|
|
* @return object |
|
81
|
|
|
*/ |
|
82
|
|
|
public function setStart($value) |
|
83
|
|
|
{ |
|
84
|
|
|
$this->parameters['start'] = (int)$value; |
|
85
|
|
|
|
|
86
|
|
|
return $this; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Fixe le nombre maximum d'enregistrements à retourner |
|
91
|
|
|
* |
|
92
|
|
|
* @param integer $value |
|
93
|
|
|
* @return object |
|
94
|
|
|
*/ |
|
95
|
|
|
public function setLimit($value) |
|
96
|
|
|
{ |
|
97
|
|
|
$this->parameters['limit'] = (int)$value; |
|
98
|
|
|
|
|
99
|
|
|
return $this; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Fixe la catégorie à utiliser |
|
104
|
|
|
* |
|
105
|
|
|
* @param integer $value |
|
106
|
|
|
* @return object |
|
107
|
|
|
*/ |
|
108
|
|
|
public function setCategory($value) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->parameters['category'] = $value; |
|
111
|
|
|
|
|
112
|
|
|
return $this; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Fixe la zone qui sert de tri |
|
117
|
|
|
* |
|
118
|
|
|
* @param string $value |
|
119
|
|
|
* @return object |
|
120
|
|
|
*/ |
|
121
|
|
|
public function setSort($value) |
|
122
|
|
|
{ |
|
123
|
|
|
$this->parameters['sort'] = $value; |
|
124
|
|
|
|
|
125
|
|
|
return $this; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* Fixe l'ordre de tri |
|
130
|
|
|
* |
|
131
|
|
|
* @param string $value |
|
132
|
|
|
* @return array |
|
|
|
|
|
|
133
|
|
|
*/ |
|
134
|
|
|
public function setOrder($value) |
|
135
|
|
|
{ |
|
136
|
|
|
$this->parameters['order'] = $value; |
|
137
|
|
|
|
|
138
|
|
|
return $this; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* Fixe la liste des produits à exclure |
|
143
|
|
|
* |
|
144
|
|
|
* @param mixed $value |
|
145
|
|
|
* @return string |
|
|
|
|
|
|
146
|
|
|
*/ |
|
147
|
|
|
public function setExcluded($value) |
|
148
|
|
|
{ |
|
149
|
|
|
$this->parameters['excluded'] = $value; |
|
150
|
|
|
|
|
151
|
|
|
return $this; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Indique s'il faut retourner les utilisateurs Xoops |
|
156
|
|
|
* |
|
157
|
|
|
* @param boolean $value |
|
158
|
|
|
* @return object |
|
159
|
|
|
*/ |
|
160
|
|
|
public function setWithXoopsUser($value) |
|
161
|
|
|
{ |
|
162
|
|
|
$this->parameters['withXoopsUser'] = $value; |
|
163
|
|
|
|
|
164
|
|
|
return $this; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* Indique s'il faut retourner les produits relatifs |
|
169
|
|
|
* |
|
170
|
|
|
* @param boolean $value |
|
171
|
|
|
* @return object |
|
172
|
|
|
*/ |
|
173
|
|
|
public function setWithRelatedProducts($value) |
|
174
|
|
|
{ |
|
175
|
|
|
$this->parameters['withRelatedProducts'] = $value; |
|
176
|
|
|
|
|
177
|
|
|
return $this; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* Indique s'il faut retourner les quantités |
|
182
|
|
|
* |
|
183
|
|
|
* @param boolean $value |
|
184
|
|
|
* @return object |
|
185
|
|
|
*/ |
|
186
|
|
|
public function setWithQuantity($value) |
|
187
|
|
|
{ |
|
188
|
|
|
$this->parameters['withQuantity'] = $value; |
|
189
|
|
|
|
|
190
|
|
|
return $this; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* Fixe le type de produits à retourner |
|
195
|
|
|
* |
|
196
|
|
|
* @param string $value |
|
197
|
|
|
* @return object |
|
198
|
|
|
*/ |
|
199
|
|
|
public function setProductsType($value) |
|
200
|
|
|
{ |
|
201
|
|
|
$this->parameters['productsType'] = $value; |
|
202
|
|
|
|
|
203
|
|
|
return $this; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* Indique s'il faut retourner seulement les mois |
|
208
|
|
|
* |
|
209
|
|
|
* @param boolean $value |
|
210
|
|
|
* @return object |
|
211
|
|
|
*/ |
|
212
|
|
|
public function setThisMonthOnly($value) |
|
213
|
|
|
{ |
|
214
|
|
|
$this->parameters['thisMonthOnly'] = $value; |
|
215
|
|
|
|
|
216
|
|
|
return $this; |
|
217
|
|
|
} |
|
218
|
|
|
} |
|
219
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.