(root)/trunk/eflore_photo_modif.inc.php - Rev 26
Blame |
Last modification |
View Log
| RSS feed
<?
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* Titre
*
* Description
*
*@package nom_du_paquetage
*@subpackage nom_du_sous-paquetage_si_necessaire
//Auteur original :
*@author linda ANGAMA<linda_angama@yahoo.fr>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
$res='';
GEN_stockerStyleExterne
('form_soum', GEN_CHEMIN_CLIENT
.'eflore/presentations/styles/form_soum.css');
GEN_stockerFichierScript
('eflore_soum', GEN_CHEMIN_CLIENT
.'eflore/presentations/scripts/eflore_soum.inc.js');
//connexion a la base
if (DB
::isError($GLOBALS['db_eflore'])){
echo "<ERREUR>";
echo "Impossible d'établir de connexion ",$GLOBALS['db_eflore']->getMessage();
echo "</ERREUR>";
exit;
}
$id=$_GET['id'];
$correct='';
//creation du formulaire
$form =& new HTML_QuickForm
('modification', 'post',EFLORE_CHEMIN_APPLI
.'&onglet=photo&modif=1&id='.$id,'','enctype="multipart/form-data"');
$tab_index = 1000;
if (isset($_POST['form_effacer'])){
$form->process(supprImg
($_GET['id']));
$res.='<p class="plein_texte">'.SUPPRESSION_OK
.'</p>';
$form_quit =& new HTML_QuickForm
('modification02', 'post',EFLORE_CHEMIN_APPLI
.'&onglet=photo');
$asso_array=array('tabindex'=>$tab_index++);
$form_quit->addElement('submit','form_quit','quitter',$asso_array);
$res.=$form_quit->toHtml();
}
elseif (isset($_POST['form_valider']) && ($form->validate() && verifDate
() && verifLicence
() && verifAuteur
() && verifFlore
() && $_POST['NATURE']> -1)){
$b=0;
$trans_fic=true;
$form->process(majImage
($id,&$b,&$trans_fic));
if ($trans_fic==false){
$res.='<span class="erreur">'.ERR_CHARGEMENT_FIC
.'</span>';
}
$res.='<p class="plein_texte">'.NBRE_UPDATE
.$b.'</p>';
$form_update =& new HTML_QuickForm
('modification01', 'post',EFLORE_CHEMIN_APPLI
.'&onglet=photo&modif=1&id='.$id);
$asso_array=array('tabindex'=>$tab_index++);
$form_update->addElement('submit','form_update','autres_modifications',$asso_array);
$res.=$form_update->toHtml();
$form_quit =& new HTML_QuickForm
('modification02', 'post',EFLORE_CHEMIN_APPLI
.'&onglet=photo');
$asso_array=array('tabindex'=>$tab_index++);
$form_quit->addElement('submit','form_quit','quitter',$asso_array);
$res.=$form_quit->toHtml();
}
else{
if (isset($_POST['form_valider'])){
if (!verifDate
()){
$form->addElement('html','<span class="erreur">'.ERR_VALID_DATE
.'</span>');
}
if (!verifLicence
()){
$form->addElement('html','<span class="erreur">'.ERR_CHOIX_LICENCE
.'</span>');
}
if (!verifAuteur
()){
$form->addElement('html','<span class="erreur">'.ERR_CHOIX_AUTEUR
.'</span>');
}
if (!verifFlore
()){
$form->addElement('html','<span class="erreur">'.ERR_CHOIX_FLORE
.'</span>');
}
if ($_POST['NATURE']<= -1){
$form->addElement('html','<span class="erreur">'.ERR_NATURE_REQ
.'</span>');
}
}
construireForm
(&$form,&$tab_index,construireArray
($id),$_GET['modif']);
//ajout des règles de validation
//$form->addRule(array('EIS_LIEUDIT'),ERR_CHOIX_LIEU,'required','','client');
$form->addRule(array('NATURE'),'','required','','client');
$form->addRule('LICENCE',ERR_CHOIX_LICENCE
,'licence');
$form->addGroupRule('LICENCE', ERR_CHOIX_LICENCE_REQ
, 'required', null, 1, 'client', true);
$rule_date['AN'][]=array(ERR_CHOIX_ANNEE_REQ
, 'required', null, 'client');
$rule_date['AN'][]=array(ERR_CHOIX_ANNEE_NUM
,'numeric',null,'client');
$rule_date['AN'][]=array(ERR_CHOIX_ANNEE_LONG
,'minlength',4,'client');
$rule_date['AN'][]=array(ERR_CHOIX_ANNEE_LONG
,'maxlength',4,'client');
$rule_date['AN'][]=array(ERR_VALID_JOUR_MOIS
,'date_val','','client');
$form->addGroupRule('EIO_DATE_OBSERVATION',$rule_date);
//ajout des boutons et fermeture du formulaire
$liste_bouton_debut = '<ul class="liste">'."\n";
$form->addElement('html', $liste_bouton_debut);
$asso_array=array('tabindex'=>$tab_index++);
$form->addElement('submit','form_valider',FORM_MODIFIER
,$asso_array);
$asso_array=array('tabindex'=>$tab_index++);
$form->addElement('submit','form_effacer',FORM_SUPPRIMER
,$asso_array);
$liste_bouton_fin = '</ul>'."\n";
$form->addElement('html', $liste_bouton_fin);
$res.=$form->toHTML()."\n";
$res.='<a href="'.EFLORE_CHEMIN_APPLI
.'&onglet=photo">'.AFF_MINI
.'</a>';
}