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: eflore_photo_soum.inc.php,v 1.1 2004-08-17 11:16:46 linda Exp $/*** 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: 1.1 $ $Date: 2004-08-17 11:16:46 $// +------------------------------------------------------------------------------------------------------+*/$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 baseif (DB::isError($GLOBALS['db_eflore'])){echo "<ERREUR>";echo "Impossible d'établir de connexion ",$GLOBALS['db_eflore']->getMessage();echo "</ERREUR>";exit;}$id_photo='';$correct='';//creation du formulaire$form =& new HTML_QuickForm('soumission', 'post',EFLORE_CHEMIN_APPLI.'&onglet=photo&soum=1&fic=1','','enctype="multipart/form-data"');if (isset($_POST['form_valider'])){$id=SQL_obtenirNouveauId($GLOBALS['db_eflore'], 'eflore_info_image', 'eii_id_image');if($form->validate() && verifDate() && verifLicence() && verifSelection0() && verifSelection1() && verifAuteur() && verifFlore() && copyFile($id) && $_POST['NATURE']> -1){$form->process(insertionImg());}else{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 (!verifSelection0()){$form->addElement('html','<span class="erreur">'.ERR_CHOIX_FICHIER.'</span>');}if (!verifSelection1()){$form->addElement('html','<span class="erreur">'.ERR_CHOIX_URL.'</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 (!copyFile($id)){$form->addElement('html','<span class="erreur">'.ERR_CHOIX_FICHIER_JPEG.'</span>');}if ($_POST['NATURE']<=-1){$form->addElement('html','<span class="erreur">'.ERR_NATURE_REQ.'</span>');}}}$tab_index = 1000;$default_value_array=array('EN_ID_NOM' => selectNom(), 'EIO_AUTRE_FLORE' => -1,'autre_flore' =>'', 'UPLOADED_FILE' => NULL, 'EII_LIEN_VERS_IMG' => 'http://','EII_AUTEUR_IMG'=>'', 'EIO_AUTRE_AUTEUR_DETERMINATION'=>'', 'NATURE' => -1, 'EIS_LIEUDIT' => '','EIO_DATE_OBSERVATION[AN]'=>'','LICENCE[EII_CE_LICENCE_IMG_COM]' =>false, 'LICENCE[EII_CE_LICENCE_IMG_MOD]' =>false,'LICENCE[EII_CE_LICENCE_IMG_AUCUN]' =>false,'SUJET' => -1,'DEVELOPPEMENT' => -1, 'EII_DESCRIPTION_IMG' => '');$default_value_array['EIO_DATE_OBSERVATION']['date_1']['d']=0;$default_value_array['EIO_DATE_OBSERVATION']['date_1']['F']=0;construireForm(&$form,&$tab_index,$default_value_array);//ajout des règles de validation$form->addRule('loc',ERR_CHOIX_FICHIER,'callback','verifSelection0');$form->addRule('loc',ERR_CHOIX_URL,'callback','verifSelection1');$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_VALIDER,$asso_array);$liste_bouton_fin = '</ul>'."\n";$form->addElement('html', $liste_bouton_fin);$res.=$form->toHTML()."\n";$form_fin =& new HTML_QuickForm('bouton_quitter', 'post',EFLORE_CHEMIN_APPLI.'&onglet=photo');$asso_array=array('tabindex'=>$tab_index++);$form_fin->addElement('submit','form_quit',FORM_QUIT,$asso_array);$res.=$form_fin->toHTML()."\n";$res.='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo">'.AFF_MINI.'</a>';?>