Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 522 Rev 523
Line 26... Line 26...
26
	public function getElement($param = array()) {
26
	public function getElement($param = array()) {
27
		// Initialisation des variables
27
		// Initialisation des variables
28
		$info = array();
28
		$info = array();
29
		$contenu = '';
29
		$contenu = '';
Line 30... Line 30...
30
		
30
		
31
		if ($this->authentifier()) {
31
		if (! $this->etreFluxAdmin() || $this->authentifier()) {
32
			// Pré traitement des paramêtres
32
			// Pré traitement des paramêtres
33
			$pour_bdd = false;
33
			$pour_bdd = false;
34
			$p = $this->traiterParametres(array('service', 'format'), $param, $pour_bdd);
34
			$p = $this->traiterParametres(array('service', 'format'), $param, $pour_bdd);
35
			unset($param[0]);
35
			unset($param[0]);
Line 213... Line 213...
213
		$item['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
213
		$item['date_maj_ATOM'] = date(DATE_ATOM, $date_modification_timestamp);
214
		$item['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
214
		$item['date_maj_W3C'] = date(DATE_W3C, $date_modification_timestamp);
215
		$item['titre'] = $this->creerTitre($info);
215
		$item['titre'] = $this->creerTitre($info);
216
		$item['guid'] = $this->creerGuidItem($info);
216
		$item['guid'] = $this->creerGuidItem($info);
217
		$item['lien'] = $this->creerLienItem($info);
217
		$item['lien'] = $this->creerLienItem($info);
218
		$item['description'] = $this->creerDescription($info);
218
		$item['description'] = $this->creerDescription($info, $item);
219
		$item['description_encodee'] = htmlspecialchars($item['description']);
219
		$item['description_encodee'] = htmlspecialchars($item['description']);
220
		return $item;
220
		return $item;
221
	}
221
	}
Line 222... Line 222...
222
	
222
	
Line 231... Line 231...
231
		$titre = $this->$methode($element);
231
		$titre = $this->$methode($element);
232
		$titre = $this->nettoyerTexte($titre);
232
		$titre = $this->nettoyerTexte($titre);
233
		return $titre;
233
		return $titre;
234
	}
234
	}
Line 235... Line 235...
235
	
235
	
236
	private function creerDescription($element) {
236
	private function creerDescription($donnees, $item) {
237
		$methode = 'creerDescription'.$this->service;
237
		$methode = 'creerDescription'.$this->service;
238
		$methode = (method_exists($this, $methode)) ? $methode : 'creerDescriptionSimple';
238
		$methode = (method_exists($this, $methode)) ? $methode : 'creerDescriptionSimple';
239
		$description = $this->$methode($element);
239
		$description = $this->$methode($donnees, $item);
240
		$description = $this->nettoyerTexte($description);
240
		$description = $this->nettoyerTexte($description);
241
		return $description;
241
		return $description;
Line 242... Line 242...
242
	}
242
	}
Line 276... Line 276...
276
	private function creerTitreSimple($element) {
276
	private function creerTitreSimple($element) {
277
		$titre = $element['nom_sel'].' [nn'.$element['num_nom_sel'].'] par '.$this->creerAuteur($element['identifiant'], $this->etreFluxAdmin());
277
		$titre = $element['nom_sel'].' [nn'.$element['num_nom_sel'].'] par '.$this->creerAuteur($element['identifiant'], $this->etreFluxAdmin());
278
		return $titre;
278
		return $titre;
279
	}
279
	}
Line 280... Line 280...
280
	
280
	
281
	private function creerDescriptionSimple($element) {
281
	private function creerDescriptionSimple($donnees, $item) {
282
		$description = sprintf($this->config['settings']['efloreUrlTpl'], urlencode($element['num_nom_sel']));
282
		$description = sprintf($this->config['settings']['efloreUrlTpl'], urlencode($donnees['num_nom_sel']));
283
		return $description;
283
		return $description;
Line 284... Line 284...
284
	}
284
	}
285
	
285
	
286
	private function getServiceComplet($params) {
286
	private function getServiceComplet($params) {
287
		// Construction de la requête
287
		// Construction de la requête
288
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' ci.*, ci_id_image, ci_nom_original, ci_meta_date_ajout '.
288
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' ci.*, ci_id_image, ci_nom_original, ci_meta_date_ajout, ci_meta_user_comment, ci_note_image '.
289
			'FROM cel_obs_images AS coi '.
289
			'FROM cel_obs_images AS coi '.
290
			'LEFT JOIN cel_inventory AS ci '.
290
			'LEFT JOIN cel_inventory AS ci '.
291
				'ON (coi.coi_ce_observation = ci.ordre AND coi.coi_ce_utilisateur = ci.identifiant) '.
291
				'ON (coi.coi_ce_observation = ci.ordre AND coi.coi_ce_utilisateur = ci.identifiant) '.
Line 301... Line 301...
301
		// Création du contenu
301
		// Création du contenu
302
		$contenu = $this->executerService($elements);
302
		$contenu = $this->executerService($elements);
303
		return $contenu;
303
		return $contenu;
304
	}
304
	}
Line 305... Line 305...
305
 
305
 
306
	private function creerDescriptionComplet($element) {
306
	private function creerDescriptionComplet($donnees, $item) {
307
		$url_img = $this->getUrlImage($element['ci_id_image'], 'M');
307
		$url_img = $this->getUrlImage($donnees['ci_id_image'], 'M');
308
		$description .= '<style>.champ{color:grey} ul{margin:10px 20px;} img{margin:10px;}}</style>';
308
		$description .= '<style>.champ{color:grey} img{float:left;padding:0 20px 0 0;}</style>';
309
		$description .= '<img src="'.$url_img.'" alt="'.$element['ci_nom_original'].'" />';
309
		$description .= '<img src="'.$url_img.'" alt="'.$donnees['ci_nom_original'].'" />';
310
		$description .= '<ul>';
310
		$description .= '<ul>';
311
		$description .= '<li>'."Image liée à l'observation ".$element['id'].'</li>';
311
		$description .= '<li>'."Image liée à l'observation ".$donnees['id'].'</li>';
312
		$description .= '<li>'.'<span class="champ">Importée le :</span> '.$element['ci_meta_date_ajout'].'</li>';
312
		$description .= '<li>'.'<span class="champ">Importée le :</span> '.$item['date_maj_simple'].'</li>';
-
 
313
		$description .= '<li>'.'<span class="champ">Nom du fichier :</span> '.$donnees['ci_nom_original'].'</li>';
-
 
314
		$description .= '<li>'.'<span class="champ">Note qualité image :</span> '.($donnees['ci_note_image'] +1).'/5</li>';
-
 
315
		// TODO :traiter le problème du champ commentaire.
-
 
316
		//$description .= '<li>'.'<span class="champ">Commentaire :</span> '.$donnees['ci_meta_user_comment'].'</li>';
313
		$description .= '<li>'.'<span class="champ">Nom du fichier :</span> '.$element['ci_nom_original'].'</li>';
317
		
314
		$description .= '<li>'.'<span class="champ">Nom saisi :</span> '.$element['nom_sel'].'</li>';
318
		$description .= '<li>'.'<span class="champ">Nom saisi :</span> '.$donnees['nom_sel'].'</li>';
315
		$description .= '<li>'.'<span class="champ">Nom retenu :</span> '.$element['nom_ret'].'</li>';
319
		$description .= '<li>'.'<span class="champ">Nom retenu :</span> '.$donnees['nom_ret'].'</li>';
316
		$description .= '<li>'.'<span class="champ">Observée le :</span> '.$element['date_observation'].'</li>';
320
		$description .= '<li>'.'<span class="champ">Observée le :</span> '.strftime('%A %d %B %Y', strtotime($donnees['date_observation'])).'</li>';
317
		$description .= '<li>'.'<span class="champ">Lieu :</span> '.$element['location'].' ('.$element['id_location'].') '.$element['station'].' '.$element['lieudit'].'</li>';
321
		$description .= '<li>'.'<span class="champ">Lieu :</span> '.$donnees['location'].' ('.$donnees['id_location'].') '.$donnees['station'].' '.$donnees['lieudit'].'</li>';
318
		$description .= '</ul>';
322
		$description .= '</ul>';
319
		$description = $this->nettoyerTexte($description);
323
		$description = $this->nettoyerTexte($description);
320
		return $description;
324
		return $description;
321
	}
325
	}
322
}	
326
}