Subversion Repositories eFlore/Applications.del

Compare Revisions

Regard whitespace Rev 1875 → Rev 1876

/trunk/widget/Widget.php
52,10 → 52,6
$url_morceaux = $this->parserUrl();
if (isset($url_morceaux[0])) {
$this->widget = $url_morceaux[0];
// hack car chez moi (mathias) je me retrouve avec $url_morceaux[0] = "delnomduwidget", pourtant j'ai le même .htaccess...
if (strpos($this->widget, ":") !== false) {
$this->widget = substr($this->widget, strpos($this->widget, ":") + 1);
}
self::$config['chemins']['widgetCourantDossier'] = self::$config['chemins']['widgetsDossier'].strtolower($this->widget).DIRECTORY_SEPARATOR;
$this->chargerWidgetConfig();
}
93,7 → 89,7
private function nettoyerGet() {
foreach ($_GET as $cle => $valeur) {
$verifier = array('NULL', "\n", "\r", "\\", "'", '"', "\x00", "\x1a", ';');
$verifier = array('NULL', "\n", "\r", "\\", '"', "\x00", "\x1a", ';');
$_GET[$cle] = strip_tags(str_replace($verifier, '', $valeur));
}
}
133,6 → 129,7
}
}
 
/**
* Execute le widget.
*/
147,8 → 144,6
$widget->executer();
}
}
} else {
echo "pas de module précisé";
}
}
162,5 → 157,4
self::$config = array_merge(self::$config, $widget_config);
}
}
}
?>
}
/trunk/widget/index.php
1,5 → 1,4
<?php
require 'Widget.php';
$widget = new Widget();
$widget->executer();
?>
$widget->executer();
/trunk/widget/widget.ini.defaut.php
23,7 → 23,7
; Dossier contenant les fichiers des bibliothèques tierces
bibliothequeDossier = "bibliotheque/"
; Base de l'url servant à appeler les widgets
baseURL = "/widget/"
baseURL = "/widget:del:"
; URL de base absolue des Widgets du CEL construit dynamiquement dans le fichier WidgetCommun.php
baseURLAbsoluDyn = ""
; URL des services web du CEL sous forme de template à utiliser avec sprintf
/trunk/widget/modules/vote/config.defaut.ini
1,5 → 1,24
[vote]
; URL de base des services web de DEL
baseURLServicesDelTpl = "http://localhost/del/services/0.1/"
; URL de base des services web de DEL (avec le / final)
baseURLServicesDelTpl = "http://api.tela-botanica.org/service:del:0.1/"
; Squelette d'Url permettant d'afficher une image du CEL (remplace %s par l'id de l'image sans underscore)
celImgUrlTpl = "http://api.tela-botanica.org/img:%s.jpg"
celImgUrlTpl = "http://api.tela-botanica.org/img:%s.jpg"
; Mapping entre les paramètres d'appel de ce widget et les paramètres d'appel du ws «observations» de DEL
mapping_masque = "
filtre = masque,
famille = masque.famille,
genre = masque.genre,
referentiel = masque.referentiel,
ns = masque.ns,
nn = masque.nn,
auteur = masque.auteur,
date-obs = masque.date,
commune = masque.commune,
dept = masque.departement,
tag-cel = masque.tag_cel,
sp = masque.espece,
depart = navigation.depart,
limite = navigation.limite,
tri = tri,
ordre = ordre,
type = masque.type"
/trunk/widget/modules/vote/bibliotheque/Cache.php
124,5 → 124,4
}
return $accessible;
}
}
?>
}
/trunk/widget/modules/vote/squelettes/vote.tpl.html
82,7 → 82,7
<li class="ui-li ui-li-static ui-body-c">
<div class="intitule_determination">
<div><?= $vote_determination['nom_sel']; ?></div>
<div class="auteur_determination">Proposé par : <?= $vote_determination['auteur.prenom']; ?> <?= $vote_determination['auteur.nom']; ?></div>
<div class="auteur_determination">Proposé par : <?= $vote_determination['auteur_intitule']; ?></div>
</div>
<div id="vote_determination_<?= $vote_determination['id_commentaire']; ?>" class="votes_determination">
<a href="#" class="bouton_vote bouton_vote_oui" data-role="button" data-mini="true" data-inline="true"> oui</a>
/trunk/widget/modules/vote/squelettes/vote_ajax.tpl.html
31,7 → 31,7
<li class="ui-li ui-li-static ui-body-c">
<div class="intitule_determination">
<div><?= $vote_determination['nom_sel']; ?></div>
<div class="auteur_determination">Proposé par : <?= $vote_determination['auteur.prenom']; ?> <?= $vote_determination['auteur.nom']; ?></div>
<div class="auteur_determination">Proposé par : <?= $vote_determination['auteur_intitule']; ?></div>
</div>
<div id="vote_determination_<?= $vote_determination['id_commentaire']; ?>" class="votes_determination">
<a href="#" class="bouton_vote bouton_vote_oui" data-role="button" data-mini="true" data-inline="true"> oui</a>
/trunk/widget/modules/vote/squelettes/aide.tpl.html
44,7 → 44,7
<!-- WIDGET:DEL:VOTE - DEBUT -->
<div data-role="page">
<div class="aide-contenu">
À rédiger !
</div>
<div data-role="footer" data-theme="b" data-position="fixed">
<div data-role="navbar" >
/trunk/widget/modules/vote/Vote.php
24,11 → 24,10
const DS = DIRECTORY_SEPARATOR;
const SERVICE_DEFAUT = 'photo';
 
