Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1427 → Rev 1428

/branches/v5.10-vilmorin/modules/mobile/Mobile.php
New file
0,0 → 1,100
<?php
// declare(encoding='UTF-8');
/**
* Classe mère du module Mobile.
*
* @category PHP 5.2
* @package eflore-consultation
* @author Isabelle NEMBROT
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
* @copyright 2015 Tela-Botanica
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
* @version $Id$
*/
class Mobile extends aControleur {
 
private $parametres = array();
private $conteneur = null;
private $num_nom = 0;
private $nom_courant = null;
private $nom_retenu = '';
private $url;
 
public function initialiser() {
$this->capturerParametres();
$this->conteneur = new Conteneur($this->parametres);
$this->url = $this->conteneur->getAppUrls();
$this->nomCourant = $this->conteneur->getNomCourant();
$this->nom_retenu = $this->conteneur->getNomCourant()->getNomRetenu();
spl_autoload_register(array($this, 'chargerClassesSources'));
}
 
private function chargerClassesSources($classe) {
$base = dirname(__FILE__).DS;
$cheminSources = $base.'sources'.DS;
$dossiers = array($base, $cheminSources);
foreach ($dossiers as $chemin) {
$fichierATester = $chemin.$classe.'.php';
if (file_exists($fichierATester)) {
include_once $fichierATester;
return null;
}
}
}
 
private function capturerParametres() {
$this->parametres['num_nom'] = isset($_GET['num_nom']) ? $_GET['num_nom'] : '';
$this->parametres['nom'] = isset($_GET['nom']) ? $_GET['nom'] : '';
$this->parametres['type_nom'] = isset($_GET['type_nom']) ? $_GET['type_nom'] : 'nom_scientifique';
 
$referentiel = isset($_GET['referentiel']) ? $_GET['referentiel'] : '';
Registre::set('parametres.referentiel', $referentiel);
$this->parametres['referentiel'] = $referentiel;
 
$niveau = isset($_GET['niveau']) ? $_GET['niveau'] : '1';
Registre::set('parametres.niveau', $niveau);
}
 
public function executerActionParDefaut() {
$this->executerFiche();
}
 
public function executerFiche(){
$donnees = $this->parametres;
$donnees['nom_retenu'] = $this->nom_retenu->get('nom_sci').' '.$this->nom_retenu->get('auteur');
$donnees['famille'] = $this->nom_retenu->getTaxonSupRang('180');
$donnees = array_merge($this->obtenirDonnees(), $donnees);
$donnees['url_absolue'] = "http://".$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];
$donnees['url_logos'] = "modules/mobile/presentations/logos/";
$donnees['lien'] = $this->url->obtenirUrlMobile($this->parametres['num_nom']);
$donnees['lien_fiche'] = $this->url->obtenirUrlFiche($this->parametres['num_nom']);
$tpl_edition = Config::get('smartFloreEditionFormulaireUrlTpl');
$url_edition = sprintf($tpl_edition, strtoupper($this->parametres['referentiel']), $this->nom_retenu->get('num_taxonomique'));
$donnees['lien_edition'] = $url_edition;
 
$this->setSortie(self::RENDU_CORPS, $this->getVue('smartflore', $donnees), true);
}
 
public function obtenirDonnees() {
$donnees = array();
$num_nom = $this->nomCourant->getNns();
$referentiel = $this->conteneur->getParametre('referentiel');
 
$taxons = new Taxons($this->conteneur);
$donnees['permalien_num_nom'] = $taxons->getUrlPermalienNumNom($referentiel, 1, $num_nom);
 
$sources = array('illustrations', 'texte', 'nomsCommuns');
foreach ($sources as $source) {
$nom_classe = ucfirst($source);
$classe = new $nom_classe($this->conteneur);
$donnees[$source] = $classe->getDonnees();
}
 
return $donnees;
}
}
?>
/branches/v5.10-vilmorin/modules/mobile/presentations/js/mobile.js
New file
0,0 → 1,36
$(document).ready(function() {
// Activation du carousel d'images
$('#smartflore-illustrations-galerie-carousel').carousel();
// Pour que les sources s'affichent dans une nouvelle fenêtre
$('#smartflore-footer-button-sources').click(function() {
voirSources();
});
// Pas sur que window.innerWidth puisse jamais être indéfini mais on ne sait jamais
if(!!window.innerWidth) {
var largeurFenetre = window.innerWidth;
// Tablettes / écran moyens, On met du L
if(largeurFenetre > 500 && largeurFenetre < 1000) {
adapterTailleImages('L');
} else {
// Plus de 1000 px, XL est bien plus agréable
if(largeurFenetre >= 1000) {
adapterTailleImages('XL');
}
}
}
function voirSources() {
var w = window.open();
var html = $("#smartflore-sources").html();
$(w.document.body).html(html);
}
function adapterTailleImages(taille) {
$('#smartflore-illustrations-galerie-carousel img').each(function(index) {
var src = $(this).attr('src');
$(this).attr('src', src.replace('S', taille));
});
}
});
/branches/v5.10-vilmorin/modules/mobile/presentations/icones/altitude.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v5.10-vilmorin/modules/mobile/presentations/icones/altitude.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/presentations/icones/zoom.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v5.10-vilmorin/modules/mobile/presentations/icones/zoom.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/presentations/logos/tela.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v5.10-vilmorin/modules/mobile/presentations/logos/tela.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/presentations/logos/logo-msjs.jpg
Cannot display: file marked as a binary type.
svn:mime-type = image/jpeg
/branches/v5.10-vilmorin/modules/mobile/presentations/logos/logo-msjs.jpg
New file
Property changes:
Added: svn:mime-type
+image/jpeg
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/presentations/logos/tela_transparent.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/branches/v5.10-vilmorin/modules/mobile/presentations/logos/tela_transparent.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/presentations/logos/logo-fondation-nd.jpg
Cannot display: file marked as a binary type.
svn:mime-type = image/jpeg
/branches/v5.10-vilmorin/modules/mobile/presentations/logos/logo-fondation-nd.jpg
New file
Property changes:
Added: svn:mime-type
+image/jpeg
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/presentations/less/gentiana.less
New file
0,0 → 1,155
@import "functions.less";
 
