Subversion Repositories eFlore/Applications.coel-consultation

Rev

Rev 76 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
// declare(encoding='UTF-8');
/**
* 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.
* Elle est abstraite donc doit obligatoirement être étendue.
*
* @category  php5
* @package   Collection
* @author       Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license   http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version   SVN: $Id: ColModele.php 76 2010-06-07 08:28:56Z jpm $
*/
abstract class ColModele extends Modele {
        protected $distinction = '0';
        protected $limite_debut = null;
        protected $limite_nbre = null;
        protected $url_jrest = null;
        
        public function __construct() {
                parent::__construct();
                $this->url_jrest = config::get('url_jrest');
        }
        
        public function avoirLimitation() {
                $limitation = false;
                if (!is_null($this->limite_debut) && !is_null($this->limite_nbre)) {
                        $limitation = true;
                }
                return $limitation;
        }
        
        public function setDistinction($distinct) {
                $this->distinction = $distinct;
        }
        
        public function getDistinction() {
                return $this->distinction;
        }
        
        public function setLimitation($limite_debut, $limite_nbre) {
                $this->limite_debut = $limite_debut;
                $this->limite_nbre = $limite_nbre;
        }
        
        public function getLimiteDebut() {
                return $this->limite_debut;
        }
        public function getLimiteNbre() {
                return $this->limite_nbre;
        }
        
        protected function nettoyerTableauDeTableauxAssoc(&$tableau) {
                if (is_array($tableau) && count($tableau) > 0) {
                        foreach ($tableau as $cle => $valeur) {
                                $this->nettoyerTableauAssoc($valeur);
                                $tableau[$cle] = $valeur;
                        }
                }
        }
        
        protected function nettoyerTableauAssoc(&$tableau) {
                if (is_array($tableau) && count($tableau) > 0) {
                        foreach ($tableau as $cle => $valeur) {
                                if (is_numeric($cle) && is_int((integer) $cle)) {
                                        unset($tableau[$cle]);
                                }
                        }
                }
        }
}