Subversion Repositories eFlore/Applications.coel-consultation

Rev

Rev 16 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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 18 2010-03-23 18:14:32Z jpm $
14
*/
15
abstract class ColModele extends Modele {
16
	protected $limite_debut = null;
17
	protected $limite_nbre = null;
18
 
19
	public function avoirLimitation() {
20
		$limitation = false;
21
		if (!is_null($this->limite_debut) && !is_null($this->limite_nbre)) {
22
			$limitation = true;
23
		}
24
		return $limitation;
25
	}
26
 
27
	public function setLimitation($limite_debut, $limite_nbre) {
28
		$this->limite_debut = $limite_debut;
29
		$this->limite_nbre = $limite_nbre;
30
	}
31
 
32
	public function getLimiteDebut() {
33
		return $this->limite_debut;
34
	}
35
	public function getLimiteNbre() {
36
		return $this->limite_nbre;
37
	}
16 jpm 38
 
39
	protected function nettoyerTableauDeTableauxAssoc(&$tableau) {
18 jpm 40
		if (is_array($tableau) && count($tableau) > 0) {
41
			foreach ($tableau as $cle => $valeur) {
42
				$this->nettoyerTableauAssoc($valeur);
43
				$tableau[$cle] = $valeur;
44
			}
16 jpm 45
		}
46
	}
47
 
48
	protected function nettoyerTableauAssoc(&$tableau) {
18 jpm 49
		if (is_array($tableau) && count($tableau) > 0) {
50
			foreach ($tableau as $cle => $valeur) {
51
				if (is_numeric($cle) && is_int((integer) $cle)) {
52
					unset($tableau[$cle]);
53
				}
16 jpm 54
			}
55
		}
56
	}
7 jpm 57
}