Subversion Repositories Applications.annuaire

Rev

Rev 382 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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