Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 1409 → Rev 1410

/trunk/modules/mobile/Mobile.php
5,9 → 5,9
*
* @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
* @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$
14,7 → 14,6
*/
class Mobile extends aControleur {
 
private $theme = 'pyracantha';
private $parametres = array();
private $conteneur = null;
private $num_nom = 0;
48,7 → 47,6
$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';
$this->theme = isset($_GET['theme']) ? $_GET['theme'] : $this->theme;
 
$referentiel = isset($_GET['referentiel']) ? $_GET['referentiel'] : '';
Registre::set('parametres.referentiel', $referentiel);
63,19 → 61,15
}
 
public function executerFiche(){
$niveau = Registre::get('parametres.niveau');
$squelette = "theme_{$this->theme}_niveau{$niveau}";
 
$donnees = $this->parametres;
$donnees['nom_retenu'] = $this->nom_retenu->get('nom_sci_html').' '.$this->nom_retenu->get('auteur');
$donnees['famille'] = $this->nom_retenu->getTaxonSupRang('180');
$donnees = array_merge($this->obtenirDonnees(), $donnees);
$donnees['css'] = $this->obtenirLienCss();
$donnees['url_absolue'] = "http://".$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];
$donnees['contenu_onglet'] = $this->getVue($squelette, $donnees);
$donnees['lien'] = $this->url->obtenirUrlMobile($this->parametres['num_nom']);
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche', $donnees), true);
//print_r($donnees);
$donnees['lien'] = $this->url->obtenirUrlMobile($this->parametres['num_nom']);
$donnees['lien_fiche'] = $this->url->obtenirUrlFiche($this->parametres['num_nom']);
 
$this->setSortie(self::RENDU_CORPS, $this->getVue('smartflore', $donnees), true);
}
 
