Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 416 Rev 861
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
-
 
3
 
2
/**
4
/**
3
* PHP Version 5
5
* PHP Version 5
4
*
6
*
5
* @category  PHP
7
* @category  PHP
6
* @package   papyrus_bp
8
* @package   papyrus_bp
Line 9... Line 11...
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
* @version   SVN: <svn_id>
12
* @version   SVN: <svn_id>
11
* @link      /doc/papyrus_bp/
13
* @link      /doc/papyrus_bp/
12
*/
14
*/
Line 13... Line -...
13
 
-
 
14
Class Resume extends DBAccessor {
15
 
15
 
16
/**
16
	function Resume($config) {
17
 * Classe renvoyant un petit bout de html contenant les dernières obs publiques d'un utilisateur
17
 
-
 
18
        $this->config=$config;
18
 * 
-
 
19
 */
Line 19... Line 20...
19
    }
20
class Resume extends Cel {
Line 20... Line -...
20
 
-
 
21
	function getElement($uid){
-
 
22
 
21
 
23
		$DB=$this->connectDB($this->config,'cel_db');
22
	function getElement($uid){
24
 
-
 
25
        $query = 'SELECT * FROM cel_inventory'.
-
 
26
        		' WHERE identifiant = "'.$uid[1].'"'.
-
 
27
        		/*' AND ordre IN (SELECT coi_ce_observation
23
 
28
								FROM cel_obs_images
24
        $requete_dernieres_obs = 'SELECT * FROM cel_obs'.
Line -... Line 25...
-
 
25
        		' WHERE ce_utilisateur = '.$uid[1].
-
 
26
				' AND transmission =  0'.
-
 
27
				' ORDER BY date_modification DESC LIMIT 0,5';
29
								WHERE coi_ce_utilisateur ="'.$uid[1].'" )'.*/
28
 
Line 30... Line 29...
30
				' AND transmission =  1'.
29
        $resultat_dernieres_obs = $this->requeter($requete_dernieres_obs);
31
				' ORDER BY date_modification DESC LIMIT 0,5';
30
        
32
 
31
        $dernieres_obs = array();
Line 33... Line -...
33
        $res =& $DB->query($query);
-
 
34
 
-
 
35
        if (DB::isError($res)) {
32
        $resume = array();
36
            die($res->getMessage());
33
 
Line 37... Line 34...
37
        }
34
        if (is_array($resultat_dernieres_obs)) {
38
 
35
            $dernieres_obs = $resultat_dernieres_obs;
39
        $resume = array();
36
        }
Line 40... Line 37...
40
 
37
 
41
        $resume['titre'] = 'Vos dernières observations publiées';
-
 
42
        $resume['lien_appli'] = '<a href="www.tela-botanica.org/appli:cel2"> Accéder au carnet en ligne </a>';
-
 
Line 43... Line -...
43
 
-
 
44
        if(!$res || $res->numRows() == 0) {
-
 
45
        	$resume['message'] = 'Aucune observation saisie pour le moment';
38
        $resume['titre'] = 'Vos dernières observations publiées';
Line 46... Line -...
46
        }
-
 
47
 
-
 
48
		while ($obs =& $res->fetchrow(DB_FETCHMODE_ASSOC)) {
-
 
49
 
-
 
50
           $chemin_sur_serveur = $this->config['cel_db']['url_images'];
-
 
51
 
39
        $resume['lien_appli'] = '<a href="www.tela-botanica.org/appli:cel2"> Accéder au carnet en ligne </a>';
52
           $req_liaison = 'SELECT * FROM cel_images WHERE ci_id_image IN (SELECT coi_ce_image FROM cel_obs_images WHERE coi_ce_observation = "'.$obs['ordre'].'") AND ci_ce_utilisateur = "'.$obs['identifiant'].'"' ;
40
 
Line 53... Line 41...
53
	   
41
        if (count($dernieres_obs) == 0) {
54
           $res_liaison =& $DB->query($req_liaison);
42
        	$resume['message'] = 'Aucune observation saisie pour le moment';
55
 
-
 
56
           if (DB::isError($res_liaison)) {
43
        }
-
 
44
 
57
                die($res_liaison->getMessage());
45
		foreach ($dernieres_obs as $obs) {
Line -... Line 46...
-
 
46
 
-
 
47
           	$chemin_sur_serveur = $this->config['cel_db']['url_images'];
58
            }
48
 
59
	    
49
		   	$date = 'Datée du '.$obs['date_modification'].'<br/>'  ;
60
 
50
		  	$lieu = 'Lieu : '.trim($obs['location'],'000null').' ('.trim($obs['id_location'],'000null').') '.trim($obs['station'],'000null').' '.trim($obs['lieudit'],'000null').'<br/>'  ;
Line 61... Line 51...
61
		    $date = 'Datée du '.$obs['date_modification'].'<br/>'  ;
51
 
Line 62... Line 52...
62
		    $lieu = 'Lieu : '.trim($obs['location'],'000null').' ('.trim($obs['id_location'],'000null').') '.trim($obs['station'],'000null').' '.trim($obs['lieudit'],'000null').'<br/>'  ;
52
			$image ='';
63
 
53
			$cible_lien = '';
64
			$image ='';
54
		    		
Line 65... Line 55...
65
			$cible_lien = '';
55
			$req_liaison = 'SELECT * FROM cel_images WHERE id_image IN (SELECT id_image FROM cel_obs_images WHERE id_observation = "'.$obs['id_observation'].'") AND ce_utilisateur = "'.$obs['ce_utilisateur'].'"' ;
Line 66... Line 56...
66
		
56
           	$res_liaison = $this->requeter($req_liaison);
67
			    		
57
 
Line 68... Line 58...
68
			$row = null;
58
			$ligne_image = null;
Line 69... Line 59...
69
 
59
			
Line 70... Line 60...
70
			while ($img =& $res_liaison->fetchrow(DB_FETCHMODE_ASSOC)) {
60
			foreach ($res_liaison as $img) {
71
				$row = $img;
61
				$row = $img;
Line 72... Line 62...
72
			}
62
			}
Line 73... Line 63...
73
 
63
 
74
			if($row != null) {
64
			if($row != null) {
Line 75... Line 65...
75
			
65
			
76
				$row['ci_nom_original'] = htmlspecialchars($row['ci_nom_original']);
66
				$row['nom_original'] = htmlspecialchars($row['nom_original']);
77
				   $row['ci_id_image'] = htmlspecialchars($row['ci_id_image']);
67
				$row['id_image'] = htmlspecialchars($row['id_image']);
Line 78... Line 68...
78
				   $id = $row['ci_id_image'];
68
				$id = $row['id_image'];
79
	
69