Subversion Repositories eFlore/Applications.cel

Rev

Rev 3241 | Rev 3282 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3241 Rev 3281
Line 46... Line 46...
46
		$this->bar = ( isset( $bar ) ) ? $bar : false;
46
		$this->bar = ( isset( $bar ) ) ? $bar : false;
Line 47... Line 47...
47
 
47
 
Line 48... Line 48...
48
		$framework = dirname( __FILE__ ) . '/framework.php';
48
		$framework = dirname( __FILE__ ) . '/framework.php';
49
 
-
 
50
		if ( !file_exists( $framework ) ) {
49
 
51
 
50
		if ( !file_exists( $framework ) ) {
52
			$e = 'Veuillez paramêtrer l\'emplacement et la version du Framework dans le fichier $framework';
51
			$e = 'Veuillez paramêtrer l\'emplacement et la version du Framework dans le fichier $framework';
53
			trigger_error( $e, E_USER_ERROR );
-
 
54
		} else {
52
			trigger_error( $e, E_USER_ERROR );
55
 
53
		} else {
56
			// Inclusion du Framework
54
			// Inclusion du Framework
57
			require_once $framework;
55
			require_once $framework;
58
			// Ajout d'information concernant cette application
56
			// Ajout d'information concernant cette application
59
			Framework::setCheminAppli( __FILE__ );// Obligatoire
57
			Framework::setCheminAppli( __FILE__ );// Obligatoire
Line 60... Line 58...
60
			Framework::setInfoAppli( Config::get( 'info' ) );// Optionnel
58
			Framework::setInfoAppli( Config::get( 'info' ) );// Optionnel
61
		}
-
 
62
 
59
		}
63
		if ( !isset( $mode ) ) {
60
 
Line 64... Line 61...
64
 
61
		if ( !isset( $mode ) ) {
Line 65... Line 62...
65
			$mode = self::SERVICE_DEFAUT;
62
			$mode = self::SERVICE_DEFAUT;
66
		}
-
 
67
 
63
		}
68
		$this->cel_url_tpl = $this->config['manager']['celUrlTpl'];
64
 
Line 69... Line 65...
69
 
65
		$this->cel_url_tpl = $this->config['manager']['celUrlTpl'];
70
		if ( $_POST !== array() ) { //print_r($_POST);
-
 
71
 
66
 
72
			$this->parametres['projet'] = $_POST['projet'];
67
		if ( $_POST !== array() ) { //print_r($_POST);
73
			$this->parametres['langue'] = $_POST['langue'];
68
			$this->parametres['projet'] = $_POST['projet'];
74
 
-
 
75
			if ( $mode === 'modification' ) {
69
			$this->parametres['langue'] = $_POST['langue'];
76
 
70
 
77
				$parametres = $this->traiterParametresModif();
71
			if ( $mode === 'modification' ) {
78
				$json       = $this->getDao()->modifier( $this->cel_url_tpl, $parametres );
72
				$parametres = $this->traiterParametresModif();
79
			} else {
73
				$json       = $this->getDao()->modifier( $this->cel_url_tpl, $parametres );
80
 
74
			} else {
Line 81... Line 75...
81
				$donnees = array_merge( $_POST, $this->traiterDonneesFiles() );
75
				$donnees = array_merge( $_POST, $this->traiterDonneesFiles() );
82
				// var_dump($donnees);
76
				// var_dump($donnees);
83
				$json  = $this->getDao()->ajouter( $this->cel_url_tpl, $donnees );
-
 
84
				$mode  = $this->parametres['mode'] = 'modification';
77
				$json  = $this->getDao()->ajouter( $this->cel_url_tpl, $donnees );
85
			}
78
				$mode  = $this->parametres['mode'] = 'modification';
Line 86... Line 79...
86
		}
79
			}
87
 
80
		}
Line 99... Line 92...
99
			$this->messages[] = 'La ressource demandée a retourné une valeur nulle.';
92
			$this->messages[] = 'La ressource demandée a retourné une valeur nulle.';
Line 100... Line 93...
100
 
93
 