.couleur1-bg { background: @orange; }
.couleur2-bg { background: @vert-moyen; }
.bordered { border: 1px solid @vert-fonce; }
 
.accordion {
h4 {
margin-left: -1em;
}
}
.accordion-group {
margin: 0pt;
}
.accordion-heading {
padding-left: 1em;
}
.btn-large {
padding: 10px;
font-size: 17px;
}
 
body {
color: black;
background: white;
}
 
header {
.couleur2-bg;
color: white;
#tela {
background: url("../logos/tela_transparent.png") no-repeat 2px 6px;
}
.titre {
font-style: italic;
font-size: 130%;
font-weight: bold;
.shadow(@orange);
}
}
.gradient-bas {
@top: left top;
@bottom: left bottom;
.gradient(@vert-moyen, @top, white, @bottom);
}
 
footer {
display: none;
}
 
 
.sci {
font-style: italic;
}
 
#principal {
margin-bottom: -1em;
padding-left: 0.5em;
a:hover {
text-decoration: none;
}
h4 {
font-size: 17px;
color: @orange;
.shadow(white, 2px, 1px, 1px);
}
}
 
#canvas_fleur, #canvas_fruit {
width: 100%;
}
#floraison_value, #fructification_value {
display: none;
}
 
 
.wrapper {
@square: 120px;
width: @square;
height: @square;
.margin-center;
overflow: hidden;
img {
height: @square;
width: auto;
}
ul {
margin: 0pt;
}
}
 
.wrapper_carte {
.margin-center;
ul {
margin: 0pt;
}
 
#galerie_carte {
img {
.bordered;
}
}
}
 
.wrapper_demi {
height: 59px;
}
 
#galerie_carte {
list-style-type: none;
}
.bas-de-page {
margin-top: 1em;
margin-bottom: 1em;
}
.en-savoir-plus {
margin-left: 0.2em;
float: left;
.couleur2-bg;
color: white;
text-shadow: 0pt 0pt 0pt black;
}
.en-savoir-plus:hover, .en-savoir-plus:visited {
text-decoration: none;
}
 
 
.haut-de-page {
margin-right: 0.2em;
float: right;
background: black;
color: white;
}
.haut-de-page:hover, .haut-de-page:visited {
text-decoration: none;
}
 
 
/branches/v5.10-vilmorin/modules/mobile/presentations/less/README
New file
0,0 → 1,6
1./ Installer les paquets de LESS (sous Mageia: ruby-less)
Dans la description, il doit y avoir une mention du mot "CSS".
 
2./ En ligne de commande, se déplacer dans le dossier contenant les fichiers LESS.
Pour convertir le fichier "fichier.less" en "fichier.css", la commande est :
lessc fichier.less > fichier.css
/branches/v5.10-vilmorin/modules/mobile/presentations/less/functions.less
New file
0,0 → 1,45
@gris: #6B7071;
@orange: #ED7826;
@orange-moyen: #F3B88F;
@rouge: rgb(225, 96, 57);
@vert-fonce: #256226;
@vert-moyen: #88AB1C;
@violet: rgb(176, 77, 255);
 
.align-center { text-align: center; }
.margin-center {
margin-left: auto;
margin-right: auto;
}
.margin-bottom-05em { margin-bottom: 0.5em; }
.margin-right-05em { margin-right: 0.5em; }
.margin-top-05em { margin-top: 0.5em; }
 
.padding-05em { padding: 0.5em; }
.padding-left-1em { padding-left: 1em; }
.padding-left-01em { padding-left: 0.1em; }
 
.small-caps { font-variant:small-caps; }
 
.gradient(@color_start:'', @position_start:'', @color_end:'', @position_end:'') {
background-image: linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -o-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -moz-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -webkit-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -ms-linear-gradient(top, @color_start 0%, @color_end 100%);
 
background-image: -webkit-gradient(linear, @position_start, @position_end, color-stop(0, @color_start), color-stop(1, @color_end));
 
height: 16px;
display: block;
}
 
.shadow(@color:'', @decalage-x: 0pt, @decalage-y: 1px, @fondu: 1px) {
text-shadow: @decalage-x @decalage-y @fondu @color;
}
 
.border-radius(@radius: 2em) {
border-radius: @radius;
-moz-border-radius: @radius;
-webkit-border-radius: @radius;
}
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/presentations/less/pyracantha_blanc.less
New file
0,0 → 1,94
@import "pyracantha.less";
 
.couleur1-bg { background: white; }
.couleur2-bg { background: white; }
 
 
body {
background: white;
}
 
 
header {
background: @vert-moyen;
}
 
 
.tela {
img {
@width: 60px;
width: @width;
max-width: @width;
}
}
 
 
.titre {
color: white;
.shadow(@orange);
}
 
 
.infos {
 
.bg {
padding: 0.2em;
border-radius: 0pt 0pt 1em 1em;
}
.btn {
padding: 0pt;
border-radius: 1em 1em 0pt 0pt;
}
.collapse {
width: 100%;
}
h4 {
color: @orange;
}
.textes {
padding: 0.5em 1em;
.border-radius(2em);
-webkit-overflow-scrolling: touch;
h4 {
color: @vert-fonce;
.shadow(@vert-moyen, 2px, 1px, 1px);
}
}
}
 
 
.resume {
color: black;
}
 
 
.gradient-bas {
@top: left top;
@bottom: left bottom;
@color_start: @vert-moyen;
@color_end: white;
background-image: linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -o-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -moz-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -webkit-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -ms-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -webkit-gradient(linear, @top, @bottom, color-stop(0, @color_start), color-stop(1, @color_end));
}
 
.en-savoir-plus {
color: white;
background: @vert-moyen;
}
 
.haut-de-page {
color: white;
background: black;
}
/branches/v5.10-vilmorin/modules/mobile/presentations/less/pyracantha.less
New file
0,0 → 1,166
@import "functions.less";
 
.gradient-bas {
height: 16px;
display: block;
}
 
footer {
height: 60px;
width: 100%;
left: 0;
right: 0;
bottom: 0;
position: fixed;
z-index: 1000;
color: white;
background: black;
a, a:visited {
color: white;
}
}
 