private $ce_img_url_tpl = null;
private $del_url_service_tpl = null;
private $id_observation_suivant = null;
private $id_observation_precedent = null;
private $id_observation = null;
/**
72,15 → 71,16
}
private function convertirParametresEnChaineRequeteService() {
$requete = '';
$mapping = $this->config['mapping_masque'];
$parametresWs = array();
$mapping = $this->transformerEnTableau($this->config['vote']['mapping_masque']);
if(!empty($this->parametres)) {
foreach ($this->parametres as $parametre=>$valeur) {
if (isset($mapping[$parametre])) {
$requete .= '&'.$mapping[$parametre].'='.urlencode($valeur);
$parametresWs[] = $mapping[$parametre].'='.urlencode($valeur);
}
}
}
$requete = (!empty($parametresWs)) ? '?'.implode('&', $parametresWs) : '';
return $requete;
}
93,12 → 93,19
}
private function obtenirIdsObservation() {
$ids = json_decode(file_get_contents($this->del_url_service_tpl.'observations?retour.format=widget'.$this->convertirParametresEnChaineRequeteService()), true);
$url = $this->del_url_service_tpl.'observations'.$this->convertirParametresEnChaineRequeteService();
//exit('<pre>'.print_r($url, true).'</pre>');
$infos = json_decode(file_get_contents($url), true);
//exit('<pre>'.print_r($infos, true).'</pre>');
$ids = array();
foreach ($infos['resultats'] as $resultat) {
if($this->id_observation == null) {
$this->id_observation = $ids['resultats'][0];
$this->id_observation = $resultat['id_observation'];
}
return $ids['resultats'];
$ids[] = $resultat['id_observation'];
}
return $ids;
}
private function obtenirUrlBaseWidget() {
return $this->config['chemins']['baseURL'].'vote';
105,7 → 112,6
}
private function construireUrlsSuivantesEtPrecedentes($tableau_id_observation) {
$indices_id_obs = array_flip($tableau_id_observation);
$indice_obs_courante = $indices_id_obs[$this->id_observation];
$url_base = $this->obtenirUrlBaseWidget();
116,13 → 122,12
$url_suivant = isset($tableau_id_observation[$indice_obs_courante + 1]) ? $url_base.'?id_observation='.$tableau_id_observation[$indice_obs_courante + 1].$this->convertirParametresEnChaineRequete() : null;
$url_precedent = isset($tableau_id_observation[$indice_obs_courante - 1]) ? $url_base.'?id_observation='.$tableau_id_observation[$indice_obs_courante - 1].$this->convertirParametresEnChaineRequete() : null;
 
return array('url_suivant' => $url_suivant,
'url_precedent' => $url_precedent
);
return array('url_suivant' => $url_suivant, 'url_precedent' => $url_precedent);
}
private function obtenirDonnees($id_observation) {
$donnees = json_decode(file_get_contents($this->del_url_service_tpl.'observations/'.$id_observation), true);
//exit('<pre>'.print_r($donnees, true).'</pre>');
return $donnees;
}
137,14 → 142,11
private function formaterDeterminations($observation) {
$liste_determinations = $observation['commentaires'];
$liste_determinations_formatees = array();
$creerPropositionAPartirObservation = true;
foreach ($liste_determinations as $determination) {
$determination_formatee = $determination;
if($determination['nom_sel'] != null && $determination['nom_sel'] != '') {
$determination_formatee['votes'] = $this->formaterVotes($determination['votes']);
$liste_determinations_formatees[] = $determination_formatee;
$liste_determinations_formatees[] = $this->formaterDetermination($determination);
}
if($determination['nom_sel'] == $observation['determination.ns'] &&
160,23 → 162,47
return $liste_determinations_formatees;
}
private function formaterDetermination($infos) {
//exit('<pre>'.print_r($infos, true).'</pre>');
$determination = array(
"id_commentaire" => $infos['id_commentaire'],
"observation" => $infos['observation'],
"proposition" => $infos['proposition'],
"id_parent" => $infos['id_parent'],
"texte" => $infos['texte'],
"date" => $infos['date_observation'],
"nom_sel" => $infos['nom_sel'],
"auteur_intitule" => $this->formaterIntituleAuteur($infos),
"votes" => $this->formaterVotes($infos['votes'])
);
return $determination;
}
 
private function creerDeterminationAPartirObservation($observation) {
$proposition = array("id_commentaire" => "0",
$determination = array(
"id_commentaire" => "0",
"observation" => $observation['id_observation'],
"proposition" => "0",
"id_parent" => "0",
"auteur.id" => $observation['auteur.id'],
"texte" => null,
"auteur.nom" => $observation['auteur.nom'],
"auteur.prenom" => $observation['auteur.prenom'],
"auteur.courriel" => $observation['observateur'],
"date" => $observation['date_observation'],
"nom_sel" => $observation['determination.ns'],
"auteur_intitule" => $this->formaterIntituleAuteur($observation),
"votes" => array('oui' => 0, 'non' => 0)
);
return $determination;
}
return $proposition;
private function formaterIntituleAuteur($donnees) {
$intitule = 'Anonyme';
// TODO : si auteur.id existe, appelé le WS de l'annuaire...
if (!empty($donnees['auteur.prenom']) && !empty($donnees['auteur.nom'])) {
$intitule = $donnees['auteur.prenom'].' '.$donnees['auteur.nom'];
} else if (!empty($donnees['auteur.courriel'])) {
$intitule = strstr($donnees['auteur.courriel'], '@').'@...';
}
return $intitule;
}
private function formaterVotes($liste_votes) {
$liste_votes_formates = array('oui' => 0, 'non' => 0);
187,7 → 213,6
$liste_votes_formates['non']++;
}
}
return $liste_votes_formates;
}
201,8 → 226,6
}
}
}
return $tableau_js;
}
}
?>
}
/trunk/widget/modules/statistiques/StatistiquesOld.php
File deleted
\ No newline at end of file
/trunk/widget/modules/statistiques/Statistiques.php
105,5 → 105,4
 
return (array) json_decode($json);
}
}
?>
}