Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 36 → Rev 37

/trunk/bibliotheque/dao/Dao.php
87,7 → 87,7
'http' => array(
'method' => $mode,
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query($donnees, null, HTTP_REQUETE_SEPARATEUR))));
'content' => http_build_query($donnees, null, self::HTTP_REQUETE_SEPARATEUR))));
$flux = @fopen($url, 'r', false, $contexte);
if (!$flux) {
$this->traiterEntete($http_response_header, $url);
/trunk/bibliotheque/dao/ReferentielDao.php
2,7 → 2,7
// declare(encoding='UTF-8');
/**
* Modèle d'accès à la base de données des Référentiels.
* Permet d'accèder au données d'un référentiel.
* Permet d'accèder au données des référentiels.
*
* @package Referentiel
* @category Php 5.2
15,6 → 15,18
*/
class ReferentielDao extends Dao {
const SERVICE = 'Referentiel';
 
/**
* Retourne des infos sur l'ensemble des référentiels disponibles.
*
* @return array un tableau contenant les informations sur les référentiels disponibles.
*/
public function getReferentielsDispo() {
$url = $this->url_jrest.self::SERVICE."/Dispo";
$json = file_get_contents($url);
$noms = json_decode($json, true);
return $noms;
}
/**
* Retourne l'ensemble des information sur les colonnes d'une table.
24,25 → 36,8
*/
public function getTout($code_projet) {
$url = $this->url_jrest.self::SERVICE."/Tout/$code_projet";
$json = file_get_contents($url);
$noms = json_decode($json, true);
/*
$noms = array();
$pas = 20000;
$max = $this->getNombre($code_projet);
for ($i = 0; $i < $max; $i = $i + $pas) {
$start = ($i != 0) ? ($i+1): $i;
$limit = $i + $pas;
$url_limitee = $url."?start=$start&limit=$limit";
Debug::printr("Récupération des données de $start à $limit");
$json = file_get_contents($url_limitee);
$enregistrements = json_decode($json, true);
$noms = array_merge($noms, $enregistrements);
}*/
return $noms;
}
/trunk/interfaces/controleurs/AppliControleur.php
16,6 → 16,8
const RENDU_TETE = 'tete';
const RENDU_CORPS = 'corps';
const RENDU_PIED = 'pied';
const RENDU_NAVIGATION = 'navigation';
const RENDU_MENU = 'menu';
// FIXME : voir s'il est plus intéressant d'utiliser une méthode dans les classes filles
protected $url = null;
84,7 → 86,9
$existe = true;
if ($position != self::RENDU_TETE &&
$position != self::RENDU_CORPS &&
$position != self::RENDU_PIED) {
$position != self::RENDU_PIED &&
$position != self::RENDU_NAVIGATION &&
$position != self::RENDU_MENU) {
trigger_error("La position '$position' n'est pas une valeur prédéfinie.", E_USER_WARNING);
$existe = false;
}
139,5 → 143,120
$txt = preg_replace('/&(?!([a-z]+|#[0-9]+|#x[0-9a-f]+);)/i', '&amp;', $txt, -1);
return $txt;
}
/**
* Construction du menu et stockage dans le conteneur de sortie RENDU_MENU.
*
* @param string $referentiel code du référentiel.
*/
protected function construireMenu($referentiel) {
$menu['nom'] = 'Accueil';
$menu['url'] = $this->obtenirUrlMenuAccueil();
$donnees['menus'][] = $menu;
$menu['nom'] = 'Tests';
$menu['url'] = $this->obtenirUrlMenuTest($referentiel);
$donnees['menus'][] = $menu;
$menu['nom'] = 'Versionnage';
$menu['url'] = $this->obtenirUrlMenuVersionnage($referentiel);
$donnees['menus'][] = $menu;
$menu['nom'] = 'Consultation';
$menu['url'] = $this->obtenirUrlMenuConsultation($referentiel);
$donnees['menus'][] = $menu;
$this->setSortie(self::RENDU_MENU, $this->getVue('menu', $donnees), false);
}
/**
* Construction du fil d'ariane et stockage dans le conteneur de sortie RENDU_NAVIGATION.
*
* @param $referentiel code du référentiel
* @param $id_traitement id du traitement
* @param $id_resultat id du résultat
*/
protected function construireFilAriane($referentiel = null, $id_traitement = null, $id_resultat = null) {
$entree['nom'] = 'Accueil';
$entree['url'] = $this->obtenirUrlMenuAccueil();
$donnees['entrees'][] = $entree;
if (isset($referentiel)) {
$entree['nom'] = strtoupper($referentiel);
$entree['url'] = $this->obtenirUrlDetailReferentiel($referentiel);
$donnees['entrees'][] = $entree;
$module = Referentiel::getModule();
if ($module != 'Accueil') {
$entree['nom'] = $module;
$entree['url'] = $this->obtenirUrlMenu($module, $referentiel);
$donnees['entrees'][] = $entree;
}
if (isset($id_traitement)) {
$entree['nom'] = "Traitement #$id_traitement";
$entree['url'] = $this->obtenirUrlFicheTraitement($referentiel, $id_traitement);
$donnees['entrees'][] = $entree;
}
if (isset($id_resultat)) {
$entree['nom'] = "Résultat #$id_resultat";
$entree['url'] = $this->obtenirUrlFicheResultat($referentiel, $id_resultat);
$donnees['entrees'][] = $entree;
}
}
$this->setSortie(self::RENDU_NAVIGATION, $this->getVue('fil_ariane', $donnees), false);
}
protected function obtenirUrlDetailReferentiel($referentiel) {
$this->url->setRequete(false);
$this->url->setVariableRequete('module', 'Accueil');
$this->url->setVariableRequete('action', 'afficherDetail');
$this->url->setVariableRequete('ref', $referentiel);
$url = $this->url->getURL();
$this->url->unsetVariablesRequete(array('module', 'action', 'ref'));
return $url;
}
protected function obtenirUrlMenuAccueil() {
return $this->obtenirUrlMenu('Accueil');
}
protected function obtenirUrlMenuTest($referentiel) {
return $this->obtenirUrlMenu('Test', $referentiel);
}
protected function obtenirUrlMenuVersionnage($referentiel) {
return $this->obtenirUrlMenu('Versionnage', $referentiel);
}
protected function obtenirUrlMenuConsultation($referentiel) {
return $this->obtenirUrlMenu('Consultation', $referentiel);
}
private function obtenirUrlMenu($menu, $referentiel = null) {
$this->url->setRequete(false);
$this->url->setVariableRequete('module', $menu);
if (isset($referentiel)) {
$this->url->setVariableRequete('ref', $referentiel);
}
$url = $this->url->getURL();
$this->url->unsetVariablesRequete(array('module', 'ref'));
return $url;
}
protected function obtenirUrlFicheTraitement($referentiel, $id_traitement) {
$this->url->setRequete(false);
$this->url->setVariableRequete('module', 'Traitement');
$this->url->setVariableRequete('id-t', $id_traitement);
$this->url->setVariableRequete('ref', $referentiel);
$url = $this->url->getURL();
$this->url->unsetVariablesRequete(array('module', 'id-t', 'ref'));
return $url;
}
protected function obtenirUrlFicheResultat($referentiel, $id_resultat) {
$this->url->setRequete(false);
$this->url->setVariableRequete('module', 'Resultat');
$this->url->setVariableRequete('id-r', $id_resultat);
$this->url->setVariableRequete('ref', $referentiel);
$url = $this->url->getURL();
$this->url->unsetVariablesRequete(array('module', 'id-r', 'ref'));
return $url;
}
}
/trunk/interfaces/controleurs/Consultation.php
New file
0,0 → 1,39
<?php
// declare(encoding='UTF-8');
/**
* Classe Controleur du module Consultation.
* Permet de consultation la version de travail d'un référentiel.
*
* @package Referentiel
* @category Php5.2
* @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$
*/
class Consultation extends AppliControleur {
private $referentiel = null;
public function __construct() {
parent::__construct();
// Récupération de paramêtres
if (isset($_GET['ref'])) { // code du projet courrant
$this->referentiel = strtolower($_GET['ref']);
}
}
//+----------------------------------------------------------------------------------------------------------------+
// Méthodes
/**
* Fonction d'affichage par défaut
*/
public function executerActionParDefaut() {
$this->construireMenu($this->referentiel);
$this->construireFilAriane($this->referentiel);
$this->setSortie(self::RENDU_CORPS, '<p>En cours de réalisation...</p>', false);
}
}
?>
/trunk/interfaces/controleurs/Resultat.php
14,6 → 14,8
*/
class Resultat extends AppliControleur {
private $referentiel = null;
private $traitementId = null;
private $resultatId = null;
private $resultatDao = null;
24,6 → 26,9
if (isset($_GET['id-r'])) { // id du resultat courant
$this->resultatId = strtolower($_GET['id-r']);
}
if (isset($_GET['ref'])) { // code du projet courrant
$this->referentiel = strtolower($_GET['ref']);
}
// Chargement des DAO nécessaires
if (isset($this->resultatId)) {
51,7 → 56,8
// Recherche d'info sur le résultat
$infos = $this->resultatDao->getInfos($this->resultatId);
if ($infos != false) {
$donnees['resultat'] = $infos;
$donnees['resultat'] = $infos;
$this->traitementId = $infos['ce_traitement'];
} else {
$this->addMessage("L'identifiant de résultat n'est pas indexé dans la base de données.");
}
62,6 → 68,8
$donnees['messages'] = $this->getMessages();
$this->traiterEsperluette($donnees);
$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $donnees), false);
$this->construireMenu($this->referentiel);
$this->construireFilAriane($this->referentiel, $this->traitementId, $this->resultatId);
}
}
?>
/trunk/interfaces/controleurs/Referentiel.php
32,9 → 32,9
*/
public function __construct() {
$meta = array('titre' => '', 'description' => '', 'tags' => '');
$sortie = array('metadonnees' => $meta, 'corps' => '', 'tete' => '', 'pied' => '', 'navigation' => '');
$sortie = array('metadonnees' => $meta, 'corps' => '', 'tete' => '', 'pied' => '', 'navigation' => '', 'menu' => '');
$url = new Url(Config::get('url_base_index'));
self::$parametres = array( 'module' => 'Test',
self::$parametres = array( 'module' => 'Accueil',
'action' => 'executerActionParDefaut',
'sortie' => $sortie,
'url' => $url);
95,6 → 95,13
}
/**
* Retourne le module courrant.
*/
public static function getModule() {
return self::$parametres['module'];
}
/**
* Retourne le titre du contenu de l'application.
*/
public static function getMetaTitre() {
160,6 → 167,17
}
/**
* Retourne le menu de l'application.
*/
public static function getContenuMenu() {
$sortie = self::$parametres['sortie']['menu'];
if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
$sortie = mb_convert_encoding($sortie, Config::get('sortie_encodage'), Config::get('appli_encodage'));
}
return $sortie;
}
/**
* Retourne les chronos pris dans l'appli
*/
public static function getChrono() {
/trunk/interfaces/controleurs/Accueil.php
New file
0,0 → 1,90
<?php
// declare(encoding='UTF-8');
/**
* Classe Controleur du module Accueil.
* Affichage les infos sur l'ensemble des référentiels disponibles.
*
* @package Referentiel
* @category Php5.2
* @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$
*/
class Accueil extends AppliControleur {
private $referentiel = null;
private $referentielDao = null;
public function __construct() {
parent::__construct();
// Récupération de paramêtres
if (isset($_GET['ref'])) { // code du projet courrant
$this->referentiel = strtolower(strip_tags($_GET['ref']));
}
// Chargement des DAO nécessaires
$this->referentielDao = new ReferentielDao();
}
//+----------------------------------------------------------------------------------------------------------------+
// Méthodes
/**
* Fonction d'affichage par défaut
*/
public function executerActionParDefaut() {
return $this->afficherAccueil();
}
/**
* Affiche la liste des référentiels
*/
public function afficherAccueil() {
$donnees = array();
$infos = $this->referentielDao->getReferentielsDispo();
if ($infos != false) {
$referentiel = array();
foreach ($infos as $info) {
$referentiel['nom'] = $info;
$referentiel['url'] = $this->obtenirUrlDetailReferentiel($info);
}
$donnees['referentiels'][] = $referentiel;
} else {
$this->addMessage("Aucun référentiel n'est disponible.");
}
$donnees['messages'] = $this->getMessages();
$this->traiterEsperluette($donnees);
$this->setSortie(self::RENDU_CORPS, $this->getVue('accueil', $donnees), false);
$this->construireFilAriane();
}
/**
* Affiche le détail d'un référentiel et la liste des actions possibles
*/
public function afficherDetail() {
$donnees = array();
// Traitement de l'info sur le code du référentiel
if (isset($this->referentiel)) {
$this->construireMenu($this->referentiel);
$this->construireFilAriane($this->referentiel);
$donnees['referentiel'] = $this->referentiel;
$donnees['url_menu_test'] = $this->obtenirUrlMenuTest($this->referentiel);
$donnees['url_menu_versionnage'] = $this->obtenirUrlMenuVersionnage($this->referentiel);
$donnees['url_menu_consultation'] = $this->obtenirUrlMenuConsultation($this->referentiel);
} else {
$this->addMessage("Aucun code de projet de référentiel n'est indiqué (Ex. bdnff).");
}
$donnees['messages'] = $this->getMessages();
$this->traiterEsperluette($donnees);
$this->setSortie(self::RENDU_CORPS, $this->getVue('detail_referentiel', $donnees), false);
}
}
?>
/trunk/interfaces/controleurs/Traitement.php
14,6 → 14,7
*/
class Traitement extends AppliControleur {
private $referentiel = null;
private $traitementId = null;
private $traitementDao = null;
private $resultatDao = null;
25,6 → 26,9
if (isset($_GET['id-t'])) { // id du traitement courant
$this->traitementId = strtolower($_GET['id-t']);
}
if (isset($_GET['ref'])) { // code du projet courrant
$this->referentiel = strtolower($_GET['ref']);
}
// Chargement des DAO nécessaires
if (isset($this->traitementId)) {
62,14 → 66,9
$infos = $this->resultatDao->getResultatsTraitement($this->traitementId);
if ($infos != false) {
// Ajout de l'url vers la fiche du resultat
$this->url->unsetVariablesRequete(array('action','id-t'));
$this->url->setVariableRequete('module', 'Resultat');
foreach ($infos as &$resultat) {
$this->url->setVariableRequete('id-r', $resultat['id_resultat']);
$resultat['url'] = $this->url->getUrl();
$this->url->unsetVariableRequete('id-r');
$resultat['url'] = $this->obtenirUrlFicheResultat($this->referentiel, $resultat['id_resultat']);
}
$this->url->unsetVariablesRequete(array('module'));
$donnees['resultats'] = $infos;
}
} else {
79,6 → 78,8
$donnees['messages'] = $this->getMessages();
$this->traiterEsperluette($donnees);
$this->setSortie(self::RENDU_CORPS, $this->getVue('traitement', $donnees), false);
$this->construireMenu($this->referentiel);
$this->construireFilAriane($this->referentiel, $this->traitementId);
}
}
?>
/trunk/interfaces/controleurs/Test.php
62,13 → 62,9
$resultat = $this->traitementDao->getTraitementsTermines($this->referentiel);
if ($resultat != false) {
// Ajout de l'url vers la fiche du traitement
$this->url->setVariableRequete('module', 'Traitement');
foreach ($resultat as &$traitement) {
$this->url->setVariableRequete('id-t', $traitement['id_traitement']);
$traitement['url'] = $this->url->getUrl();
$this->url->unsetVariableRequete('id-t');
$traitement['url'] = $this->obtenirUrlFicheTraitement($this->referentiel, $traitement['id_traitement']);
}
$this->url->unsetVariableRequete('module');
$donnees['traitements_termines'] = $resultat;
}
} else {
77,6 → 73,8
$donnees['messages'] = $this->getMessages();
$this->setSortie(self::RENDU_CORPS, $this->getVue('form_traitement', $donnees), false);
$this->construireMenu($this->referentiel);
$this->construireFilAriane($this->referentiel);
}
/**
/trunk/interfaces/controleurs/Versionnage.php
New file
0,0 → 1,39
<?php
// declare(encoding='UTF-8');
/**
* Classe Controleur du module Versionnage.
* Permet de publier une nouvelle version d'un référentiel de travail.
*
* @package Referentiel
* @category Php5.2
* @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$
*/
class Versionnage extends AppliControleur {
private $referentiel = null;
public function __construct() {
parent::__construct();
// Récupération de paramêtres
if (isset($_GET['ref'])) { // code du projet courrant
$this->referentiel = strtolower($_GET['ref']);
}
}
//+----------------------------------------------------------------------------------------------------------------+
// Méthodes
/**
* Fonction d'affichage par défaut
*/
public function executerActionParDefaut() {
$this->construireMenu($this->referentiel);
$this->construireFilAriane($this->referentiel);
$this->setSortie(self::RENDU_CORPS, '<p>En cours de réalisation...</p>', false);
}
}
?>
/trunk/interfaces/index.php
44,7 → 44,7
<div id="reducteur">
 