.tela {
margin-right: 0.5em;
}
 
.titre {
font-style: italic;
font-size: 130%;
font-weight: bold;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
 
.sci {
font-style: italic;
}
 
#div-infos-latin, #div-infos-famille {
.margin-center;
.btn {
width: 99%;
padding-left: 0pt;
padding-right: 0pt;
box-shadow: 0pt 2px 3px black;
}
a {
font-size: 16px;
}
}
 
#div-infos-famille {
margin-top: -1em;
}
#div-illustrations {
.border-radius(2em);
background: white;
margin-top: -1em;
padding-top: 20px;
padding-bottom: 20px;
}
 
 
#galerie_carte {
list-style-type: none;
}
 
@height: 260px;
#slider-pictures {
max-width: 320px;
.margin-center;
.carousel {
margin-bottom: 0pt;
}
.carousel-control {
background: none;
}
 
 
.carousel-inner > .item > img {
width: 320px;
max-height: 310px;
}
.carousel-indicators {
li {
background: @vert-fonce;
}
.active {
background: @orange;
}
}
.carousel-caption {
padding: 10px;
position: static;
h4 {
font-size: 100%;
}
p {
font-size: 90%;
}
}
 
img {
.margin-center;
}
}
 
 
#gstn-img {
max-height: 120px;
margin: 0.5em 0pt 1em 0pt;
display: inline-block;
img {
border: #EAEAEA 2px solid;
width: 100px;
}
 
 
.zoom {
margin-top: 40px;
width: 20px;
border: none;
}
}
 
 
.resume {
.align-center;
margin-top: 1em;
margin-bottom: 1em;
font-size: 16px;
}
 
 
.bas-de-page {
margin-top: 1em;
margin-bottom: 1em;
}
 
.en-savoir-plus {
float: left;
text-shadow: 0pt 0pt 0pt black;
}
 
.haut-de-page {
float: right;
}
/branches/v5.10-vilmorin/modules/mobile/presentations/less/pyracantha_vert.less
New file
0,0 → 1,92
@import "pyracantha.less";
 
.couleur1-bg { background: #9ac342; }
.couleur2-bg { background: #88ab1c; }
 
 
body {
background: white;
}
 
 
header {
background: @vert-moyen;
}
 
 
.tela {
img {
@width: 60px;
width: @width;
max-width: @width;
}
}
 
 
.titre {
color: white;
.shadow(@orange);
}
 
 
.infos {
 
.bg {
padding: 0.2em;
border-radius: 0pt 0pt 1em 1em;
}
.btn {
padding: 0pt;
border-radius: 1em 1em 0pt 0pt;
}
.collapse {
width: 100%;
}
.textes {
padding: 0.5em 1em;
.border-radius(2em);
background: white;
-webkit-overflow-scrolling: touch;
h4 {
color: @vert-fonce;
.shadow(@vert-moyen, 2px, 1px, 1px);
}
}
}
 
 
.resume {
color: black;
}
 
 
.gradient-bas {
@top: left top;
@bottom: left bottom;
@color_start: @vert-moyen;
@color_end: white;
background-image: linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -o-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -moz-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -webkit-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -ms-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -webkit-gradient(linear, @top, @bottom, color-stop(0, @color_start), color-stop(1, @color_end));
}
 
.en-savoir-plus {
color: white;
background: @violet;
}
 
.haut-de-page {
color: white;
background: black;
}
/branches/v5.10-vilmorin/modules/mobile/presentations/less/pyracantha_tela.less
New file
0,0 → 1,97
@import "pyracantha.less";
 
.couleur1-bg { background: @orange; }
.couleur2-bg { background: @vert-moyen; }
 
 
body {
background: @vert-fonce;
}
 
 
header {
background: white;
}
 
 
.tela {
img {
@width: 80px;
width: @width;
max-width: @width;
}
}
 
 
.titre {
color: black;
.shadow(@orange);
}
 
 
.infos {
 
.bg {
padding: 1em;
.border-radius(2em);
}
.btn {
padding: 0pt;
.border-radius(2em);
}
.collapse {
width: 100%;
}
@max-height: 220px;
.textes {
padding: 1em;
.border-radius(2em);
max-height: @max-height;
overflow: auto;
background: @orange-moyen;
-webkit-overflow-scrolling: touch;
h4 {
color: @vert-fonce;
.shadow(@vert-moyen, 2px, 1px, 1px);
}
}
}
 
 
 
.resume {
color: white;
}
 
 
.gradient-bas {
@top: left top;
@bottom: left bottom;
@color_start: white;
@color_end: @vert-fonce;
background-image: linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -o-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -moz-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -webkit-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -ms-linear-gradient(top, @color_start 0%, @color_end 100%);
background-image: -webkit-gradient(linear, @top, @bottom, color-stop(0, @color_start), color-stop(1, @color_end));
}
 
.en-savoir-plus {
color: white;
background: @violet;
}
 
.haut-de-page {
color: white;
background: black;
}
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/presentations/css/smartflore.css
New file
0,0 → 1,226
#smartflore-fiche #smartflore-entete h1 {
font-size: 3.5em;
margin-top: 10px;
margin-bottom: -10px;
}
 
#smartflore-fiche .smartflore-titre-section {
background-color: #928B71;
color: #FFFFFF;
padding-top: 10px;
padding-bottom: 10px;
margin-bottom: 20px;
}
 
#smartflore-fiche .smartflore-titre-section a {
font-size: 2em;
font-weight: bold;
}
 
#smartflore-fiche .smartflore-titre-section .panel-title {
text-align: center;
}
 
#smartflore-fiche .smartflore-titre-section-icone {
float: left;
}
 
#smartflore-fiche .smartflore-contenu-section {
margin: 20px;
font-size: 1.5em;
text-align: justify;
}
 
#smartflore-fiche #smartflore-entete {
text-align: center;
}
 
#smartflore-fiche .smart-flore-sf {
font-size: 2em;
color: #DE6E40;
}
 
#smartflore-fiche #smart-flore-logo-tela {
bottom: 15px;
height: 80px;
position: relative;
}
 
#smartflore-fiche #smartflore-footer .smartflore-footer-bouton {
text-align: center;
}
 
