Subversion Repositories eFlore/Applications.coel-consultation

Rev

Rev 19 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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