16,6 → 16,11 |
|
const SCRIPT_A_LANCER = 'versionnage'; |
|
private $version = array('titre', 'acronyme', 'version', 'date_prod', |
'auteur_principal', 'coordinateur', 'editeur', 'contact', |
'contributeur', |
'dom_tax', 'dom_geo', 'dom_code', |
'source', 'copyright', 'licence', 'referencement'); |
private $referentiel = null; |
private $traitementDao = null; |
|
53,22 → 58,12 |
$donnees['url_module'] = 'Versionnage'; |
$donnees['url_action_rafraichir'] = 'afficherInterface'; |
|
// Date de production de la version |
$donnees['date_prod'] = date('Y-m-d'); |
|
$donnees['version'] = $this->instancierChampsVersionnage(); |
|
// Récupération des paramètres de configuration du manuel des référentiels |
$donnees['domaine_geo'] = explode(';', $this->manuel['domaine_geo']); |
$donnees['domaine_taxo'] = explode(';', $this->manuel['domaine_taxo']); |
$donnees['domaine_code'] = explode(';', $this->manuel['domaine_code']); |
$licences = explode(';', $this->manuel['licences']); |
foreach ($licences as $licence) { |
if (preg_match('/^([^<]+)<([^>]+)>/', $licence, $match)) { |
$info_licence = array(); |
$info_licence['nom'] = $match[1]; |
$info_licence['url'] = $match[2]; |
$donnees['licences'][] = $info_licence; |
} |
} |
|
// Traitement de l'info sur le code du référentiel |
if (isset($this->referentiel)) { |
100,12 → 95,65 |
$this->construireFilAriane($this->referentiel); |
} |
|
public function instancierChampsVersionnage() { |
$version = array(); |
foreach ($this->version as $champ) { |
if (isset($_POST[$champ])) { |
$version[$champ] = strip_tags(stripslashes($_POST[$champ])); |
} else { |
$version[$champ] = $this->getValeurParDefaut($champ); |
|
} |
} |
return $version; |
} |
|
public function getValeurParDefaut($champ) { |
$valeur = ''; |
if ('date_prod' == $champ) { |
$valeur = date('Y-m-d'); |
} |
return $valeur; |
} |
|
/** |
* Lance l'ajout d'un traitement |
*/ |
public function demanderTraitement() { |
$this->ajouterTraitement($this->referentiel, self::SCRIPT_A_LANCER); |
if ($this->verifierMetadonnees()) { |
$this->ajouterTraitement($this->referentiel, self::SCRIPT_A_LANCER); |
} |
$this->afficherInterface(); |
} |
|
/** |
* Vérifie les données du formulaire |
*/ |
public function verifierMetadonnees() { |
$ok = true; |
$ok = ($this->verifierChampsObligatoires()) ? true : false; |
return $ok; |
} |
|
public function verifierChampsObligatoires() { |
$ok = true; |
$champs_obligatoires = array('titre' => 'Titre', |
'acronyme' => 'Acronyme', |
'version' => 'Version', |
'auteur_principal' => 'Auteur Principal', |
'coordinateur' => 'coordinateur', |
'contact' => 'Courriel de contact', |
'dom_tax' => 'Domaine taxonomique', |
'dom_geo' => 'Domaine géographique', |
'dom_code' => 'Codes botaniques utilisés', |
'referencement' => 'Comment citer ce référentiel?'); |
foreach ($champs_obligatoires as $champ_id => $champ_nom) { |
if (!isset($_POST[$champ_id]) || empty($_POST[$champ_id])) { |
$this->addMessage("Le champ '$champ_nom' doit être obligatoirement rempli."); |
$ok = false; |
} |
} |
return $ok; |
} |
} |
?> |