#smartflore-fiche #smartflore-footer .smartflore-footer-bouton .btn {
font-size: 2em;
background-color: #928B71;
color: #FFFFFF;
}
 
#smartflore-fiche #smartflore-noms h2 {
margin-top: 0px;
font-size: 1.5em;
}
 
#smartflore-illustrations {
background-color: #928B71;
padding-bottom: 10px;
padding-top: 10px;
margin-bottom: 20px;
}
 
#smartflore-illustrations .carousel-inner {
height: 40vh;
max-width: 100%;
}
 
#smartflore-illustrations .carousel-inner .item {
height: 100%;
}
 
#smartflore-illustrations .carousel-inner .item img {
height: 100%;
max-width: 100vw;
}
 
#smartflore-illustrations .carousel-control.right {
background-image : none;
}
 
#smartflore-illustrations .carousel-control.left {
background-image : none;
}
 
#smartflore-fiche #smartflore-noms h3, #smartflore-fiche #smartflore-noms h4 {
font-size: 1.1em;
}
 
#smartflore-fiche #smartflore-noms {
font-size: 2em;
color: #FFFFFF;
text-align: center;
}
 
#smartflore-fiche .smartflore-nom-verna {
margin-bottom: 0px;
}
 
#smartflore-fiche .smartflore-nom-sci, #smartflore-fiche .smartflore-famille {
margin-top: 5px;
display: inline-block;
}
 
#smartflore-fiche .smartflore-nom-sci {
font-style: italic;
}
 
#smartflore-footer #smartflore-sources {
display: none;
}
 
#smartflore-partenaires {
padding-left: 0px;
padding-right: 0px;
margin-top: 15px;
}
 
#smartflore-footer #smartflore-partenaires #smartflore-accordeon-partenaires {
background-color: #EEEEEE;
color: black;
font-size: 2em;
margin-bottom: 0;
text-align: center;
color: #666666;
}
 
#smartflore-footer #collapse-partenaires {
padding-bottom: 5px;
font-size: 0.8em;
}
 
#smartflore-footer #smartflore-partenaires #smartflore-accordeon-partenaires h4 {
font-size: 0.8em;
}
 
#smartflore-footer .smartflore-footer-partenaires-logo {
max-height: 30vh;
max-width: 40vw;
}
 
/**
*
* Media Queries
*
*/
@media screen and (max-width: 384px) {
#smartflore-fiche #smartflore-entete h1 {
font-size: 2.2em;
}
#smartflore-fiche .smartflore-contenu-section {
margin: 20px;
font-size: 1em;
}
#smartflore-fiche #smartflore-noms h2 {
font-size: 1.2em;
}
#smartflore-fiche #smartflore-noms h3, #smartflore-fiche #smartflore-noms h4 {
font-size: 0.6em;
}
#smartflore-fiche #smartflore-footer .smartflore-footer-bouton .btn, #smartflore-footer .smartflore-titre-partenaires {
font-size: 0.9em;
}
#smartflore-fiche .smartflore-titre-section a {
font-size: 1.5em;
}
#smartflore-illustrations-galerie-carousel .carousel-caption {
font-size: 0.83em;
bottom: 0px;
}
#smartflore-illustrations-galerie-carousel .carousel-indicators {
bottom: -10px;
}
}
 
@media all and (orientation:portrait) {
#smartflore-illustrations .carousel-inner {
height: 40vh;
}
#smartflore-fiche #smart-flore-logo-tela {
bottom: 13px;
height: 7vh;
position: relative;
min-height: 50px;
}
#smartflore-fiche #smartflore-entete h1 {
margin-top: -3px;
margin-bottom: -6px;
}
}
 
@media all and (orientation:landscape) {
#smartflore-illustrations .carousel-inner {
height: 90vh;
}
#smartflore-fiche #smartflore-entete h1 {
margin-top: -10px;
margin-bottom: -10px;
}
#smartflore-illustrations-galerie-carousel .carousel-caption {
font-size: 0.9em;
bottom: 2px;
}
#smartflore-illustrations-galerie-carousel .carousel-indicators {
bottom: -10px;
}
}
/branches/v5.10-vilmorin/modules/mobile/squelettes/smartflore.tpl.html
New file
0,0 → 1,186
<?php
$icones = array('glyphicon-eye-open', 'glyphicon-grain', 'glyphicon-home');
$index_icones = 0;
?>
<!DOCTYPE html>
<html>
<head>
<title>Smart'Flore</title>
<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 http-equiv="cache-control" content="no-cache">
<!-- Favicones -->
<link rel="shortcut icon" type="image/x-icon" href="http://resources.tela-botanica.org/tb/img/16x16/favicon.ico" />
<!-- Viewport -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
<!-- CSS -->
<link href="http://www.tela-botanica.org/commun/jquery/photoswipe/3.0.5/photoswipe.css" type="text/css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="<?= $css ?>" rel="stylesheet" type="text/css" id="custom-css" />
<link href="modules/mobile/presentations/css/smartflore.css" rel="stylesheet" type="text/css" id="smart-flore-css" />
 
<!-- Javascript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://www.tela-botanica.org/commun/jquery/photoswipe/3.0.5/klass.min.js"></script>
<script src="http://www.tela-botanica.org/commun/jquery/photoswipe/3.0.5/code.photoswipe.jquery-3.0.5.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="modules/mobile/presentations/js/mobile.js"></script>
<style>
.btn {border-radius:2em;}
.container-fluid {padding: 0px;}
[class*="span"] {margin-left: 0px;}
.accordion {margin-top: 1em;}
.accordion-heading .accordion-toggle {padding: 0pt 10px;}
</style>
</head>
 
