Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 719 Rev 790
Line 380... Line 380...
380
	protected function creerAuteur($courriel, $pourAdmin = false) {
380
	protected function creerAuteur($courriel, $pourAdmin = false) {
381
		$auteur = ($pourAdmin) ? $courriel : $this->tronquerCourriel($courriel);
381
		$auteur = ($pourAdmin) ? $courriel : $this->tronquerCourriel($courriel);
382
		return $auteur;
382
		return $auteur;
383
	}
383
	}
Line -... Line 384...
-
 
384
	
-
 
385
	protected function creerAuteurs(array $courriels, $pourAdmin = false) {
-
 
386
		$auteurs = ($pourAdmin) ? $courriels : $this->recupererUtilisateursNomPrenom($courriels);
-
 
387
		return $auteurs;
-
 
388
	}
-
 
389
	
-
 
390
	protected function recupererUtilisateursNomPrenom(array $courriels) {
-
 
391
		// Récupération des données au format Json
-
 
392
		$service = "utilisateur/prenom-nom-par-courriel/".implode(',', $courriels);
-
 
393
		$url = sprintf($this->config['settings']['baseURLServicesAnnuaireTpl'], $service);
-
 
394
		$json = file_get_contents($url);
-
 
395
		$utilisateurs = json_decode($json);
-
 
396
		foreach ($courriels as $courriel) {
-
 
397
			if (isset($utilisateurs->$courriel)) {
-
 
398
				$noms[$courriel] = $utilisateurs->$courriel->prenom.' '.$utilisateurs->$courriel->nom;
-
 
399
			} else {
-
 
400
				$noms[$courriel] = $this->tronquerCourriel($courriel);
-
 
401
			}	
-
 
402
		}	
-
 
403
		return $noms;
-
 
404
	}
384
	
405
	
385
	protected function tronquerCourriel($courriel) {
406
	protected function tronquerCourriel($courriel) {
386
		$courriel = preg_replace('/[^@]+$/i', '...', $courriel);
407
		$courriel = preg_replace('/[^@]+$/i', '...', $courriel);
387
		return $courriel;
408
		return $courriel;