Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 699 → Rev 700

/trunk/widget/modules/stats/Stats.php
11,9 → 11,12
* @copyright © 2010, Jean-Pascal MILCENT
*/
class Stats extends WidgetCommun {
const PAGE_DEFAUT = 'defaut';
const MODE_DEFAUT = 'defaut';
const MODE_UTILISATEUR = 'utilisateur';
private $page;
private $mode;
const SERVICE_DEFAUT = 'defaut';
/**
* Méthode appelée avec une requête de type GET.
*/
21,11 → 24,10
$retour = null;
extract($this->parametres);
if (!isset($mode)) {
$mode = self::SERVICE_DEFAUT;
}
 
$methode = $this->traiterNomMethodeExecuter($mode);
$this->mode = (isset($mode)) ? $mode : self::MODE_DEFAUT;
$this->page = (isset($page)) ? $page : self::PAGE_DEFAUT;
$methode = $this->traiterNomMethodeExecuter($this->page);
if (method_exists($this, $methode)) {
$retour = $this->$methode();
} else {
47,20 → 49,59
*/
public function executerDefaut() {
$widget = null;
$widget['donnees'] = (array) $this->recupererStatsTxtNombres();
$widget['donnees']['url_service'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], 'CelStatistique');
$widget['squelette'] = 'stats';
if ($this->mode == self::MODE_DEFAUT) {
$widget['donnees'] = (array) $this->recupererStatsTxtNombres();
$widget['donnees']['url_service'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], 'CelStatistique');
$widget['squelette'] = 'stats';
} else if ($this->mode == self::MODE_UTILISATEUR) {
if ($this->authentifierUtilisateur()) {
$widget['donnees'] = (array) $this->recupererStatsTxtNombres();
$widget['donnees']['url_service'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], 'CelStatistique');
$widget['donnees']['utilisateur'] = $this->getAuthIdentifiant();
$widget['donnees']['utilisateur_nom_prenom'] = $this->recupererPrenomNomIdentifie();
$widget['squelette'] = 'stats_utilisateur';
}
} else {
$this->messages[] = "Le mode '{$this->mode}' est inconnu.";
}
return $widget;
}
public function executerUtilisateur() {
private function recupererPrenomNomIdentifie() {
$nom = '';
if ($this->getAuthIdentifiant() != null) {
$infos_utilisateur = $this->recupererUtilisateursNomPrenom(array($this->getAuthIdentifiant()));
if (array_key_exists($this->getAuthIdentifiant(), $infos_utilisateur)) {
$utilisateur = (array) $infos_utilisateur[$this->getAuthIdentifiant()];
$nom = $utilisateur['prenom'].' '.$utilisateur['nom'];
} else {
$nom = $this->getAuthIdentifiant();
}
}
return $nom;
}
public function executerNombres() {
$widget = null;
if ($this->authentifierUtilisateur()) {
$widget['donnees'] = (array) $this->recupererStatsTxtNombres();
$widget['donnees']['url_service'] = sprintf($this->config['chemins']['baseURLServicesCelTpl'], 'CelStatistique');
$widget['donnees']['utilisateur'] = $this->getAuthIdentifiant();
$widget['squelette'] = 'stats_utilisateur';
if ($this->mode == self::MODE_DEFAUT) {
$widget['donnees'] = $this->recupererStatsTxtNombres();
} else if ($this->mode == self::MODE_UTILISATEUR) {
if ($this->authentifierUtilisateur()) {
$widget['donnees'] = $this->recupererStatsTxtNombres();
$widget['donnees']['utilisateur_nom_prenom'] = $this->recupererPrenomNomIdentifie();
}
} else {
$this->messages[] = "Le mode '{$this->mode}' est inconnu.";
}
if (!is_null($widget)) {
$widget['squelette'] = 'stats_nbres';
if (array_key_exists('taxon', $this->parametres)) {
$widget['donnees']['taxon'] = trim($this->parametres['taxon'], "'");
}
}
return $widget;
}
69,16 → 110,110
$service = "CelStatistiqueTxt/Nombres";
$parametres = array();
if (isset($this->parametres['mode']) && $this->parametres['mode'] == 'utilisateur' && $this->getAuthIdentifiant() != null) {
if (isset($this->parametres['mode']) && $this->parametres['mode'] == self::MODE_UTILISATEUR && $this->getAuthIdentifiant() != null) {
$parametres[] = 'utilisateur='.$this->getAuthIdentifiant();
}
if (isset($this->parametres['num_taxon'])) {
$parametres[] = 'num_taxon='.$this->parametres['num_taxon'];
}
if (isset($this->parametres['taxon'])) {
$parametres[] = 'taxon='.$this->parametres['taxon'];
}
$service .= (count($parametres) > 0) ? '?'.implode('&', $parametres) : '';
$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service);
$json = $this->getDao()->envoyerRequeteConsultation($url);
return json_decode($json);
$json = $this->getDao()->consulter($url);
return (array) json_decode($json);
}
public function executerListeTaxonsNbrePhotos() {
$widget = null;
$widget['donnees']['taxons'] = $this->recupererStatsTxtListeTaxonsNbrePhotos();
$widget['donnees']['utilisateur'] = $this->getAuthIdentifiant();
if (array_key_exists('taxon', $this->parametres)) {
$widget['donnees']['taxon'] = trim($this->parametres['taxon'], "'");
}
$widget['squelette'] = 'liste_taxons_nbre_photos';
return $widget;
}
private function recupererStatsTxtListeTaxonsNbrePhotos() {
// Récupération des données au format Json
$service = "CelStatistiqueTxt/ListeTaxonsNbrePhotos";
$parametres = array();
if (isset($this->parametres['mode']) && $this->parametres['mode'] == self::MODE_UTILISATEUR && $this->getAuthIdentifiant() != null) {
$parametres[] = 'utilisateur='.$this->getAuthIdentifiant();
}
if (isset($this->parametres['num_taxon'])) {
$parametres[] = 'num_taxon='.$this->parametres['num_taxon'];
}
if (isset($this->parametres['taxon'])) {
$parametres[] = 'taxon='.$this->parametres['taxon'];
}
if (isset($this->parametres['start'])) {
$parametres[] = 'start='.$this->parametres['start'];
}
if (isset($this->parametres['limit'])) {
$parametres[] = 'limit='.$this->parametres['limit'];
}
$service .= (count($parametres) > 0) ? '?'.implode('&', $parametres) : '';
$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service);
$json = $this->getDao()->consulter($url);
return (array) json_decode($json);
}
public function executerListeUtilisateursNbrePhotos() {
$widget = null;
$utilisateurs = $this->recupererStatsTxtListeUtilisateursNbrePhotos();
$noms = $this->recupererUtilisateursNomPrenom(array_keys($utilisateurs));
foreach ($utilisateurs as $courriel => $infos) {
if (array_key_exists($courriel, $noms)) {
$nom_infos = (array) $noms[$courriel];
$nom_fmt = $nom_infos['prenom'].' '.$nom_infos['nom'];
$widget['donnees']['utilisateurs'][$nom_fmt] = $infos;
}
}
if (array_key_exists('taxon', $this->parametres)) {
$widget['donnees']['taxon'] = trim($this->parametres['taxon'], "'");
}
$widget['squelette'] = 'liste_utilisateurs_nbre_photos';
return $widget;
}
private function recupererStatsTxtListeUtilisateursNbrePhotos() {
// Récupération des données au format Json
$service = "CelStatistiqueTxt/ListeUtilisateursNbrePhotos";
$parametres = array();
if (isset($this->parametres['mode']) && $this->parametres['mode'] == self::MODE_UTILISATEUR && $this->getAuthIdentifiant() != null) {
$parametres[] = 'utilisateur='.$this->getAuthIdentifiant();
}
if (isset($this->parametres['num_taxon'])) {
$parametres[] = 'num_taxon='.$this->parametres['num_taxon'];
}
if (isset($this->parametres['taxon'])) {
$parametres[] = 'taxon='.$this->parametres['taxon'];
}
if (isset($this->parametres['start'])) {
$parametres[] = 'start='.$this->parametres['start'];
}
if (isset($this->parametres['limit'])) {
$parametres[] = 'limit='.$this->parametres['limit'];
}
$service .= (count($parametres) > 0) ? '?'.implode('&', $parametres) : '';
$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service);
$json = $this->getDao()->consulter($url);
return (array) json_decode($json);
}
private function recupererUtilisateursNomPrenom($courriels) {
// Récupération des données au format Json
$service = "utilisateur/prenom-nom-par-courriel/".implode(',', $courriels);
$url = sprintf($this->config['chemins']['baseURLServicesAnnuaireTpl'], $service);
$json = $this->getDao()->consulter($url);
return (array) json_decode($json);
}
}
/trunk/widget/modules/stats/squelettes/stats_nbre.tpl.html
File deleted
\ No newline at end of file
/trunk/widget/modules/stats/squelettes/stats_nbres.tpl.html
New file
0,0 → 1,48
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Content-style-type" content="text/css" />
<meta http-equiv="Content-script-type" content="text/javascript" />
<meta http-equiv="Content-language" content="fr" />
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Statistiques, CEL, Tela Botanica, graphiques" />
<meta name="description" content="Graphiques et statistiques sur les observations et images du Carnet en Ligne (CEL)" />
<title>Statistiques du Carnet En Ligne</title>
<style>
img{display:block;margin:0.5em;border:1px solid black;}
hr.nettoyeur {clear:both;width:0;}
.flottant-gauche img{float:left;}
</style>
<!-- Stats : Google Analytics -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20092557-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
//]]>
</script>
</head>
<body>
<?php $i=0;?>
<h1>Statistiques du CEL <?=(isset($utilisateur_nom_prenom) ? '- '.$utilisateur_nom_prenom : '')?> <?=(isset($taxon) ? '- '.$taxon : '')?></h1>
<?php include('filtres.tpl.html') ?>
<div class="flottant-gauche">
<?php include('nbres.tpl.html')?>
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/trunk/widget/modules/stats/squelettes/filtres.tpl.html
New file
0,0 → 1,3
<?php if (isset($taxon)) : ?>
<p>Filtes actifs : taxon=<?=$taxon?></p>
<?php endif; ?>
/trunk/widget/modules/stats/squelettes/stats_utilisateur.tpl.html
35,9 → 35,9
</head>
<body>
<?php $i=0;?>
<h1>Statistiques du CEL de <?=$utilisateur?></h1>
<h1>Statistiques du CEL de <?=$utilisateur_nom_prenom?></h1>
<div class="flottant-gauche">
<?php include('stats_nbre.tpl.html')?>
<?php include('nbres.tpl.html')?>
</div>
<div class="flottant-gauche">
<h2>Observations - Activité</h2>
71,5 → 71,8
<img src="<?=$url_service?>/EvolImgLieesParMois?serveur=<?=$i++?>&amp;utilisateur=<?=$utilisateur?>" alt="Évolutions des images liées aux observations par mois" />
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/trunk/widget/modules/stats/squelettes/nbres.tpl.html
New file
0,0 → 1,10
<h2>Nombres</h2>
<ul>
<li>Nombre d'observations publiques / total : <strong><?=number_format($observationsPubliques, 0, ',', ' ')?></strong> / <strong><?=number_format($observations, 0, ',', ' ')?></strong></li>
<li>Nombre d'images : <strong><?=number_format($images, 0, ',', ' ')?></strong></li>
<li>Nombre d'images liées aux observations : <strong><?=number_format($imagesLiees, 0, ',', ' ')?></strong></li>
<li>Nombre d'observations liées aux images : <strong><?=number_format($observationsLiees, 0, ',', ' ')?></strong></li>
<li>Moyenne images par observation : <strong><?=number_format($moyImagesParObs, 2, ',', ' ')?></strong></li>
<li title="Hors observations géoréférencées mais non liées à une commune.">Nombre de communes possédant des observations : <strong><?=number_format($communes, 0, ',', ' ')?></strong></li>
<li>Nombre d'observations par communes (mini / moyenne / maxi) : <strong><?=number_format($observationsParCommunesMin, 0, ',', ' ')?></strong> / <strong><?=number_format($observationsParCommunesMoyenne, 2, ',', ' ')?></strong> / <strong><?=number_format($observationsParCommunesMax, 0, ',', ' ')?></strong></li>
</ul>
/trunk/widget/modules/stats/squelettes/liste_taxons_nbre_photos.tpl.html
New file
0,0 → 1,52
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Content-style-type" content="text/css" />
<meta http-equiv="Content-script-type" content="text/javascript" />
<meta http-equiv="Content-language" content="fr" />
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Statistiques, CEL, Tela Botanica, photo, liste, taxon" />
<meta name="description" content="Liste des taxons possédant le plus grand nombre de photographies publiques dans le Carnet en Ligne (CEL)" />
<title>Liste des taxons possédant le plus grand nombre de photographies publiques</title>
<style>
img{display:block;margin:0.5em;border:1px solid black;}
hr.nettoyeur {clear:both;width:0;}
.flottant-gauche img{float:left;}
</style>
<!-- Stats : Google Analytics -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20092557-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
//]]>
</script>
</head>
<body>
<h1>Liste des taxons possédant le plus grand nombre de photographies publiques</h1>
<div class="flottant-gauche">
<?php include('filtres.tpl.html') ?>
<p>Classement / Nom retenu du taxon / Nombre de photographies</p>
<ol>
<?php foreach ($taxons as $taxon => $nbre) : ?>
<li><?=$taxon?> : <?=$nbre?></li>
<?php endforeach; ?>
</ol>
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/trunk/widget/modules/stats/squelettes/stats.tpl.html
36,8 → 36,9
<body>
<?php $i=0;?>
<h1>Statistiques du CEL</h1>
<?php include('filtres.tpl.html') ?>
<div class="flottant-gauche">
<?php include('stats_nbre.tpl.html')?>
<?php include('nbres.tpl.html') ?>
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
79,5 → 80,8
<img src="<?=$url_service?>/EvolImgLieesParMois?serveur=<?=$i++?>" alt="Évolutions des images liées aux observations par mois" />
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/trunk/widget/modules/stats/squelettes/liste_utilisateurs_nbre_photos.tpl.html
New file
0,0 → 1,52
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Content-style-type" content="text/css" />
<meta http-equiv="Content-script-type" content="text/javascript" />
<meta http-equiv="Content-language" content="fr" />
<meta name="revisit-after" content="15 days" />
<meta name="robots" content="index,follow" />
<meta name="author" content="Jean-Pascal MILCENT" />
<meta name="keywords" content="Statistiques, CEL, Tela Botanica, photo, liste, utilisateurs" />
<meta name="description" content="Liste des utilisateurs possédant le plus grand nombre de photographies publiques dans le Carnet en Ligne (CEL)" />
<title>Liste des utilisateurs possédant le plus grand nombre de photographies publiques</title>
<style>
img{display:block;margin:0.5em;border:1px solid black;}
hr.nettoyeur {clear:both;width:0;}
.flottant-gauche img{float:left;}
</style>
<!-- Stats : Google Analytics -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20092557-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
//]]>
</script>
</head>
<body>
<h1>Liste des utilisateurs possédant le plus grand nombre de photographies publiques</h1>
<div class="flottant-gauche">
<?php include('filtres.tpl.html') ?>
<p>Classement / Utilisateur / Nombre de photographies</p>
<ol>
<?php foreach ($utilisateurs as $nomPrenom => $nbre) : ?>
<li><?=$nomPrenom?> : <?=$nbre?></li>
<?php endforeach; ?>
</ol>
</div>
<hr class="nettoyeur" />
<div class="flottant-gauche">
<?php include('navigation.tpl.html') ?>
</div>
</body>
</html>
/trunk/widget/modules/stats/squelettes/navigation.tpl.html
New file
0,0 → 1,6
<ul>
<li><a href="/widget:cel:stats">Stats globales</a> (<a href="/widget:cel:stats?mode=<?=Stats::MODE_UTILISATEUR?>">les miennes</a>)</li>
<li><a href="/widget:cel:stats?page=nombres">Nombres</a> (<a href="/widget:cel:stats?page=nombres&mode=<?=Stats::MODE_UTILISATEUR?>">les miens</a>)</li>
<li><a href="/widget:cel:stats?page=liste-utilisateurs-nbre-photos">Liste des utilisateurs ayant le plus de photographies publiques</a></li>
<li><a href="/widget:cel:stats?page=liste-taxons-nbre-photos">Liste des taxons ayant le plus de photographies publiques</a></li>
</ul>