<body>
<div id="smartflore-fiche">
<div id="smartflore-entete">
<h1>
<img id="smart-flore-logo-tela" src="http://resources.tela-botanica.org/tb/img/128x128/logo_carre_officiel.png" /> <span class="smart-flore-sf">S</span>mart'<span class="smart-flore-sf">F</span>lore
</h1>
</div>
<div id="smartflore-illustrations">
<div id="smartflore-noms">
<h2 class="smartflore-nom-verna">
<?= $texte['titre'][0]; ?>
</h2>
<h3 class="smartflore-nom-sci">
<?= $texte['titre'][1]; ?>
</h3>
<h4 class="smartflore-famille">
Famille des <?= $texte['titre'][2]; ?>
</h4>
</div>
<div id="smartflore-illustrations-galerie">
<? if (count($illustrations) != 0) : ?>
<div id="smartflore-illustrations-galerie-carousel" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Indicators -->
<ol class="carousel-indicators">
<? for($ill = 0; $ill < count($illustrations); $ill++) { ?>
<li data-target="#smartflore-illustrations-galerie-carousel" data-slide-to="<?= $ill; ?>" class="<?= ($ill == 0) ? 'active' : ''; ?>"></li>
<?php } ?>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<? for($ill = 0; $ill < count($illustrations); $ill++) { ?>
<div class="item <?= ($ill == 0) ? 'active' : ''; ?>">
<? if (trim($illustrations[$ill]['legende']['texte']) != '&nbsp;') : ?>
<? $alt = $illustrations[$ill]['legende']['titre'].' ('.$illustrations[$ill]['legende']['texte'].')'; ?>
<? else : ?>
<? $alt = $illustrations[$ill]['legende']['titre']; ?>
<? endif; ?>
<img class="img-responsive center-block" src="<?= $illustrations[$ill]['src']; ?>" alt="<?= $alt; ?>">
<div class="carousel-caption">
<?= $alt; ?>
</div>
</div>
<?php } ?>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#smartflore-illustrations-galerie-carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#smartflore-illustrations-galerie-carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<? endif; ?>
</div>
</div>
<div id="smartflore-sections">
<div class="panel-group" id="smartflore-accordeon-sections" role="tablist" aria-multiselectable="true">
<div>
<? foreach($texte['corps'] as $titre_section => $texte_section) : ?>
<div class="panel-heading smartflore-titre-section" role="tab" id="heading<?= md5($titre_section); ?>">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#smartflore-accordeon-sections" href="#collapse<?= md5($titre_section); ?>" aria-expanded="true" aria-controls="collapse<?= md5($titre_section); ?>">
<span class="glyphicon <?= $icones[$index_icones++]; ?> smartflore-titre-section-icone margin-left-1em margin-top-03em"></span>
<?= $titre_section; ?>
</a>
</h4>
</div>
<div id="collapse<?= md5($titre_section); ?>" class="panel-collapse collapse smartflore-contenu-section" role="tabpanel" aria-labelledby="heading<?= md5($titre_section); ?>">
<div class="panel-body">
<?= $texte_section; ?>
</div>
</div>
<? endforeach; ?>
</div>
</div>
</div>
<div id="smartflore-footer">
<div class="col-md-12">
<div class="col-md-4 col-xs-4 smartflore-footer-bouton">
<a href="<?= $lien_fiche; ?>" target="_blank">
<button type="button" class="btn btn-default" aria-label="Left Align">
En savoir plus
</button>
</a>
</div>
<div class="col-md-4 col-xs-4 smartflore-footer-bouton">
<button id="smartflore-footer-button-sources" type="button" class="btn btn-default" aria-label="Left Align">
Sources
</button>
<div id="smartflore-sources">
<?= $texte['sources']; ?>
</div>
</div>
<div class="col-md-4 col-xs-4 smartflore-footer-bouton">
<a href="<?= $lien_edition; ?>" target="_blank">
<button type="button" class="btn btn-default" aria-label="Left Align">
Modifier
</button>
</a>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-12" id="smartflore-partenaires">
<div class="panel-group" id="smartflore-accordeon-partenaires" role="tablist" aria-multiselectable="true">
<div class="panel-heading smartflore-titre-partenaires" role="tab" id="heading-partenaires">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#smartflore-accordeon-partenaires" href="#collapse-partenaires" aria-expanded="true" aria-controls="collapse-partenaires">
<span class="glyphicon glyphicon-linkglyphicon glyphicon-link smartflore-titre-partenaires-icone margin-left-1em margin-top-03em"></span>
Partenaires
</a>
</h4>
</div>
<div id="collapse-partenaires" class="panel-collapse collapse smartflore-contenu-partenaires" role="tabpanel" aria-labelledby="heading-partenaires">
<div class="panel-body">
<div class="col-md-6 col-xs-6">
<img class="smartflore-footer-partenaires-logo" src="<?= $url_logos; ?>logo-msjs.jpg" />
</div>
<div class="col-md-6 col-xs-6">
<img class="smartflore-footer-partenaires-logo" src="<?= $url_logos; ?>logo-fondation-nd.jpg" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
/branches/v5.10-vilmorin/modules/mobile/sources/Floraison.php
New file
0,0 → 1,198
<?php
// declare(encoding='UTF-8');
/**
* Classe mère du module Liste.
*
* @category PHP 5.2
* @package eflore-consultation
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @copyright 2011 Tela-Botanica
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
* @version $Id$
*/
class Floraison extends aControleur {
 
private $conteneur = null;
private $nomCourant = null;
private $textes = null;
private $meta = null;
private $wikini = null;
private $informations = null;
private $mois = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août',
'septembre', 'octobre', 'novembre', 'décembre');
private $CosteFormate;
private $CosteTexte;
private $referentiel = 'bdtfx';
private $donnees = array();
 