public function obtenirDonnees() {
86,7 → 80,7
$taxons = new Taxons($this->conteneur);
$donnees['permalien_num_nom'] = $taxons->getUrlPermalienNumNom($referentiel, 1, $num_nom);
 
$sources = array('illustrations', 'repartition', 'texte', 'floraison', 'nomsCommuns');
$sources = array('illustrations', 'texte', 'nomsCommuns');
foreach ($sources as $source) {
$nom_classe = ucfirst($source);
$classe = new $nom_classe($this->conteneur);
95,14 → 89,5
 
return $donnees;
}
 
private function obtenirLienCss() {
$theme = $this->theme;
if (strcmp($this->theme, 'pyracantha') >= 0) {
$theme = 'pyracantha_blanc';
}
$lien = "modules/mobile/presentations/css/$theme.css";
return $lien;
}
}
?>
/trunk/modules/mobile/presentations/js/mobile.js
1,31 → 1,20
$(document).ready(function() {
// Popover
$('.btn-pop').popover();
$(document).ready(function() {
// CSS switcher
$('.toggle-button').click(function(e) {
$('link#custom-css').attr('href', $(this).attr('CssUrl'));
return false;
});
$('#smartflore-illustrations-galerie-carousel').carousel()
$('#smartflore-footer-button-sources').click(function() {
voirSources();
});
// Slider images : photoswipe
if (document.getElementById('galerie_carte')) {
var psc = $('#galerie_carte a').photoSwipe({
enableMouseWheel: false ,
enableKeyboard: false,
preventSlideshow: true
});
function voirSources() {
var w = window.open();
var html = $("#smartflore-sources").html();
$(w.document.body).html(html);
}
if (document.getElementById('galerie_images')) {
var psi = $('#galerie_images a').photoSwipe({
enableMouseWheel: false ,
enableKeyboard: false ,
captionAndToolbarAutoHideDelay: 0
});
}
//TODO gérer la fonction de swipe sur le téléphone
// Slider images : bootstrap
if (document.getElementById('slider-pictures')) {
/*if (document.getElementById('slider-pictures')) {
$('#slider-pictures').hide();
$('#slider-pictures').swiperight(function() {
$('#slider-pictures').carousel('prev');
33,133 → 22,5
$('#slider-pictures').swipeleft(function() {
$('#slider-pictures').carousel('next');
});
}
});
 
/*----------------------------------------------------------------------------------------------------------*/
// POPOVER
var nbrPopup = 0,
popupOuverte = false;
 
function gestionPopover() {
if (popupOuverte && nbrPopup != 0) {
$('.btn-pop').popover('hide');
popupOuverte = false;
}
nbrPopup++;
}
 
function resetPopover() {
nbrPopup = 0;
popupOuverte = true;
}
 
/*----------------------------------------------------------------------------------------------------------*/
// SLIDER BOOTSTRAP
function gestionSlider() {
if ($('#slider-pictures').is(':visible')) {
$('#gstn-img').show();
$('#slider-pictures').hide();
} else {
$('#gstn-img').hide();
$('#slider-pictures').show();
}
}
 
/*----------------------------------------------------------------------------------------------------------*/
// CANVAS FLORAISON, FRUCTIFICATION
var moisAbbr = new Array('J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D', ''),
intervalle = false;
 
function dessinCanvas(canvas, color, valeur) {
var ctx = canvas.getContext('2d'),
i = 0,
arr = getTableauMois(valeur),
index0 = arr[0],
index1 = -1,
size = canvas.width;
if (intervalle) {
index1 = arr[arr.length - 1];
}
for (var abscisse = 10; abscisse < size; abscisse += (size/13)) {
ctx.beginPath();
ctx.moveTo(abscisse, 0);
ctx.lineTo(abscisse, 55);
ctx.stroke();
 
if (in_array(i, arr)) {
if (i == index0 && index1 != -1) {
var linearGradient = ctx.createLinearGradient(abscisse, 10, abscisse+30, 10);
linearGradient.addColorStop(0, "#fff");
linearGradient.addColorStop(1, color);
ctx.beginPath();
ctx.fillStyle = linearGradient;
ctx.moveTo(abscisse, 25);
ctx.lineTo(abscisse+(size/13), 25);
ctx.lineTo(abscisse+(size/13), 10);
ctx.lineTo(abscisse, 25);
ctx.fill();
} else {
if (i == index1) {
var linearGradient = ctx.createLinearGradient(abscisse, 10, abscisse+25, 10);
 
linearGradient.addColorStop(0, color);
linearGradient.addColorStop(1, "#fff");
ctx.beginPath();
ctx.fillStyle = linearGradient;
ctx.moveTo(abscisse, 10);
ctx.lineTo(abscisse, 25);
ctx.lineTo(abscisse+(size/13), 25);
ctx.lineTo(abscisse, 10);
ctx.fill();
} else {
ctx.fillStyle = color;
ctx.fillRect(abscisse, 10, (size/13), 15);
}
}
}
ctx.font = '20px Georgia';
ctx.fillStyle = '#000';
ctx.fillText(moisAbbr[i++], abscisse + 5, 50);
}
}
 
function getTableauMois(elt) {
var arr = new Array(),
temp = elt.split('-');
 
if (typeof temp[1] === 'undefined') {
arr.push(elt);
} else {
intervalle = true;
temp[0] = parseInt(temp[0]);
temp[1] = parseInt(temp[1]);
if (temp[0] < temp[1]) {
for (var c = temp[0]; c <= temp[1]; c++) {
arr.push(c);
}
} else {
for (var c = temp[0]; c < 12; c++) {
arr.push(c);
}
for (var c = 0; c <= temp[1]; c++) {
arr.push(c);
}
}
}
return arr;
}
 
function in_array(needle, haystack) {
var inArray = 0;
for (var i in haystack) {
if (haystack[i] == needle) {
inArray++;
}
}
return (inArray != 0);
}
}*/
});
/trunk/modules/mobile/presentations/css/pyracantha_vert.css
File deleted
/trunk/modules/mobile/presentations/css/pyracantha_tela.css
File deleted
/trunk/modules/mobile/presentations/css/gentiana.css
File deleted
/trunk/modules/mobile/presentations/css/pyracantha_blanc.css
File deleted
/trunk/modules/mobile/presentations/css/smartflore.css
New file
0,0 → 1,103
#smartflore-fiche #smartflore-entete h1 {
font-size: 3.5em;
}
 
#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-contenu-section {
margin: 20px;
font-size: 1.5em;
}
 
#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;
}
 
 
#smartflore-illustrations .carousel-inner .item {
height: 100%;
}
 
#smartflore-illustrations .carousel-inner .item img {
height: 100%;
max-width: 100vw;
}
 
#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;
}
/trunk/modules/mobile/squelettes/fiche.tpl.html
File deleted
\ No newline at end of file
/trunk/modules/mobile/squelettes/theme_gentiana_niveau1.tpl.html
File deleted
\ No newline at end of file
/trunk/modules/mobile/squelettes/theme_gentiana2_niveau1.tpl.html
File deleted
\ No newline at end of file
/trunk/modules/mobile/squelettes/theme_pyracantha_niveau1.tpl.html
File deleted
\ No newline at end of file
/trunk/modules/mobile/squelettes/smartflore.tpl.html
New file
0,0 → 1,160
<?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">
 
<!-- 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="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 class="panel panel-default">
<? 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++]; ?> 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">
<button type="button" class="btn btn-default" aria-label="Left Align">
Modifier
</button>
</div>
</div>
</div>
</div>
</body>
</html>
/trunk/modules/mobile/sources/Texte.php
30,6 → 30,8
$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();
40,7 → 42,8
if ($this->donnees['corps'] != "") {
$this->donnees['corps'] = preg_split('/===/', $this->donnees['corps'], -1, PREG_SPLIT_NO_EMPTY);
$this->donnees['titre'] = $this->donnees['corps'][0];
$this->extraireInfosTableauCorps();
if (strpos($this->format, "html") != false) {
$this->obtenirTitreHtml();
} else {
51,7 → 54,24
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");