Line 101... Line 94...
101
		} else {
94
		} else {
102
 
-
 
103
			if ( isset( $retour['donnees'] ) ) {
95
 
104
 
96
			if ( isset( $retour['donnees'] ) ) {
105
				$retour['donnees']['params']   = '&projet=' . $_POST['projet'] . '&langue=' . $_POST['langue'];
97
				$retour['donnees']['params']   = '&projet=' . $_POST['projet'] . '&langue=' . $_POST['langue'];
106
				$retour['donnees']['prod']     = ( $this->config['parametres']['modeServeur'] === 'prod' );
98
				$retour['donnees']['prod']     = ( $this->config['parametres']['modeServeur'] === 'prod' );
Line 122... Line 114...
122
		$params = array();
114
		$params = array();
123
		$retour['squelette'] = 'manager';
115
		$retour['squelette'] = 'manager';
Line 124... Line 116...
124
 
116
 
125
		foreach ( $this->parametres_autorises as $id => $pa ) {
117
		foreach ( $this->parametres_autorises as $id => $pa ) {
126
			if ( isset( $this->parametres[$pa] ) ) {
-
 
127
 
118
			if ( isset( $this->parametres[$pa] ) ) {
128
				$params[] = $pa . '=' . $this->parametres[$pa];
119
				$params[] = $pa . '=' . $this->parametres[$pa];
129
			}
120
			}
Line 130... Line 121...
130
		}
121
		}
131
 
122
 
Line 132... Line 123...
132
		$param = implode( $params, '&' );
123
		$param = implode( $params, '&' );
133
		$url   = $this->cel_url_tpl;
-
 
134
 
124
		$url   = $this->cel_url_tpl;
135
		if ( $param !== '' ) {
125
 
Line 136... Line 126...
136
 
126
		if ( $param !== '' ) {
137
			$url .= '?' . $param;
127
			$url .= '?' . $param;
Line 152... Line 142...
152
		$retour['squelette']          = 'creation';
142
		$retour['squelette']          = 'creation';
153
		$retour['donnees']['langues'] = $tableaulangue['resultat'] ;
143
		$retour['donnees']['langues'] = $tableaulangue['resultat'] ;
154
		$retour['donnees']['widget']  = array();
144
		$retour['donnees']['widget']  = array();
Line 155... Line 145...
155
 
145
 
156
		if ( isset( $this->parametres['projet'] ) ) {
-
 
157
 
146
		if ( isset( $this->parametres['projet'] ) ) {
158
			$url     = $this->cel_url_tpl . '?projet=' . $this->parametres['projet'];
147
			$url     = $this->cel_url_tpl . '?projet=' . $this->parametres['projet'];
159
			$json    = $this->getDao()->consulter( $url );
148
			$json    = $this->getDao()->consulter( $url );
160
			$tableau = (array) json_decode( $json, true );
149
			$tableau = (array) json_decode( $json, true );
161
			$retour['donnees']['widget'] = $tableau[0];
150
			$retour['donnees']['widget'] = $tableau[0];
Line 189... Line 178...
189
 
178
 
190
		return $retour;
179
		return $retour;
191
	}
180
	}
192
	private function traiterParametres() {
181
	private function traiterParametres() {
193
		$parametres_flux = '?';
182
		$parametres_flux = '?';
Line 194... Line 183...
194
		$criteres        = array( 'utilisateur', 'commune', 'dept', 'taxon', 'commentaire', 'date', 'tag', 'motcle', 'projet', 'num_taxon', 'num_nom', 'referentiel', 'groupe_zones_geo' );
183
		$criteres        = array( 'projet', 'langue', 'titre' );
195
 
184
 
Line 196... Line 185...
196
		foreach( $this->parametres as $nom_critere => $valeur_critere ) {
185
		foreach( $this->parametres as $nom_critere => $valeur_critere ) {
Line 213... Line 202...
213
			if ($parametres !== '' ) {
202
			if ($parametres !== '' ) {
Line 214... Line 203...
214
 
203
 
215
				$parametres_modif[$id] = $parametres;
204
				$parametres_modif[$id] = $parametres;
216
			}
205
			}
217
		}
-
 
218
 
206
		}
219
		return $parametres_modif;
207
		return $parametres_modif;
Line 220... Line 208...
220
	}
208
	}
221
 
209