public function __construct(Conteneur $conteneur) {
$this->conteneur = $conteneur;
$this->nomCourant = $this->conteneur->getNomCourant();
$this->referentiel = $this->conteneur->getParametre('referentiel');
$this->textes = $this->conteneur->getApiTextes();
$this->wikini = $this->conteneur->getApiWikini();
$this->meta = $this->conteneur->getApiMetaDonnees();
$this->informations = $this->conteneur->getApiInformations();
$this->appUrls = $this->conteneur->getAppUrls();
}
public function getDonnees() {
if ($this->referentiel == 'bdtfx') {
$this->getCoste();
}
if (isset($this->CosteFormate['floraison'])) {
$this->donnees['floraison'] = $this->getIndiceMois($this->CosteFormate['floraison']);
} else {
$this->getFloraisonBaseflor();
}
if (isset($this->CosteFormate['fructification'])) {
$this->donnees['fructification'] = $this->getIndiceMois($this->CosteFormate['fructification']);
} else {
$this->donnees['fructification'] = -1;
}
return $this->donnees;
}
private function getCoste() {
$coste = array();
$this->textes->setProjet('coste');
$this->textes->setId('bdtfx.nn:'.$this->nomCourant->getNnr());
$texte = $this->textes->getTexte();
$texte = array_pop($texte['resultats']);
if ($texte) {
$coste['titre'] = $texte['titre'];
// TODO: réintroduire les modif' effectuées sur modules/fiche/formateurs/Description.php
// -les joies du code copié/collé-
$coste['description'] = $this->mettreEnFormeCoste($texte['texte']);
}
$this->donnees['coste'] = $coste;
}
private function getIndiceMois($elt) {
$mois = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août',
'septembre', 'octobre', 'novembre', 'décembre');
$indice_mois = -1;
$elt = $this->nettoyerTexte($elt);
$arr = preg_split('/-/', $elt, -1, PREG_SPLIT_NO_EMPTY);
if (isset($arr[1])) {
$mois1 = $this->getIndiceMois($arr[0]);
$mois2 = $this->getIndiceMois($arr[1]);
$indice_mois = $mois1.'-'.$mois2;
} else {
for ($i = 0; $i < count($mois); $i++) {
if ($elt == $mois[$i]) {
$indice_mois = $i;
}
}
}
return $indice_mois;
}
private function nettoyerTexte($texte) {
$texte = trim($texte);
$a_effacer = array('.', ' ', 'de');
$texte = str_replace($a_effacer, '', $texte);
 
$texte = strtolower($texte);
return $texte;
}
 
private function getFloraisonBaseflor() {
$baseflor = array();
$this->informations->setProjet('baseflor');
$this->informations->setBdnt($this->conteneur->getParametre('referentiel'));
$this->informations->setNum_nom($this->conteneur->getParametre('num_nom'));
$informations = $this->informations->getInformationsDescription();
if ($informations){
$baseflor['chorologie'] = isset($informations['chorologie']) ? $informations['chorologie'] : '';
$baseflor['inflorescence'] = isset($informations['inflorescence']) ? $informations['inflorescence'] : '';
$baseflor['sexualite'] = isset($informations['sexualite']) ? $informations['sexualite'] : '';
$baseflor['ordre_maturation'] = isset($informations['ordre_maturation']) ? $informations['ordre_maturation'] : '';
$baseflor['pollinisation'] = isset($informations['pollinisation']) ? $informations['pollinisation'] : '';
$baseflor['dissemination'] = isset($informations['dissemination']) ? $informations['dissemination'] : '';
$baseflor['fruit'] = isset($informations['fruit']) ? $informations['fruit'] : '';
$baseflor['couleur_fleur'] = isset($informations['couleur_fleur']) ? $informations['couleur_fleur'] : '';
$baseflor['macule'] = isset($informations['macule']) ? $informations['macule'] : '';
$baseflor['type_bio'] = isset($informations['type_bio']) ? $informations['type_bio'] : '';
$baseflor['form_vegetale'] = isset($informations['form_vegetale']) ? $informations['form_vegetale'] : '';
$baseflor['floraison'] = isset($informations['floraison']) ? $informations['floraison'] : '';
}
$this->donnees['baseflor'] = $baseflor;
$this->donnees['floraison'] = $baseflor['floraison'];
}
 
 
public function mettreEnFormeCoste($texte){
$this->CosteFormate = array();
$this->CosteTexte = $texte;
//decouper elements remarquables avant le texte
$this->separerNomScientifique_a_NomCommun();
$this->CosteTexte = preg_replace('/\//','',$this->CosteTexte);
//decouper elements remarquables après le texte
$this->separerEcologie_a_Usages();
//le morceau qui reste est le gros de la description
$this->CosteTexte = str_replace(';','<br /> -','- '.$this->CosteTexte);
$this->CosteTexte = str_replace('–','',$this->CosteTexte);
$this->CosteFormate['texte'] = htmlspecialchars_decode(htmlentities($this->CosteTexte, ENT_NOQUOTES, 'UTF-8'), ENT_NOQUOTES);
return $this->CosteFormate;
}
 
public function separerNomScientifique_a_NomCommun(){
if ( preg_match('/\*\*(.+)\*\*([^–]*)–/', $this->CosteTexte, $retour)){
/* !! attention on enlève un tiret cadratin – pas un trait d'union - !! */
$a_enlever = array('/–/','/\./' );
$this->CosteFormate['nom_scientifique'] = preg_replace($a_enlever,'',$retour[1]);
if(preg_match('/\((.+)\)/',$retour[2],$synonymes)){
$this->CosteFormate['synonymes'] = $synonymes[1];
} else {
$this->CosteFormate['nom_scientifique'] .= $retour[2];
}
$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
}
/* !! attention il y a un espace avant les // du début !! */
if ( preg_match('/^ \/\/([^\/\/]+)\/\//', $this->CosteTexte, $retour)){
$a_enlever = array('/–/','/\./' );
$this->CosteFormate['nom_commun'] = preg_replace($a_enlever,'',$retour[1]);
$this->CosteTexte = str_replace($retour[0],'',$this->CosteTexte);
}
}
 