<div id="logo_tela">
<a href="/" title="Retour à l'accueil du site">
<a href="/referentiel/" title="Retour à l'accueil du site">
<img src="http://www.tela-botanica.org/sites/reseau/generique/images/graphisme/logo_jaune.gif" alt="le logo de Tela Botanica"/>
</a>
</div>
82,11 → 82,7
</div>
<div id="nav_gauche">
<ul>
<li><a href="<?=basename(__FILE__)?>?module=Test">Test</a></li>
<li><a href="<?=basename(__FILE__)?>?module=Versionnage">Versionnage</a></li>
<li><a href="<?=basename(__FILE__)?>?module=Consultation">Consultation</a></li>
</ul>
<?php echo Referentiel::getContenuMenu(); ?>
</div>
</div>
/trunk/interfaces/squelettes/fil_ariane.tpl.html
New file
0,0 → 1,9
<!-- REF - DEBUT FIL D'ARIANE -->
<?php if (isset($entrees)) : ?>
<ul class="fil-ariane">
<?php foreach ($entrees as $entree) : ?>
<li><a href="<?=$entree['url'];?>"><?=$entree['nom'];?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<!-- REF - FIN FIL D'ARIANE -->
/trunk/interfaces/squelettes/menu.tpl.html
New file
0,0 → 1,11
<!-- REF - DEBUT MENU -->
<h1>Menu</h1>
 
