garancia-pharmaciens/httpdocs/home.php
2017-05-30 17:55:38 +02:00

223 lines
6.4 KiB
PHP
Executable File

<?php
/*-----------------------------------------------------*/
include_once("_inc/config.php");
/*-----------------------------------------------------*/
$_RUBRIQUE = "home";
/*-----------------------------------------------------*/
include_once("_inc/assets/metas.php");
include_once("_inc/assets/top.php");
/*-----------------------------------------------------*/
?>
<?php
$items = getFrontHomeSlides();
?>
<div id="slideHome">
<?php if(count($items) > 1): ?>
<div class="btnLeft"></div>
<div class="btnRight"></div>
<? endif; ?>
<div class="degrade_left"></div>
<div class="degrade_right"></div>
<div class="images">
<?php
$i = 0;
foreach($items as $item){
$url = $item->url;
$rel = "";
if($item->produit_id > 0){
//$produit = getProduit($item -> produit_id);
$pdfPath = "files/produits/pdf/" . $item->produit_id . ".pdf";
$url = "#pdf_viewer?file=" . $pdfPath;
$rel = "popin";
}
?>
<div class="image" rel="<?php echo $i; ?>" style="background-image:url(files/slide_home/<?php echo $item->id; ?><?php if ($item->id == 33 || $item->id == 53){ echo '.gif'; }else{ echo '.jpg'; } ?>); <?php if ($item->id == 33){ echo 'background-size:contain;'; }?>"><a href="<?php echo $url; ?>" rel="<?php echo $rel; ?>"></a></div>
<?php $i++; } ?>
</div>
</div>
<?php if(count($items) > 1): ?>
<script type="text/javascript">
//SIZE_CHANGED
var slideWidth = 1280;
var limitWidth = 1280;
var currentIndex = 0;
var nbImages = $("#slideHome .image").length;
var ti;
var currImg;
var isSliding;
function getImage($index,$direction){
if(isSliding) return;
isSliding = true;
currentIndex = $index;
//var ease = "Quad.easeInOut";
var ease = "Cubic.easeInOut";
var speed = 1;
if($direction == "next"){
if(currImg) TweenLite.to(currImg,speed,{left:"-1280px",ease:ease});
}else if($direction == "prev"){
if(currImg) TweenLite.to(currImg,speed,{left:"1280px",ease:ease});
}
/*
if($direction == "next"){
if(currImg) TweenLite.to(currImg,speed,{x:-1280,ease:ease});
}else if($direction == "prev"){
if(currImg) TweenLite.to(currImg,speed,{x:1280,ease:ease});
}
*/
currImg = $("#slideHome .image[rel='" + $index + "']");
//TweenLite.to(currImg,0,{opacity:0});
if($direction == "next"){
//TweenLite.to(currImg,0,{x:1280});
TweenLite.to(currImg,0,{left:"1280px"});
}else if($direction == "prev"){
//TweenLite.to(currImg,0,{x:-1280});
TweenLite.to(currImg,0,{left:"-1280px"});
}
currImg.appendTo(".images");
///TweenLite.to(currImg,0.5,{opacity:1});
//TweenLite.to(currImg,speed,{x:0,ease:ease,onComplete:function(){isSliding = false;}});
TweenLite.to(currImg,speed,{left:"0px",ease:ease,onComplete:function(){isSliding = false;}});
}
function nextImage(){
if(isSliding) return;
currentIndex++;
if(currentIndex > nbImages-1) currentIndex = 0;
getImage(currentIndex,"next");
}
function prevImage(){
if(isSliding) return;
currentIndex--;
if(currentIndex < 0) currentIndex = nbImages-1;
getImage(currentIndex,"prev");
}
$("#slideHome .btnLeft").click(function(e) {
clearInterval(ti);
prevImage();
});
$("#slideHome .btnRight").click(function(e) {
clearInterval(ti);
nextImage();
});
function redimSlide(){
slideWidth = $("#slideHome").innerWidth();
if(slideWidth <= limitWidth){
$("#slideHome .degrade_left").css("display","none");
$("#slideHome .degrade_right").css("display","none");
$("#slideHome .btnLeft").css("left","0px");
$("#slideHome .btnRight").css("right","0px");
}else{
$("#slideHome .degrade_left").css("display","block");
$("#slideHome .degrade_right").css("display","block");
var l = Math.floor((slideWidth - limitWidth) / 2) - 1;
$("#slideHome .degrade_left").css("left",l + "px");
$("#slideHome .degrade_right").css("right",l + "px");
$("#slideHome .btnLeft").css("left",l + "px");
$("#slideHome .btnRight").css("right",l + "px");
}
}
redimSlide();
$(document).bind('SIZE_CHANGED', redimSlide);
//currImg = $("#slideHome .image[rel='" + currentIndex + "']");
//TweenLite.to($("#slideHome .image"),0,{opacity:0});
$("#slideHome .images").css("opacity",0);
TweenLite.to($("#slideHome .images"),1,{opacity:1});
getImage(0);
ti = setInterval(nextImage,5000);
</script>
<?php endif; ?>
<div class="page">
<a href="ecole-des-sorciers.php" class="bHome bHome1">
<span class="txt">Découvrez nos formations en ligne.</span>
<span class="btn">Cliquez ici</span>
</a>
<a href="contact.php" class="bHome bHome2">
<span class="txt">Une question ? N'hésitez pas<br />à nous contacter.</span>
<span class="btn">Cliquez ici</span>
</a>
<a href="#home_video" rel="popin" class="bHome bHome3">
<span class="txt">Docteur en pharmacie<br />Fondatrice du Laboratoire Garancia. </span>
<span class="btn">Regardez la vidéo de bienvenue</span>
</a>
</div>
<script type="text/javascript">
$(".bHome").each(function(index, element) {
var btn = $(this).children(".btn");
var arrL = btn.innerWidth() - 15;
TweenLite.to(btn,0,{backgroundPosition:arrL + "px 8px"});
});
$(".bHome").mouseover(function(e) {
var btn = $(this).children(".btn");
TweenLite.to($(this),0.2,{borderColor:"#a9c717"});
//TweenLite.to(btn,0.2,{borderColor:"#000000",backgroundPosition:"83px 8px"});
var arrL = btn.innerWidth() - 12;
TweenLite.to(btn,0.2,{borderColor:"#000000",backgroundPosition:arrL + "px 8px"});
});
$(".bHome").mouseout(function(e) {
var btn = $(this).children(".btn");
TweenLite.to($(this),0.2,{borderColor:"#707070"});
//TweenLite.to(btn,0.2,{borderColor:"#a9c717",backgroundPosition:"80px 8px"});
var arrL = btn.innerWidth() - 15;
TweenLite.to(btn,0.2,{borderColor:"#a9c717",backgroundPosition:arrL + "px 8px"});
});
<?php
//si première connexion, afficher vidéo !
if($GLOBALS["gar_front_user"] -> first_connexion == 1){
$query = "UPDATE `".$GLOBALS['sql_prefixe']."pharmacies`
SET `first_connexion` = '0'
WHERE `CIP` = '".$GLOBALS["gar_front_user"] -> CIP."' ;";
$result = mysql_query($query);
?>
$(document).bind('CODE_LOADED', function() {
showPopin("home_video");
});
<?php } ?>
</script>
<?php
/*-----------------------------------------------------*/
include_once("_inc/assets/footer.php");
/*-----------------------------------------------------*/
?>