| 7 |
jpm |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe modèle spécifique à l'application Collection, donc d'accés au données, elle ne devrait pas être appelée de l'extérieur.
|
|
|
5 |
* Elle est abstraite donc doit obligatoirement être étendue.
|
|
|
6 |
*
|
|
|
7 |
* @category php5
|
|
|
8 |
* @package Collection
|
|
|
9 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
10 |
* @copyright 2010 Tela-Botanica
|
|
|
11 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
|
|
12 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
|
|
13 |
* @version SVN: $Id: ColModele.php 20 2010-03-29 17:28:43Z jpm $
|
|
|
14 |
*/
|
|
|
15 |
abstract class ColModele extends Modele {
|
| 20 |
jpm |
16 |
protected $distinction = '0';
|
| 7 |
jpm |
17 |
protected $limite_debut = null;
|
|
|
18 |
protected $limite_nbre = null;
|
| 19 |
jpm |
19 |
protected $url_jrest = null;
|
| 7 |
jpm |
20 |
|
| 19 |
jpm |
21 |
public function __construct() {
|
|
|
22 |
parent::__construct();
|
|
|
23 |
$this->url_jrest = config::get('url_jrest');
|
|
|
24 |
}
|
|
|
25 |
|
| 7 |
jpm |
26 |
public function avoirLimitation() {
|
|
|
27 |
$limitation = false;
|
|
|
28 |
if (!is_null($this->limite_debut) && !is_null($this->limite_nbre)) {
|
|
|
29 |
$limitation = true;
|
|
|
30 |
}
|
|
|
31 |
return $limitation;
|
|
|
32 |
}
|
|
|
33 |
|
| 20 |
jpm |
34 |
public function setDistinction($distinct) {
|
|
|
35 |
$this->distinction = $distinct;
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
public function getDistinction() {
|
|
|
39 |
return $this->distinction;
|
|
|
40 |
}
|
|
|
41 |
|
| 7 |
jpm |
42 |
public function setLimitation($limite_debut, $limite_nbre) {
|
|
|
43 |
$this->limite_debut = $limite_debut;
|
|
|
44 |
$this->limite_nbre = $limite_nbre;
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
public function getLimiteDebut() {
|
|
|
48 |
return $this->limite_debut;
|
|
|
49 |
}
|
|
|
50 |
public function getLimiteNbre() {
|
|
|
51 |
return $this->limite_nbre;
|
|
|
52 |
}
|
| 16 |
jpm |
53 |
|
|
|
54 |
protected function nettoyerTableauDeTableauxAssoc(&$tableau) {
|
| 18 |
jpm |
55 |
if (is_array($tableau) && count($tableau) > 0) {
|
|
|
56 |
foreach ($tableau as $cle => $valeur) {
|
|
|
57 |
$this->nettoyerTableauAssoc($valeur);
|
|
|
58 |
$tableau[$cle] = $valeur;
|
|
|
59 |
}
|
| 16 |
jpm |
60 |
}
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
protected function nettoyerTableauAssoc(&$tableau) {
|
| 18 |
jpm |
64 |
if (is_array($tableau) && count($tableau) > 0) {
|
|
|
65 |
foreach ($tableau as $cle => $valeur) {
|
|
|
66 |
if (is_numeric($cle) && is_int((integer) $cle)) {
|
|
|
67 |
unset($tableau[$cle]);
|
|
|
68 |
}
|
| 16 |
jpm |
69 |
}
|
|
|
70 |
}
|
|
|
71 |
}
|
| 7 |
jpm |
72 |
}
|