<?php if (isset($menus)) : ?>
<ul>
<?php foreach ($menus as $menu) : ?>
<li><a href="<?=$menu['url'];?>"><?=$menu['nom'];?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<!-- REF - FIN MENU -->
/trunk/interfaces/squelettes/accueil.tpl.html
New file
0,0 → 1,18
<!-- REF - DEBUT ACCUEIL -->
<h1>Liste des référentiels en cours de travail</h1>
 
<?php if (isset($messages)) : ?>
<h2>Messages</h2>
<?php foreach ($messages as $message) : ?>
<p class="information"><?=$message;?></p>
<?php endforeach; ?>
<?php endif; ?>
 
<?php if (isset($referentiels)) : ?>
<ul>
<?php foreach ($referentiels as $referentiel) : ?>
<li><a href="<?=$referentiel['url'];?>"><?=$referentiel['nom'];?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<!-- REF - FIN ACCUEIL -->
/trunk/interfaces/squelettes/detail_referentiel.tpl.html
New file
0,0 → 1,22
<!-- REF - DEBUT DETAIL -->
<h1>Référentiel «<?=$referentiel;?>»</h1>
 
<?php if (isset($messages)) : ?>
<h2>Messages</h2>
<?php foreach ($messages as $message) : ?>
<p class="information"><?=$message;?></p>
<?php endforeach; ?>
<?php endif; ?>
 
