Subversion Repositories Applications.annuaire

Rev

Rev 382 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 382 Rev 426
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Service renvoyant un lien vers le profil d'un utilisateur sous la forme de son nom'
4
 * Service renvoyant un lien vers le profil d'un utilisateur sous la forme de son nom'
5
 *
5
 *
6
 * @category	php 5.2
6
 * @category	php 5.2
7
 * @package		Annuaire::Services
7
 * @package		Annuaire::Services
8
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
8
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
10
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
10
 * @copyright	Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
11
 * @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
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class MiniLienProfil extends JRestService {
15
class MiniLienProfil extends JRestService {
16
 
16
 
17
	public function getRessource(){
17
	public function getRessource(){
-
 
18
		if(!isset($_COOKIE['pap-annuaire_tela-utilisateur']) && isset($_COOKIE['pap-annuaire_tela-memo'])) {
-
 
19
			$_COOKIE['pap-annuaire_tela-utilisateur'] = $_COOKIE['pap-annuaire_tela-memo'];
-
 
20
		}
18
		
21
		
19
		if (isset($_COOKIE['pap-annuaire_tela-utilisateur'])) {
22
		if (isset($_COOKIE['pap-annuaire_tela-utilisateur'])) {
20
 
23
 
21
			$username = $_COOKIE['pap-annuaire_tela-utilisateur'];
24
			$username = $_COOKIE['pap-annuaire_tela-utilisateur'];
22
 
25
 
23
			$controleur = new AnnuaireControleur();
26
			$controleur = new AnnuaireControleur();
24
			$valeurs = $controleur->obtenirInfosUtilisateur('1', $username, true);
27
			$valeurs = $controleur->obtenirInfosUtilisateur('1', $username, true);
25
			
28
			
26
			$nom_affiche_lien = $valeurs['fullname'];
29
			$nom_affiche_lien = $valeurs['fullname'];
27
			
30
			
28
			$tableau_nom_prenom = split(" ", $nom_affiche_lien, 2);
31
			$tableau_nom_prenom = split(" ", $nom_affiche_lien, 2);
29
			
32
			
30
			if(strlen($nom_affiche_lien) > 20) {
33
			if(strlen($nom_affiche_lien) > 20) {
31
				$nom_affiche_lien = substr($nom_affiche_lien,0,20).'...';
34
				$nom_affiche_lien = substr($nom_affiche_lien,0,20).'...';
32
			}
35
			}
33
			
36
			
34
			$lien = 'Bienvenue <a href="http://www.tela-botanica.org/page:mon_inscription_au_reseau"> '.ucwords(strtolower($nom_affiche_lien)).'</a>';
37
			$lien = 'Bienvenue <a href="http://www.tela-botanica.org/page:mon_inscription_au_reseau"> '.ucwords(strtolower($nom_affiche_lien)).'</a>';
35
			echo json_encode($lien);
38
			echo json_encode($lien);
36
		} else  {
39
		} else  {
37
			$lien = '';
40
			$lien = '';
38
			echo json_encode($lien);
41
			echo json_encode($lien);
39
		}
42
		}
40
	}
43
	}
41
}
44
}
42
?>
45
?>