Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
19 linda 1
<?
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: eflore_photo_soum.inc.php,v 1.1 2004-08-17 11:16:46 linda Exp $
23
/**
24
* Titre
25
*
26
* Description
27
*
28
*@package nom_du_paquetage
29
*@subpackage nom_du_sous-paquetage_si_necessaire
30
//Auteur original :
31
*@author        linda ANGAMA<linda_angama@yahoo.fr>
32
//Autres auteurs :
33
*@author        Aucun
34
*@copyright     Tela-Botanica 2000-2004
35
*@version       $Revision: 1.1 $ $Date: 2004-08-17 11:16:46 $
36
// +------------------------------------------------------------------------------------------------------+
37
*/
38
 
39
$res='';
40
 
41
GEN_stockerStyleExterne('form_soum', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/form_soum.css');
42
GEN_stockerFichierScript('eflore_soum', GEN_CHEMIN_CLIENT.'eflore/presentations/scripts/eflore_soum.inc.js');
43
 
44
//connexion a la base
45
 if (DB::isError($GLOBALS['db_eflore'])){
46
        echo "<ERREUR>";
47
        echo "Impossible d'&eacutetablir de connexion ",$GLOBALS['db_eflore']->getMessage();
48
        echo "</ERREUR>";
49
        exit;
50
    }
51
 
52
$id_photo='';
53
$correct='';
54
 
55
 
56
//creation du formulaire
57
$form =& new HTML_QuickForm('soumission', 'post',EFLORE_CHEMIN_APPLI.'&onglet=photo&soum=1&fic=1','','enctype="multipart/form-data"');
58
if (isset($_POST['form_valider'])){
59
    $id=SQL_obtenirNouveauId($GLOBALS['db_eflore'], 'eflore_info_image', 'eii_id_image');
60
    if($form->validate() && verifDate() && verifLicence() && verifSelection0() && verifSelection1() && verifAuteur() && verifFlore() && copyFile($id) && $_POST['NATURE']> -1){
61
        $form->process(insertionImg());
62
    }
63
    else{
64
        if (!verifDate()){
65
            $form->addElement('html','<span class="erreur">'.ERR_VALID_DATE.'</span>');
66
        }
67
        if (!verifLicence()){
68
            $form->addElement('html','<span class="erreur">'.ERR_CHOIX_LICENCE.'</span>');
69
        }
70
        if (!verifSelection0()){
71
            $form->addElement('html','<span class="erreur">'.ERR_CHOIX_FICHIER.'</span>');
72
        }
73
        if (!verifSelection1()){
74
            $form->addElement('html','<span class="erreur">'.ERR_CHOIX_URL.'</span>');
75
        }
76
        if (!verifAuteur()){
77
            $form->addElement('html','<span class="erreur">'.ERR_CHOIX_AUTEUR.'</span>');
78
        }
79
        if (!verifFlore()){
80
            $form->addElement('html','<span class="erreur">'.ERR_CHOIX_FLORE.'</span>');
81
        }
82
        if (!copyFile($id)){
83
            $form->addElement('html','<span class="erreur">'.ERR_CHOIX_FICHIER_JPEG.'</span>');
84
        }
85
        if ($_POST['NATURE']<=-1){
86
            $form->addElement('html','<span class="erreur">'.ERR_NATURE_REQ.'</span>');
87
        }
88
    }
89
}
90
$tab_index = 1000;
91
$default_value_array=array('EN_ID_NOM' => selectNom(), 'EIO_AUTRE_FLORE' => -1,'autre_flore' =>'', 'UPLOADED_FILE' => NULL, 'EII_LIEN_VERS_IMG' => 'http://',
92
                            'EII_AUTEUR_IMG'=>'', 'EIO_AUTRE_AUTEUR_DETERMINATION'=>'', 'NATURE' => -1, 'EIS_LIEUDIT' => '',
93
                            'EIO_DATE_OBSERVATION[AN]'=>'','LICENCE[EII_CE_LICENCE_IMG_COM]' =>false, 'LICENCE[EII_CE_LICENCE_IMG_MOD]' =>false,
94
                            'LICENCE[EII_CE_LICENCE_IMG_AUCUN]' =>false,'SUJET' => -1,'DEVELOPPEMENT' => -1, 'EII_DESCRIPTION_IMG' => '');
95
$default_value_array['EIO_DATE_OBSERVATION']['date_1']['d']=0;
96
$default_value_array['EIO_DATE_OBSERVATION']['date_1']['F']=0;
97
 
98
construireForm(&$form,&$tab_index,$default_value_array);
99
//ajout des règles de validation
100
$form->addRule('loc',ERR_CHOIX_FICHIER,'callback','verifSelection0');
101
$form->addRule('loc',ERR_CHOIX_URL,'callback','verifSelection1');
102
$form->addRule(array('EIS_LIEUDIT'),ERR_CHOIX_LIEU,'required','','client');
103
$form->addRule(array('NATURE'),'','required','','client');
104
$form->addRule('LICENCE',ERR_CHOIX_LICENCE,'licence');
105
$form->addGroupRule('LICENCE', ERR_CHOIX_LICENCE_REQ, 'required', null, 1, 'client', true);
106
$rule_date['AN'][]=array(ERR_CHOIX_ANNEE_REQ, 'required', null, 'client');
107
$rule_date['AN'][]=array(ERR_CHOIX_ANNEE_NUM,'numeric',null,'client');
108
$rule_date['AN'][]=array(ERR_CHOIX_ANNEE_LONG,'minlength',4,'client');
109
$rule_date['AN'][]=array(ERR_CHOIX_ANNEE_LONG,'maxlength',4,'client');
110
$rule_date['AN'][]=array(ERR_VALID_JOUR_MOIS,'date_val','','client');
111
$form->addGroupRule('EIO_DATE_OBSERVATION',$rule_date);
112
 
113
//ajout des boutons et fermeture du formulaire
114
$liste_bouton_debut = '<ul class="liste">'."\n";
115
$form->addElement('html', $liste_bouton_debut);
116
$asso_array=array('tabindex'=>$tab_index++);
117
$form->addElement('submit','form_valider',FORM_VALIDER,$asso_array);
118
$liste_bouton_fin = '</ul>'."\n";
119
$form->addElement('html', $liste_bouton_fin);
120
$res.=$form->toHTML()."\n";
121
$form_fin =& new HTML_QuickForm('bouton_quitter', 'post',EFLORE_CHEMIN_APPLI.'&onglet=photo');
122
$asso_array=array('tabindex'=>$tab_index++);
123
$form_fin->addElement('submit','form_quit',FORM_QUIT,$asso_array);
124
$res.=$form_fin->toHTML()."\n";
125
 
126
$res.='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo">'.AFF_MINI.'</a>';
127
 
128
 
129
 
130
 
131
?>