<p>
Vous pouvez <a href="<?=$url_menu_test;?>">tester</a> le référentiel «<?=$referentiel;?>»
afin de contrôler les données saisies dans la version de travail.<br />
Lorsqu'une version de travail est prête à être publié, vous pouvez accéder à
<a href="<?=$url_menu_versionnage;?>">l'outil de versionnage</a> pour réaliser
cette manipulation. Cette interface permet aussi de télécharger les versions précédentes.<br />
Enfin, il est possible de <a href="<?=$url_menu_consultation;?>">consulter</a> en permanence les données saisies
dans la version de travail.
</p>
<!-- REF - FIN DETAIL -->
/trunk/services/modules/Referentiel.php
13,31 → 13,25
* @version $Id$
*/
class Referentiel extends Ref {
/**
* Méthode principale appelée avec une requête de type GET.
*/
public function getElement($param = array()) {
public function getElement($params_url = array()) {
// Initialisation des variables
$info = array();
// Nour recherchons le type de requête demandé
$p = $this->traiterParametresUrl(array('type', 'projet'), $param, false);
$p = $this->traiterParametresUrl(array('type'), $params_url, false);
extract($p);
$type = $p['type'];
$projet = $p['projet'];
if (!is_null($type)) {
if (!is_null($projet)) {
$methode = 'getElement'.$type;
if (method_exists($this, $methode)) {
//array_shift($param);
$info = $this->$methode($projet);
} else {
$this->messages[] = "Le type d'information demandé '$type' n'est pas disponible.";
}
$methode = 'getElement'.$type;
if (method_exists($this, $methode)) {
array_shift($params_url);
$info = $this->$methode($params_url);
} else {
$this->messages[] = "Veuillez préciser le nom de code du projet comme premier paramêtre (ex. : bdnff).";
$this->messages[] = "Le type d'information demandé '$type' n'est pas disponible.";
}
} else {
$this->messages[] = "Veuillez préciser le type de requête.";
47,19 → 41,24
$this->envoyer($info);
}
/* Méthode pour récupérer les noms d'un référentiel.
/* Méthode pour récupérer les infos sur les référentiels disponibles
* Appelée avec les paramêtres d'url suivant :
* /RefReferentiel/tout/code_du_referentiel
*/
public function getElementTout($projet) {
$requete = ($this->distinct ? 'SELECT DISTINCT' : 'SELECT').' * '.
"FROM `$projet` ".
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'num_nom ASC').' ';
//"LIMIT $this->start, $this->limit ";
public function getElementDispo($params_url) {
$requete = 'SHOW TABLES ';
$donnees = false;
// Récupération des résultats
try {
$donnees = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC);
if ($donnees === false) {
$tables = $this->bdd->query($requete)->fetchAll(PDO::FETCH_COLUMN, 0);
if ($tables !== false) {
foreach ($tables as $table) {
if (preg_match('/^([a-z]+)_meta$/', $table, $match)) {
$donnees[] = $match[1];
}
}
} else {
$this->messages[] = "La requête a retourné aucun résultat.";
}
} catch (PDOException $e) {
68,21 → 67,58
return $donnees;
}
/* Méthode pour récupérer les noms d'un référentiel.
* Appelée avec les paramêtres d'url suivant :
* /RefReferentiel/tout/code_du_referentiel
*/
public function getElementTout($params_url) {
$p = $this->traiterParametresUrl(array('projet'), $params_url, false);
extract($p);
$donnees = false;
if (!is_null($projet)) {
$requete = ($this->distinct ? 'SELECT DISTINCT' : 'SELECT').' * '.
"FROM $projet ".
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'num_nom ASC').' ';
//"LIMIT $this->start, $this->limit ";
// Récupération des résultats
try {
$donnees = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC);
if ($donnees === false) {
$this->messages[] = "La requête a retourné aucun résultat.";
}
} catch (PDOException $e) {
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage());
}
} else {
$this->messages[] = "Veuillez préciser le nom de code du projet comme second paramêtre (ex. : bdnff).";
}
return $donnees;
}
/* Méthode pour récupérer le nombre de noms présents dans un référentiel.
* Appelée avec les paramêtres d'url suivant :
* /RefReferentiel/nombre/code_du_referentiel
*/
public function getElementNombre($projet) {
$requete = 'SELECT COUNT(*) AS nbre '.
"FROM `$projet` ";
// Récupération des résultats
try {
$nbre = $this->bdd->query($requete)->fetchColumn();
if ($nbre === false) {
$this->messages[] = "La requête a retourné aucun résultat.";
$p = $this->traiterParametresUrl(array('projet'), $params_url, false);
extract($p);
$nbre = false;
if (!is_null($projet)) {
$requete = 'SELECT COUNT(*) AS nbre '.
"FROM $projet ";
// Récupération des résultats
try {
$nbre = $this->bdd->query($requete)->fetchColumn();
if ($nbre === false) {
$this->messages[] = "La requête a retourné aucun résultat.";
}
} catch (PDOException $e) {
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage());
}
} catch (PDOException $e) {
$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage());
} else {
$this->messages[] = "Veuillez préciser le nom de code du projet comme second paramêtre (ex. : bdnff).";
}
return $nbre;
}
/trunk/doc/bdd/bdnt.sql
New file
0,0 → 1,51
CREATE TABLE bdnt_meta (
id_meta INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
titre VARCHAR(128) NULL ,
code VARCHAR(16) NULL ,
domaine_taxo VARCHAR(64) NULL ,
domaine_geo VARCHAR(64) NULL ,
domaine_nom VARCHAR(8) NULL ,
classification VARCHAR(128) NULL ,
version VARCHAR(8) NULL ,
coordinateur VARCHAR(256) NULL ,
auteur TEXT NULL ,
contributeur TEXT NULL ,
date_production DATE NULL ,
date_validation DATE NULL ,
source VARCHAR(256) NULL ,
contact VARCHAR(64) NULL ,
editeur VARCHAR(64) NULL ,
droit VARCHAR(64) NULL ,
licence VARCHAR(256) NULL ,
referencement VARCHAR(256) NULL ,
stat_combinaison INTEGER UNSIGNED NULL ,
stat_taxon INTEGER UNSIGNED NULL ,
stat_modification INTEGER UNSIGNED NULL ,
signature VARCHAR(32) NULL ,
PRIMARY KEY(id_meta));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/trunk/doc/bdd/referentiel.xml
261,6 → 261,7
<METADATA>
<REGIONS>
<REGION ID="27985" RegionName="Traitements" XPos="28" YPos="24" Width="691" Height="530" RegionColor="0" TablePrefix="0" TableType="0" OverwriteTablePrefix="0" OverwriteTableType="0" Comments="Tables permettant de r\195\169aliser des traitments sur les donn\195\169es des r\195\169f\195\169rentiels." IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="3" />
<REGION ID="28021" RegionName="Exemple BDNT" XPos="743" YPos="25" Width="668" Height="529" RegionColor="1" TablePrefix="0" TableType="0" OverwriteTablePrefix="0" OverwriteTableType="0" Comments="" IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="7" />
</REGIONS>
<TABLES>
<TABLE ID="27977" Tablename="ref_traitement" PrevTableName="Table_01" XPos="87" YPos="74" TableType="0" TablePrefix="0" nmTable="0" Temporary="0" UseStandardInserts="0" StandardInserts="\n" TableOptions="DelayKeyTblUpdates=0\nPackKeys=0\nRowChecksum=0\nRowFormat=0\nUseRaid=0\nRaidType=0\n" Comments="" Collapsed="0" IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="2" >
411,6 → 412,151
</INDEX>
</INDICES>
</TABLE>
<TABLE ID="28022" Tablename="bdnt_meta" PrevTableName="Table_04" XPos="768" YPos="61" TableType="0" TablePrefix="0" nmTable="0" Temporary="0" UseStandardInserts="0" StandardInserts="\n" TableOptions="DelayKeyTblUpdates=0\nPackKeys=0\nRowChecksum=0\nRowFormat=0\nUseRaid=0\nRaidType=0\n" Comments="" Collapsed="0" IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="8" >
<COLUMNS>
<COLUMN ID="28024" ColName="id_meta" PrevColName="" Pos="0" idDatatype="5" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="1" NotNull="1" AutoInc="1" IsForeignKey="0" DefaultValue="" Comments="">
<OPTIONSELECTED>
<OPTIONSELECT Value="1" />
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28026" ColName="titre" PrevColName="" Pos="1" idDatatype="20" DatatypeParams="(128)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments=" Le nom complet.">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28027" ColName="code" PrevColName="" Pos="2" idDatatype="20" DatatypeParams="(16)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Le code correspondant \195\160 l\aabr\195\169viation ou \195\160 l\aacronyme du titre.">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28028" ColName="domaine_taxo" PrevColName="" Pos="3" idDatatype="20" DatatypeParams="(64)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Le nom du groupe taxonomique dans lequel le r\195\169f\195\169rentiel s\ainscrit.">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28029" ColName="domaine_geo" PrevColName="" Pos="4" idDatatype="20" DatatypeParams="(64)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Le nom de la zone g\195\169ographique la plus large prise en compte par le r\195\169f\195\169rentiel.">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28030" ColName="domaine_nom" PrevColName="" Pos="5" idDatatype="20" DatatypeParams="(8)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Abr\195\169viation d\aun ou plusieurs codes de nomenclature utilis\195\169 dans ce r\195\169f\195\169rentiel. Liste des codes : CINB, CINPC.">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28031" ColName="classification" PrevColName="" Pos="6" idDatatype="20" DatatypeParams="(128)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Le nom de la classification retenue Cl.">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28032" ColName="version" PrevColName="" Pos="7" idDatatype="20" DatatypeParams="(8)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Num\195\169ro de version du r\195\169f\195\169rentiel sous la forme : version majeure.version mineure.">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28033" ColName="coordinateur" PrevColName="" Pos="8" idDatatype="20" DatatypeParams="(256)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Informations sur le coordinateur du r\195\169f\195\169rentiel sous la forme : Pr\195\169nom1 NOM1 (Organisation1) \kcourriel1\g">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28034" ColName="auteur" PrevColName="" Pos="9" idDatatype="28" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Liste des auteurs du r\195\169f\195\169rentiel sous la forme : Pr\195\169nom1 NOM1 (Organisation1) \kcourriel1\g, Pr\195\169nom2 NOM2 (Organisation2) \kcourriel2\g">
<OPTIONSELECTED>
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28035" ColName="contributeur" PrevColName="" Pos="10" idDatatype="28" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Liste des contributeurs au r\195\169f\195\169rentiel sous la forme : Pr\195\169nom1 NOM1 (Organisation1) \kcourriel1\g, Pr\195\169nom2 NOM2 (Organisation2) \kcourriel2\g">
<OPTIONSELECTED>
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28036" ColName="date_production" PrevColName="" Pos="11" idDatatype="14" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Date correspondant \195\160 la derni\195\168re modification effectu\195\169e par le groupe de travail sur la version courante. Format : AAAA-MM-JJ">
<OPTIONSELECTED>
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28037" ColName="date_validation" PrevColName="" Pos="12" idDatatype="14" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Date correspondant \195\160 la validation par le SINP de la version courante. Format : AAAA-MM-JJ">
<OPTIONSELECTED>
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28038" ColName="source" PrevColName="" Pos="13" idDatatype="20" DatatypeParams="(256)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Un permalien indiquant la page o\195\185 l\aon peut t\195\169l\195\169charger la pr\195\169sente version">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28039" ColName="contact" PrevColName="" Pos="14" idDatatype="20" DatatypeParams="(64)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Une adresse de courriel o\195\185 il est possible de poser des questions, faire des remarques...">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28040" ColName="editeur" PrevColName="" Pos="15" idDatatype="20" DatatypeParams="(64)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Le nom de l\aorganisation dans le cadre de laquelle le r\195\169f\195\169rentiel a \195\169t\195\169 produit">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28041" ColName="droit" PrevColName="" Pos="16" idDatatype="20" DatatypeParams="(64)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Mention l\195\169gale (copyright)">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28042" ColName="licence" PrevColName="" Pos="17" idDatatype="20" DatatypeParams="(256)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="URL de la licence du document">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28043" ColName="referencement" PrevColName="" Pos="18" idDatatype="20" DatatypeParams="(256)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Indique comment d\195\169signer le r\195\169f\195\169rentiel dans une bibliographie par exemple">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28044" ColName="stat_combinaison" PrevColName="" Pos="19" idDatatype="5" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Le nombre de combinaisons nomenclaturales">
<OPTIONSELECTED>
<OPTIONSELECT Value="1" />
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28045" ColName="stat_taxon" PrevColName="" Pos="20" idDatatype="5" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Le nombre de noms retenus (taxons)">
<OPTIONSELECTED>
<OPTIONSELECT Value="1" />
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28046" ColName="stat_modification" PrevColName="" Pos="21" idDatatype="5" DatatypeParams="" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Le nombre de lignes modifi\195\169es par rapport \195\160 la version pr\195\169c\195\169dente.">
<OPTIONSELECTED>
<OPTIONSELECT Value="1" />
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
<COLUMN ID="28047" ColName="signature" PrevColName="" Pos="22" idDatatype="20" DatatypeParams="(32)" Width="-1" Prec="-1" PrimaryKey="0" NotNull="0" AutoInc="0" IsForeignKey="0" DefaultValue="" Comments="Signature md5 du fichier du r\195\169f\195\169rentiel">
<OPTIONSELECTED>
<OPTIONSELECT Value="0" />
<OPTIONSELECT Value="0" />
</OPTIONSELECTED>
</COLUMN>
</COLUMNS>
<INDICES>
<INDEX ID="28025" IndexName="PRIMARY" IndexKind="0" FKRefDef_Obj_id="-1">
<INDEXCOLUMNS>
<INDEXCOLUMN idColumn="28024" LengthParam="0" />
</INDEXCOLUMNS>
</INDEX>
</INDICES>
</TABLE>
</TABLES>
<RELATIONS>
<RELATION ID="27995" RelationName="fk_rt_rr" Kind="2" SrcTable="27977" DestTable="27986" FKFields="id_traitement=ce_traitement\n" FKFieldsComments="\n" relDirection="3" MidOffset="0" OptionalStart="0" OptionalEnd="0" CaptionOffsetX="-36" CaptionOffsetY="-25" StartIntervalOffsetX="0" StartIntervalOffsetY="0" EndIntervalOffsetX="0" EndIntervalOffsetY="0" CreateRefDef="0" Invisible="0" RefDef="Matching=0\nOnDelete=3\nOnUpdate=3\n" Comments="" FKRefDefIndex_Obj_id="-1" Splitted="0" IsLinkedObject="0" IDLinkedModel="-1" Obj_id_Linked="-1" OrderPos="5" />