Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 290 → Rev 291

/trunk/bibliotheque/NomCourrant.php
New file
0,0 → 1,31
<?php
class NomCourrant {
private $nns = null;
private $selectionne = null;
private $retenu = null;
 
public function __construct($num_nom_selectionne, Noms $noms, Taxons $taxons) {
$this->nns = $num_nom_selectionne;
$this->selectionne = new Nom($noms->getNom($this->nns));
$this->retenu = new Nom($taxons->getTaxon($this->nns));
}
 
/**
* Retour le numéro du nom sélectionné courrant.
*
* @return le numéro du nom sélectionné.
*/
public function getNns() {
return $this->nns;
}
 
public function getNomSelectionne() {
return $this->selectionne;
}
 
public function getNomRetenu() {
return $this->selectionne;
}
 
}
?>
/trunk/bibliotheque/Nom.php
New file
0,0 → 1,17
<?php
class Nom {
private $infos = array();
 
public function __construct(Array $infos) {
$this->infos = $infos;
}
 
public function get($cle) {
$valeur = '';
if (array_key_exists($cle, $this->infos)) {
$valeur = $this->infos[$cle];
}
return $valeur;
}
}
?>
/trunk/bibliotheque/Utilisateur.php
New file
0,0 → 1,26
<?php
class Utilisateur {
 
const NIVEAU_DEBUTANT = 1;
const NIVEAU_INTERMEDIAIRE = 2;
const NIVEAU_EXPERT = 3;
 
private $dureeSauvegarde = null;
private $niveau = null;
 
 
public function __construct($niveauDefaut) {
$this->niveau = isset($_COOKIE['eflore.niveau']) ? $_COOKIE['eflore.niveau'] : $niveauDefaut;
$this->dureeSauvegarde = 3600*24*365;
}
 
public function getNiveau() {
return $this->niveau;
}
 
public function sauver() {
setcookie('eflore.niveau', time()+$this->dureeSauvegarde, '/', 'www.tela-botanica.org');
}
 
 
}
/trunk/bibliotheque/Conteneur.php
New file
0,0 → 1,98
<?php
class Conteneur {
protected $parametres = array();
protected $partages = array();
 
public function __construct(array $parametres = null) {
$this->parametres = is_null($parametres) ? array() : $parametres;
}
 
public function getParametre($cle) {
$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : Config::get($cle);
return $valeur;
}
 
public function getParametreTableau($cle) {
$tableau = array();
$parametre = $this->getParametre($cle);
if (empty($parametre) === false) {
$tableauPartiel = explode(',', $parametre);
$tableauPartiel = array_map('trim', $tableauPartiel);
foreach ($tableauPartiel as $champ) {
if (strpos($champ, '=') === false) {
$tableau[] = trim($champ);
} else {
list($cle, $val) = explode('=', $champ);
$tableau[trim($cle)] = trim($val);
}
}
}
return $tableau;
}
 
public function setParametre($cle, $valeur) {
$this->parametres[$cle] = $valeur;
}
 
public function getAppUrls() {
if (!isset($this->partages['AppUrls'])){
$this->partages['AppUrls'] = new AppUrls();
}
return $this->partages['AppUrls'];
}
 
public function getApiNoms() {
$noms = new Noms($this->getParametre('referentiel_defaut'));
return $noms;
}
 
public function getApiTaxons() {
$taxons = new Taxons($this->getParametre('referentiel_defaut'));
return $taxons;
}
 
public function getApiImages() {
$images = new Images();
return $images;
}
 
public function getApiCartes() {
$cartes = new Cartes();
return $cartes;
}
 
public function getApiTextes() {
$textes = new Textes();
return $textes;
}
 
public function getApiMetaDonnees() {
$meta = new MetaDonnees();
return $meta;
}
 
public function getNomCourrant() {
if (!isset($this->partages['NomCourrant'])){
$nns = $this->getParametre('num_nom');
$noms = $this->getApiNoms();
$taxons = $this->getApiTaxons();
$this->partages['NomCourrant'] = new NomCourrant($nns, $noms, $taxons);
}
return $this->partages['NomCourrant'];
}
 
public function getUtilisateur() {
if (!isset($this->partages['Utilisateur'])){
$this->partages['Utilisateur'] = new Utilisateur($this->parametres['utilisateur.niveau.defaut']);
}
return $this->partages['Utilisateur'];
}
 
public function getBdd() {
if (!isset($this->partages['Bdd'])){
$this->partages['Bdd'] = new Bdd();
}
return $this->partages['Bdd'];
}
}
?>
/trunk/bibliotheque/AppUrls.php
29,11 → 29,11
 
public function getParametresUrlListe() {
$parametres = array(
'referentiel' => Registre::get('parametres.referentiel'),
'module' => 'liste',
'action' => 'liste',
'rang' => $this->rang,
'lettre' => $this->lettre
'referentiel' => Registre::get('parametres.referentiel'),
'module' => 'liste',
'action' => 'liste',
'rang' => $this->rang,
'lettre' => $this->lettre
);
return $parametres;
}
138,5 → 138,21
$url = $this->urlBase->getURL();
return $url;
}
 
public function getParametresUrlMetaDonnees() {
$parametres = array(
'module' => 'fiche-metadonnees',
'action' => 'affichageMetaDonnees'
);
return $parametres;
}
 
public function obtenirUrlMetaDonnees($projet) {
$parametres = $this->getParametresUrlMetaDonnees();
$parametres['projet'] = $projet;
$this->urlBase->setRequete($parametres);
$url = $this->urlBase->getURL();
return $url;
}
}
?>