/trunk/widget/modules/stats/squelettes/filtres.tpl.html |
---|
1,10 → 1,14 |
<?php if (array_key_exists('taxon', $filtres) || array_key_exists('num_taxon', $filtres)) : ?> |
<p>Filtes actifs : |
<?php if (array_key_exists('taxon', $filtres) || array_key_exists('num_taxon', $filtres) || array_key_exists('tag', $filtres)) : ?> |
<h2>Filtes actifs</h2> |
<ul> |
<?php if (array_key_exists('taxon', $filtres)) : ?> |
nom du taxon=<?=$filtres['taxon']?> |
<li>nom du taxon=<?=$filtres['taxon']?></li> |
<?php endif; ?> |
<?php if (array_key_exists('num_taxon', $filtres)) : ?> |
numéro du taxon=<?=$filtres['num_taxon']?> |
<li>numéro du taxon=<?=$filtres['num_taxon']?></li> |
<?php endif; ?> |
</p> |
<?php if (array_key_exists('tag', $filtres)) : ?> |
<li>Mots-clés des images=<?=$filtres['tag']?></li> |
<?php endif; ?> |
</ul> |
<?php endif; ?> |
/trunk/widget/modules/stats/squelettes/liste_utilisateurs_nbre_photos.tpl.html |
---|
37,6 → 37,7 |
<h1>Liste des utilisateurs possédant le plus grand nombre de photographies publiques</h1> |
<div class="flottant-gauche"> |
<?php include('filtres.tpl.html') ?> |
<?php if (isset($utilisateurs)) : ?> |
<p>Classement / Utilisateur / Nombre de photographies</p> |
<ol> |
<?php foreach ($utilisateurs as $nomPrenom => $nbre) : ?> |
43,6 → 44,9 |
<li><?=$nomPrenom?> : <?=$nbre?></li> |
<?php endforeach; ?> |
</ol> |
<?php else : ?> |
<p>Aucun résultat ne correspond à vos filtres</p> |
<?php endif; ?> |
</div> |
<hr class="nettoyeur" /> |
<div class="flottant-gauche"> |
/trunk/widget/modules/stats/Stats.php |
---|
173,12 → 173,14 |
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 (isset($utilisateurs)) { |
$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; |
} |
} |
} |
$widget['donnees']['filtres'] = $this->parametres; |
190,25 → 192,27 |
// 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(); |
$this->getDao()->ajouterParametre('utilisateur', $this->getAuthIdentifiant()); |
} |
if (isset($this->parametres['num_taxon'])) { |
$parametres[] = 'num_taxon='.$this->parametres['num_taxon']; |
$this->getDao()->ajouterParametre('num_taxon', $this->parametres['num_taxon']); |
} |
if (isset($this->parametres['taxon'])) { |
$parametres[] = 'taxon='.$this->parametres['taxon']; |
$this->getDao()->ajouterParametre('taxon', $this->parametres['taxon']); |
} |
if (isset($this->parametres['start'])) { |
$parametres[] = 'start='.$this->parametres['start']; |
$this->getDao()->ajouterParametre('start', $this->parametres['start']); |
} |
if (isset($this->parametres['limit'])) { |
$parametres[] = 'limit='.$this->parametres['limit']; |
$this->getDao()->ajouterParametre('limit', $this->parametres['limit']); |
} |
$service .= (count($parametres) > 0) ? '?'.implode('&', $parametres) : ''; |
if (isset($this->parametres['tag'])) { |
$this->getDao()->ajouterParametre('tag', $this->parametres['tag']); |
} |
$url = sprintf($this->config['chemins']['baseURLServicesCelTpl'], $service); |
$json = $this->getDao()->consulter($url); |
return (array) json_decode($json); |
} |
/trunk/jrest/services/CelStatistiqueTxt.php |
---|
47,17 → 47,22 |
$this->parametres['utilisateur'] = isset($_GET['utilisateur']) ? $this->bdd->quote($this->verifierSecuriteParametreUrl($_GET['utilisateur'])) : null; |
$this->parametres['num_taxon'] = isset($_GET['num_taxon']) ? $this->bdd->quote($this->verifierSecuriteParametreUrl($_GET['num_taxon'])) : null; |
$this->parametres['taxon'] = isset($_GET['taxon']) ? $this->bdd->quote($this->verifierSecuriteParametreUrl($_GET['taxon'].'%')) : null; |
$this->parametres['tag'] = isset($_GET['tag']) ? $this->verifierSecuriteParametreUrl($_GET['tag']) : null; |
$this->parametres['start'] = isset($_GET['start']) ? $this->verifierSecuriteParametreUrl($_GET['start']) : null; |
$this->parametres['limit'] = isset($_GET['limit']) ? $this->verifierSecuriteParametreUrl($_GET['limit']) : null; |
} |
private function getListeUtilisateursNbrePhotos() { |
$liste = array(); |
$requete = $this->construireRequeteListeUtilisateurNbrePhoto(); |
$resultats = $this->executerRequete($requete); |
$liste = array(); |
if ($resultats != false) { |
foreach ($resultats as $resultat) { |
$liste[$resultat['identifiant']] = $resultat['nbre']; |
if ($requete != null) { |
$resultats = $this->executerRequete($requete); |
if ($resultats != false) { |
foreach ($resultats as $resultat) { |
$liste[$resultat['identifiant']] = $resultat['nbre']; |
} |
} |
} |
return $liste; |
73,7 → 78,7 |
$orderBy = 'ORDER BY nbre DESC '; |
$limitSql = 'LIMIT 0,150 '; |
$zero_images = false; |
if (count($this->parametres) != 0) { |
extract($this->parametres); |
88,6 → 93,14 |
if (isset($taxon)) { |
$filtres[] = "nom_ret LIKE $taxon "; |
} |
if (isset($tag)) { |
$limitation = $this->construireWhereTags(); |
if ($limitation != null) { |
$filtres[] = $limitation; |
} else { |
$zero_images = true; |
} |
} |
$where .= ((count($filtres) > 0) ? 'AND '.implode(' AND ', $filtres) : ''); |
if (isset($start)) { |
97,12 → 110,42 |
$limitSql = str_replace('150', $limit, $limitSql); |
} |
} |
$requete = $select.$from.$where.$groupBy.$orderBy.$limitSql; |
if ($zero_images) { |
$requete = null; |
} else { |
$requete = $select.$from.$where.$groupBy.$orderBy.$limitSql; |
//echo $requete; |
} |
return $requete; |
} |
private function construireWhereTags() { |
$where = null; |
if (isset($this->parametres['tag'])) { |
$tag = $this->parametres['tag']; |
$tag_encode = $this->bdd->quote($this->encoderMotCle(trim($tag))); |
// Construction de la requête |
$requete = 'SELECT cmc_id_mot_cle_utilisateur, cmc_id_proprietaire '. |
'FROM cel_mots_cles_images '. |
"WHERE cmc_id_mot_cle_general = $tag_encode "; |
$elements = $this->executerRequete($requete); |
if ($elements != false && count($elements) > 0) { |
// Pré-construction du where de la requête |
$tpl_where = '(ci_meta_mots_cles LIKE "%%%s%%" AND ci_ce_utilisateur = %s )'; |
$requete_where = array(); |
foreach ($elements as $occurence) { |
$requete_where[] = sprintf($tpl_where, $occurence['cmc_id_mot_cle_utilisateur'], $this->bdd->quote($occurence['cmc_id_proprietaire'])); |
} |
$where = ' ('.implode(" \nOR ", $requete_where).') '; |
} else { |
$this->debug[] = "Aucune image ne correspond à ce mot clé."; |
} |
} |
return $where; |
} |
private function getListeTaxonsNbrePhotos() { |
$requete = $this->construireRequeteListeTaxonNbrePhoto(); |
$resultats = $this->executerRequete($requete); |