48,9 → 48,11 |
$framework = dirname( __FILE__ ) . '/framework.php'; |
|
if ( !file_exists( $framework ) ) { |
|
$e = 'Veuillez paramĂȘtrer l\'emplacement et la version du Framework dans le fichier $framework'; |
trigger_error( $e, E_USER_ERROR ); |
} else { |
|
// Inclusion du Framework |
require_once $framework; |
// Ajout d'information concernant cette application |
59,6 → 61,7 |
} |
|
if ( !isset( $mode ) ) { |
|
$mode = self::SERVICE_DEFAUT; |
} |
|
65,13 → 68,16 |
$this->cel_url_tpl = $this->config['manager']['celUrlTpl']; |
|
if ( $_POST !== array() ) { //print_r($_POST); |
|
$this->parametres['projet'] = $_POST['projet']; |
$this->parametres['langue'] = $_POST['langue']; |
|
if ( $mode === 'modification' ) { |
|
$parametres = $this->traiterParametresModif(); |
$json = $this->getDao()->modifier( $this->cel_url_tpl, $parametres ); |
} else { |
|
$donnees = array_merge( $_POST, $this->traiterDonneesFiles() ); |
// var_dump($donnees); |
$json = $this->getDao()->ajouter( $this->cel_url_tpl, $donnees ); |
81,6 → 87,7 |
|
$methode = $this->traiterNomMethodeExecuter( $mode ); |
if ( method_exists( $this, $methode ) ) { |
|
$retour = $this->$methode(); |
} else { |
|
94,6 → 101,7 |
} else { |
|
if ( isset( $retour['donnees'] ) ) { |
|
$retour['donnees']['params'] = '&projet=' . $_POST['projet'] . '&langue=' . $_POST['langue']; |
$retour['donnees']['prod'] = ( $this->config['parametres']['modeServeur'] === 'prod' ); |
$retour['donnees']['bar'] = $this->bar; |
116,6 → 124,7 |
|
foreach ( $this->parametres_autorises as $id => $pa ) { |
if ( isset( $this->parametres[$pa] ) ) { |
|
$params[] = $pa . '=' . $this->parametres[$pa]; |
} |
} |
124,6 → 133,7 |
$url = $this->cel_url_tpl; |
|
if ( $param !== '' ) { |
|
$url .= '?' . $param; |
} |
|
144,6 → 154,7 |
$retour['donnees']['widget'] = array(); |
|
if ( isset( $this->parametres['projet'] ) ) { |
|
$url = $this->cel_url_tpl . '?projet=' . $this->parametres['projet']; |
$json = $this->getDao()->consulter( $url ); |
$tableau = (array) json_decode( $json, true ); |
180,7 → 191,7 |
} |
private function traiterParametres() { |
$parametres_flux = '?'; |
$criteres = array( 'projet', 'langue', 'titre' ); |
$criteres = array( 'utilisateur', 'commune', 'dept', 'taxon', 'commentaire', 'date', 'tag', 'motcle', 'projet', 'num_taxon', 'num_nom', 'referentiel', 'groupe_zones_geo' ); |
|
foreach( $this->parametres as $nom_critere => $valeur_critere ) { |
if ( in_array( $nom_critere, $criteres ) ) { |
204,6 → 215,7 |
$parametres_modif[$id] = $parametres; |
} |
} |
|
return $parametres_modif; |
} |
|