Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1840 Rev 1845
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// declare(encoding='UTF-8');
2
/**
3
/**
3
 * Web service retournant toutes les infos d'une observation donnée :
4
 * Web service retournant toutes les infos d'une observation donnée :
4
 * images, votes sur image et protocole, commentaires, votes sur commentaires, ...
5
 * images, votes sur image et protocole, commentaires, votes sur commentaires, ...
5
 *
6
 *
6
 * @category	DEL
7
 * @category   DEL
-
 
8
 * @package    Services
7
 * @package		Observations
9
 * @subpackage Observations
8
 * @version		0.1
10
 * @version    0.1
9
 * @author		Raphaël Droz <raphael@tela-botanica.org>
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
10
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
11
 * @copyright	Copyright (c) 2013, Tela Botanica (accueil@tela-botanica.org)
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
12
 * @license		GPL v3 <http://www.gnu.org/licenses/gpl.txt>
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
13
 * @license		CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
15
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
14
 * @see			http://www.tela-botanica.org/wikini/eflore/wakka.php?wiki=ApiIdentiplante01Observations
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
15
 *
-
 
16
 * @config-depend: "url_image" (dans configurations/config_observations.ini) ex: http://www.tela-botanica.org/appli:cel-img:%09dXL.jpg
-
 
17
 */
17
 */
18
 
-
 
19
// http://localhost/del/services/0.1/observations/#id => une observation donnée et ses images, SANS LES propositions & nombre de commentaire
-
 
20
 
-
 
21
require_once(dirname(__FILE__) . '/../DelTk.php');
-
 
22
 
-
 
23
class ObservationDetails {
18
class ObservationDetails {
Line 24... Line 19...
24
 
19
 
25
	private $conteneur;
20
	private $conteneur;
26
	private $bdd;
21
	private $bdd;
27
	private $sql;
22
	private $sql;
28
	private $idObs;
23
	private $idObs;
29
	private $protocole;
24
	private $protocole;
30
	private $observation;
25
	private $observation;
31
	private $mappings = array();
26
	private $mappings = array();
32
	
27
 
33
	public function __construct(Conteneur $conteneur) {
28
	public function __construct(Conteneur $conteneur) {
34
		$this->conteneur = $conteneur;
29
		$this->conteneur = $conteneur;
35
		$this->bdd = $this->conteneur->getBdd();
30
		$this->bdd = $this->conteneur->getBdd();
Line 108... Line 103...
108
		foreach ($infos as $info) {
103
		foreach ($infos as $info) {
109
			$image = array_intersect_key($info, array_flip(array('id_image', 'date', 'hauteur' , 'largeur', 'nom_original')));
104
			$image = array_intersect_key($info, array_flip(array('id_image', 'date', 'hauteur' , 'largeur', 'nom_original')));
110
			$image['binaire.href'] = sprintf($urlImgTpl, $image['id_image'], $imageFormat);
105
			$image['binaire.href'] = sprintf($urlImgTpl, $image['id_image'], $imageFormat);
111
			unset($info['id_image'], $info['date'], $info['hauteur'], $info['largeur'], $info['nom_original']);
106
			unset($info['id_image'], $info['date'], $info['hauteur'], $info['largeur'], $info['nom_original']);
Line 112... Line 107...
112
 
107
 
-
 
108
			if (!isset($this->observation)) {
-
 
109
				$this->observation = $info;
113
			if (!isset($this->observation)) $this->observation = $info;
110
			}
114
			$this->observation['images'][$image['id_image']] = $image;
111
			$this->observation['images'][$image['id_image']] = $image;
115
		}
112
		}
Line 116... Line 113...
116
	}
113
	}