public function separerEcologie_a_Usages(){
if ( preg_match('/\.[ ]*([A-ZÉÀÈ].+)$/',$this->CosteTexte, $retour)){
$this->CosteFormate['ecologie'] = $retour[1];
$this->CosteTexte = str_replace($retour[0],'.',$this->CosteTexte);
if (isset($this->CosteFormate['ecologie']) && preg_match('/–(.+)/', $this->CosteFormate['ecologie'] , $retour)){
$this->CosteFormate['repartition'] = $retour[1];
$this->CosteFormate['ecologie'] = str_replace($retour[0],'',$this->CosteFormate['ecologie']);
}
if (isset($this->CosteFormate['repartition']) && preg_match('/=(.+)$/', $this->CosteFormate['repartition'], $retour)){
$this->CosteFormate['floraison'] = $retour[1];
$this->CosteFormate['repartition'] = str_replace($retour[0],'',$this->CosteFormate['repartition']);
}
if (isset($this->CosteFormate['floraison']) && preg_match('/–(.+)$|\n(.+)$/',$this->CosteFormate['floraison'], $retour)){
$this->CosteFormate['usages'] = isset($retour[1]) ? $retour[1] : $retour[2];
$this->CosteFormate['floraison'] = str_replace($retour[0],'.',$this->CosteFormate['floraison']);
}
if (isset($this->CosteFormate['floraison']) && preg_match('/([Ff]l\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
$this->CosteFormate['floraison'] = $retour[2];
$this->CosteFormate['floraison'] = str_replace($retour[1],'',$this->CosteFormate['floraison']);
}
if (isset($this->CosteFormate['floraison']) && preg_match('/([Ff]r\.) (.+)/',$this->CosteFormate['floraison'], $retour)){
$this->CosteFormate['fructification'] = $retour[2];
$this->CosteFormate['floraison'] = str_replace($retour[0],'',$this->CosteFormate['floraison']);
$this->CosteFormate['floraison'] = str_replace(',','',$this->CosteFormate['floraison']);
$this->CosteFormate['fructification'] = str_replace($retour[1],'',$this->CosteFormate['fructification']);
$this->CosteFormate['fructification'] = str_replace('.','',$this->CosteFormate['fructification']);
}
}
}
}
?>
/branches/v5.10-vilmorin/modules/mobile/sources/Illustrations.php
New file
0,0 → 1,115
<?php
// declare(encoding='UTF-8');
/**
* Classe mère du module Liste.
*
* @category PHP 5.2
* @package eflore-consultation
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @copyright 2011 Tela-Botanica
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
* @version $Id$
*/
class Illustrations extends aControleur {
 
private $conteneur = null;
private $nomCourant = null;
private $images = null;
private $appUrls = null;
private $meta = null;
private $referentiel = 'bdtfx';
private $donnees = array();
 
public function __construct(Conteneur $conteneur) {
$this->conteneur = $conteneur;
$this->nomCourant = $this->conteneur->getNomCourant();
$this->referentiel = $this->conteneur->getParametre('referentiel');
$this->images = $this->conteneur->getApiImages();
$this->appUrls = $this->conteneur->getAppUrls();
$this->meta = $this->conteneur->getApiMetaDonnees();
 
$this->images->setApi(Images::API_DEL);
}
 
public function getDonnees() {
$this->donnees = array();
$this->getPhotos();
$dessin = $this->addDessin();
if (!empty($dessin)) {
array_push($this->donnees, $dessin);
}
 
return $this->donnees;
}
 
public function getPhotos() {
$listePhotos = $this->images->getInfosImagesGalerieMobile($this->nomCourant->getNnr());
foreach($listePhotos as $index) {
$this->formaterListePhotos($index);
}
}
 
private function formaterListePhotos($images) {
$infosImg['src'] = $images['binaire.href'];
 
$obs = $images['observation'];
if ($obs['auteur.nom'] != '') {
$infosImg['legende']['titre'] = $obs['auteur.nom'];
if ($obs['auteur.prenom'] != '') {
$infosImg['legende']['titre'] .= ' '.$obs['auteur.prenom'];
}
} else {
$infosImg['legende']['titre'] = "Anonyme";
}
 
if ($obs['date_observation'] != '') {
$infosImg['legende']['titre'] .= ", le ".$this->formaterDateImg($obs['date_observation']);
}
 
if ($obs['zone_geo'] != '') {
$infosImg['legende']['texte'] = $obs['zone_geo'];
if ($obs['lieudit'] != '') {
$infosImg['legende']['texte'] .= ' ('.$obs['lieudit'].')';
}
} else {
$infosImg['legende']['texte'] = "&nbsp;";
}
 
array_push($this->donnees, $infosImg);
}
 
private function formaterDateImg($date) {
$dateFmt = $date;
if ($date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
$dateFmt = 'inconnue';
} else {
$dateFmt = strftime('%e %B %Y', strtotime($date));
}
return $dateFmt;
}
 
public function addDessin() {
$img = array();
$projet = Config::get($this->referentiel.'.baseDessins');
if ($projet != "") {
$dessin = array();
$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
$this->images->setProjet($projet);
$this->images->setNnTaxon($tax);
if ($this->referentiel == 'bdtfx') {
$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
$this->images->setApi(Eflore::API_DEL);
if (count($costeImg) != 0) {
$img['src'] = $costeImg[key($costeImg)]['binaire.href'];
$img['legende']['titre'] = "Illustration de Coste";
$img['legende']['texte'] = "&nbsp;";
}
}
}
 
return $img;
}
}
?>
/branches/v5.10-vilmorin/modules/mobile/sources/NomsCommuns.php
New file
0,0 → 1,40
<?php
// declare(encoding='UTF-8');
/**
* Classe mère du module Liste.
*
* @category PHP 5.2
* @package eflore-consultation
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @copyright 2011 Tela-Botanica
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
* @version $Id$
*/
class NomsCommuns extends aControleur {
 
private $conteneur = null;
private $nomCourant = null;
private $nomsVernaculaires = null;
private $referentiel = 'bdtfx';
private $donnees = array();
 
public function __construct(Conteneur $conteneur) {
$this->conteneur = $conteneur;
$this->nomCourant = $this->conteneur->getNomCourant();
$this->nomsVernaculaires = $this->conteneur->getApiNomsVernaculaires();
$this->referentiel = $this->conteneur->getParametre('referentiel');
}
public function getDonnees() {
$nt = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
$projet = Config::get($this->referentiel.'.referentielVerna');
if ($projet != '') {
$nomsVerna = $this->nomsVernaculaires->getRechercheLimitee($projet, $nt);
$this->donnees = (isset($nomsVerna['resultat']) && is_array($nomsVerna['resultat'])) ? array_slice($nomsVerna['resultat'], 0, 1) : array();
}
return $this->donnees;
}
}
?>
/branches/v5.10-vilmorin/modules/mobile/sources/Repartition.php
New file
0,0 → 1,47
<?php
// declare(encoding='UTF-8');
/**
* Classe mère du module Liste.
*
* @category PHP 5.2
* @package eflore-consultation
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @copyright 2011 Tela-Botanica
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
* @version $Id$
*/
class Repartition extends aControleur {
 
private $conteneur = null;
private $nomCourant = null;
private $donnees = array();
private $referentiel = 'bdtfx';
private $cartes;
 
public function __construct(Conteneur $conteneur) {
$this->conteneur = $conteneur;
$this->nomCourant = $this->conteneur->getNomCourant();
$this->cartes = $this->conteneur->getApiCartes();
$this->referentiel = $this->conteneur->getParametre('referentiel');
}
 
public function getDonnees() {
$donnees['carte'] = $this->getChorodepMiniature();
return $donnees;
}
 
private function getChorodepMiniature() {
$url_carte = null;
if (Config::get($this->referentiel.'.baseRepartition') != null) {
$this->cartes->setProjet(Config::get($this->referentiel.'.baseRepartition'));
$this->cartes->setLargeur('570x534');
$nt = $this->nomCourant->getNt();
$this->cartes->setId("{$this->referentiel}.nt:$nt");
$url_carte = $this->cartes->getUrlDataSvg();
}
return $url_carte;
}
}
?>
Property changes:
Added: svnkit:entry:sha1-checksum
+7e6935a1dae5a65376b5236b5be79756881600b7
\ No newline at end of property
/branches/v5.10-vilmorin/modules/mobile/sources/Texte.php
New file
0,0 → 1,129
<?php
// declare(encoding='UTF-8');
/**
* Classe Mobile Wikini.
*
* @category PHP 5.2
* @package eflore-consultation
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @author Isabelle NEMBROT <isabelle.nembrot@tela-botanica.org>
* @copyright 2013 Tela-Botanica
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
* @version $Id$
*/
class Texte extends aControleur {
 
private $conteneur = null;
private $donnees = array();
private $format = "text/html";
 
public function __construct(Conteneur $conteneur) {
$this->conteneur = $conteneur;
$this->nomCourant = $this->conteneur->getNomCourant();
parent::__construct();
}
public function getDonnees() {
$url_wiki = $this->obtenirUrlWikini();
$obj = json_decode(file_get_contents($url_wiki));
//echo '<pre>'.print_r($obj, true).'</pre>';exit;
$this->donnees['corps'] = $obj->{'texte'};
if (strpos($this->format, "html") != false) {
$this->obtenirCorpsHtml();
} else {
$this->obtenirCorpsPlain();
}
if ($this->donnees['corps'] != "") {
$this->donnees['corps'] = preg_split('/===/', $this->donnees['corps'], -1, PREG_SPLIT_NO_EMPTY);
$this->extraireInfosTableauCorps();
if (strpos($this->format, "html") != false) {
$this->obtenirTitreHtml();
} else {
$this->obtenirTitrePlain();
}
}
return $this->donnees;
}
private function extraireInfosTableauCorps() {
$this->donnees['titre'] = array_shift($this->donnees['corps']);
$this->donnees['sources'] = array_pop($this->donnees['corps']);
// array_pop "gratuit" pour supprimer la case qui ne contient que le terme "sources"
array_pop($this->donnees['corps']);
$corps_fmt = array();
// Le tableau contient un titre de section puis son contenu, puis le titre de la section suivante
// puis son contenu on dépile les éléments deux par deux pour faire un tableau associatif pas trop relou à afficher
for($i = 0; $i < count($this->donnees['corps']); $i = $i+2) {
$corps_fmt[$this->donnees['corps'][$i]] = $this->donnees['corps'][$i + 1];
}
$this->donnees['corps'] = $corps_fmt;
}
//formater pour AppUrls ?
public function obtenirUrlWikini() {
$titre = urlencode("Fiche simplifiée Smart'flore");
$base_url_wiki = Config::get('smartFloreWikiTpl');
$url_wiki = $base_url_wiki
.strtoupper($this->conteneur->getParametre('referentiel'))."nt".$this->nomCourant->getNomSelectionne()->get('num_taxonomique')
."?txt.format=".$this->format."&txt.section.titre=".$titre;
return ($url_wiki);
}
private function obtenirCorpsHtml() {
$a_remplacer = array('<h3>', '</h3>');
$this->donnees['corps'] = str_replace($a_remplacer, "===", $this->donnees['corps']);
}
private function obtenirCorpsPlain() {
$a_enlever = array(Chr(10).'=', '='.Chr(10), Chr(10).''.Chr(10));
$this->donnees['corps'] = str_replace($a_enlever, '', $this->donnees['corps']);
$this->donnees['corps'] = str_replace(Chr(10), '<br />', $this->donnees['corps']);
}
private function obtenirTitreHtml() {
$a_remplacer = array('<b>', '</b>', '(<br />', '<br />)');
$this->donnees['titre'] = str_replace($a_remplacer, '<br />', $this->donnees['titre']);
$a_enlever = array(Chr(10).'<br />', '<br />'.Chr(10), Chr(10).''.Chr(10), '<br />'.Chr(10).'<br />'.Chr(10));
$this->donnees['titre'] = str_replace($a_enlever, '', $this->donnees['titre']);
$this->separer_NomCommun_NomSci();
}
 
private function separer_NomCommun_NomSci() {
$this->donnees['titre'] = str_replace('<br />', '::', $this->donnees['titre']);
$this->donnees['titre'] = preg_split("/::/", $this->donnees['titre'], -1, PREG_SPLIT_NO_EMPTY);
$this->donnees['nom-commun'] = $this->donnees['titre'][0]; // sauf erreur ? parser le wikini serait peut-être plus adapté
}
private function obtenirTitrePlain() {
$this->donnees['titre'] = str_replace('**', '<br />', $this->donnees['titre']);
$a_remplacer = array('(<br />', '<br />)', '<br /><br />');
$this->donnees['titre'] = str_replace($a_remplacer, '<br />', $this->donnees['titre']);
$this->separer_NomCommun_NomSci();
$this->separer_NomSci_NomAuteur();
}
 
private function separer_NomSci_NomAuteur() {
$nom_sci = str_replace('//', '::', $this->donnees['titre'][1]);
$nom_sci = preg_split("/::/", $nom_sci, -1, PREG_SPLIT_NO_EMPTY);
$this->donnees['titre'][1] = "<i>".$nom_sci[0]."</i> ".$nom_sci[1];
}
}
?>