From: bruno@cubedesigners.com Date: Wed, 19 Feb 2014 16:42:35 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=07687684fea62e5918eeebcc5c011645c2d3e1ee;p=cubedesigners-v7.git --- diff --git a/framework/application/controllers/AjaxController.php b/framework/application/controllers/AjaxController.php index 54805d4..e6f5254 100644 --- a/framework/application/controllers/AjaxController.php +++ b/framework/application/controllers/AjaxController.php @@ -3,9 +3,33 @@ class AjaxController extends CubeIT_Controller_AjaxController { public function displayCaseStudies() { - $studies = $_GET['studies']; - //fb($studies, 'displayCaseStudies'); - //$this->view->CasestudiesList($this->studies); + $studies = $_GET['studies']; + //fb($studies, 'displayCaseStudies'); + //$this->view->CasestudiesList($this->studies); + } + + public function displayRealisation() { + $rea_id = $_GET['realisation_id']; + //fb($rea_id, 'Realisation id '); + + $db = $this->getDb(); + $s = $db->select()->from('realisations') + ->order('id ASC'); + $s->where('id = ?', $rea_id); + + $q = $s->query(); + $r = $q->fetch(); + + $r = CubeIT_Util_Cms::unserialize($r); + + for ($i = 0; $i < count($r->visuel_detail); $i++) { + $image_url = $this->view->imageProcess()->imageProcessGetUrl($r->visuel_detail[$i], '', null, 440); + $r->visuel_detail[$i] = $image_url; + } + + $r->description = $this->view->markupDotclear($r->description); + + $this->_datas->addVariable("rea", $r); } } diff --git a/framework/application/layouts/scripts/layout.phtml b/framework/application/layouts/scripts/layout.phtml index de3c281..b375859 100644 --- a/framework/application/layouts/scripts/layout.phtml +++ b/framework/application/layouts/scripts/layout.phtml @@ -2,7 +2,7 @@ //$fonts = array('custom' => array('families' => array('roboto_condensedlight'), 'urls' => array('/css/fonts/robotocondensed-light.css?nocache=1'))); $fonts = array('google' => array('families' => array('Roboto+Condensed:400,300,700:latin'))); - +$this->headScript()->addGSAP(); $this->headScript()->addWebFont($fonts); if ($this->acl()->isAllowed('edition')) { diff --git a/framework/application/views/helpers/RealisationsList.php b/framework/application/views/helpers/RealisationsList.php index 3a48265..301f7f2 100644 --- a/framework/application/views/helpers/RealisationsList.php +++ b/framework/application/views/helpers/RealisationsList.php @@ -9,7 +9,6 @@ class Cubedesigners_View_Helper_RealisationsList extends Zend_View_Helper_Abstra $db = Zend_Db_Table::getDefaultAdapter(); $s = $db->select()->from('realisations') ->order('id ASC'); - if (!$acl) { $s->where('online = ?', 1); } @@ -20,39 +19,63 @@ class Cubedesigners_View_Helper_RealisationsList extends Zend_View_Helper_Abstra $res = ''; + $test = 0; while ($r = $q->fetch()) { $r = CubeIT_Util_Cms::unserialize($r); $addSpacer = false; - if ($count == 4) { - $count = 1; - $addClass = ''; - // $addSpacer = true; - } else { - $addClass = ' blocmargin'; - $count++; - } + /* if ($count == 4) { + $count = 1; + $addClass = ''; + //$addSpacer = true; + } else { + $addClass = ' blocmargin'; + $count++; + } */ + + $addClass = ' blocmargin'; + $addOffline = ''; if ($acl && $r->online == 0) { $addOffline = 'data-offline="1"'; } + //$res .= ''; + + $visuel = $this->view->imageProcess($r->visuel_detail, '', null, 440); + + + fb($r); + $image = $this->view->imageProcess($r->visuel, $r->titre, 230, 230); $url = CubeIT_Navigation_Page::generateAutoUri($r, $datas['seourl_rea']); - //$res .= ''; - $res .= ''; - $res .= '
'; + $res .= ''; + /* $res .= ''; */ + $res .= '
'; $res .= '
' . $image . '
'; - $res .= '
' . $r->titre . '
'; + //$res .= '
' . $r->titre . '
'; $res .= '
'; $res .= ''; // if ($addSpacer) { // $res .= '
'; // } + $test++; + + $count++; } return $res; diff --git a/framework/application/views/scripts/templates/realisations.phtml b/framework/application/views/scripts/templates/realisations.phtml index 87b1d97..b94fe85 100644 --- a/framework/application/views/scripts/templates/realisations.phtml +++ b/framework/application/views/scripts/templates/realisations.phtml @@ -1,5 +1,7 @@ headScript()->addScriptAndStyle('realisations'); +//$datas = Bootstrap::getInstance()->getCMSDatasOfPage($this->id); +//$this->headScriptVariables()->setVariable('realisations', $datas); ?>
markupDotclear($this->titre); ?>
@@ -8,6 +10,8 @@ $this->headScript()->addScriptAndStyle('realisations'); CasestudiesTagsList($this->studies); ?>
+ +
getCMSDatasOfPage($this->id); diff --git a/js/home.js b/js/home.js index 3fad106..5ca3ce1 100644 --- a/js/home.js +++ b/js/home.js @@ -30,7 +30,7 @@ function load_home() { function slideShow() { nbSlides = $('.slide').length; - + currentSlideId = 0; currentSlide=$('.slide:first'); diff --git a/js/realisations.js b/js/realisations.js index 4ef57ed..56a7d86 100644 --- a/js/realisations.js +++ b/js/realisations.js @@ -1,9 +1,142 @@ TO_LOAD_ONCE[TO_LOAD_ONCE.length]='load_realisations();'; var showIds = new Array(); +var isAnim = false; +var currentOpen = 0; +var currentOpenValues; +var detail = ""; +var switchTimer; +var currentSlide = 1; +var autoSlide = true; function load_realisations() { - //initTagsLink(); + //initTagsLink(); + + $(".bloc").click( function () { + + var currentRea = $(this).attr("data-pos"); + + if( !isAnim && currentRea != currentOpen ) { + + isAnim = true; + + var reaWidth = $(this).width() + parseInt($(this).css("margin-right").split("px")[0]); + var reaId = $(this).parent().attr("data-id"); + var reaPerRow = $(this).parent().parent().width() / reaWidth; + + var nbReas = $('.project-photo').length; + + var nbRow = Math.ceil(nbReas / reaPerRow ); + + var reaPos = 1; + var count = 0; + + var cible = $("#realisations-list").find("[data-pos='1']"); + + while( count < currentRea) { + count++; + if( (count % (reaPerRow+1)) == 0 ) { + reaPos++; + cible = $("#realisations-list").find("[data-pos='" + count + "']"); + } + } + + detail = ""; + + + //$.ajax(); + $.ajax({ + url : '/ajax/displayrealisation', + type : 'GET', + data: 'realisation_id=' + reaId, + complete: function(ret) { + + var response = JSON.parse(ret.responseText); + var rea = response.vars.rea; + + currentOpenValues = rea; + + detail += '
'; + detail += '
'; + detail += '
'+rea.titre+'
'; + detail += '
'+rea.legende+'
'; + detail += '
Agence : '+rea.agence+'
'; + detail += '
'+rea.description+'
'; + detail += 'Voir le site'; + detail += '
'; + + var image=new Image(); + image.src=rea.visuel_detail[0]; + + detail += '
'; + detail += '
'; + + preloadSlides(); + + $(".bloc").find('.project-photo').removeClass("gray"); + + if( $( "#detail" ).length > 0) { + $( "#detail" ).slideUp( "slow", function() { + $('#detail').remove(); + $(cible.parent()).before(detail); + $( "#detail" ).slideDown( "slow", function() { + isAnim = false; + addCloseAction(); + currentSlide = 1; + autoSlide = true; + switchTimer = window.setTimeout( nextSlide, 5000); + }).animate( + { opacity: 1 }, + { queue: false, duration: 'slow' } + ); + + }).animate( + { opacity: 0 }, + { queue: false, duration: 'slow' } + ); + }else{ + $(cible.parent()).before(detail); + $( "#detail" ).slideDown( "slow", function() { + isAnim = false; + addCloseAction(); + currentSlide = 1; + autoSlide = true; + switchTimer = window.setTimeout( nextSlide, 5000); + }).animate( + { opacity: 1 }, + { queue: false, duration: 'slow' } + ); + } + + $(".project-photo").each( function() { + var id = $(this).parent().attr("data-pos"); + if( id != currentRea ) { + $(this).addClass("gray"); + } + }); + } + + }); + + + } + currentOpen = currentRea; + }); +} + +function addCloseAction() { + $(".close").click(function() { + $( "#detail" ).slideUp( "slow", function() { + $('#detail').remove(); + currentOpen = 0; + $(".project-photo").each( function() { + $(this).removeClass("gray"); + }); + }).animate( + { opacity: 0 }, + { queue: false, duration: 'slow' } + ); + }); } function initTagsLink() { @@ -18,19 +151,63 @@ function initTagsLink() { var index = $.inArray( $(this).attr("data-id"), showIds ); showIds.splice(index, 1); } - + if( showIds.length > 0 ) { $(".tag:first").removeClass('active'); }else{ $(".tag:first").addClass('active'); } - displayStudies(); + //displayStudies(); //alert(showIds); }); } + +function preloadSlides() { + /* + var i=0; + + $('.slide[data-image]').each(function(){ + var slide=this; + var image=new Image(); + image.src=$(this).attr('data-image'); + + if(image.complete){ + $(this).html(""); + } + + $(image).load(function(){ + $(slide).html(""); + }); + + i++; + });*/ +} + +function nextSlide() { + + var maxSlides = currentOpenValues.visuel_detail.length; + if(maxSlides == 1) autoSlide = false; + + if( autoSlide ) { + + if( currentSlide < maxSlides ) { + currentSlide++; + }else{ + currentSlide=1; + } + + $( "#visuel_detail" ).fadeOut( "slow", function() { + $("#visuel_detail").attr("src", currentOpenValues.visuel_detail[currentSlide-1]); + $( "#visuel_detail" ).fadeIn(); + }); + + switchTimer = window.setTimeout( nextSlide, 5000); + } +} + function displayRealisation( rea ) { //$(rea); @@ -40,3 +217,7 @@ function displayRealisation( rea ) { } +function resize() { + +} + diff --git a/less/realisations.less b/less/realisations.less index 280107d..6c70247 100644 --- a/less/realisations.less +++ b/less/realisations.less @@ -46,7 +46,7 @@ width:230px; float:left; } - + a,a:hover { color:#000; } @@ -55,9 +55,21 @@ width:230px; height:230px; background-color: #ccc; - margin:0 0 5px 0; + margin:0; } - + + .bloc .gray { + filter: grayscale(100%); + -webkit-filter: grayscale(100%); + -moz-filter: grayscale(100%); + -o-filter: grayscale(100%); + -ms-filter: grayscale(100%); + filter: url("data:image/svg+xml;utf8,#grayscale"); /* Firefox 10+, Firefox on Android */ + filter: gray; /* IE6-9 */ + } + + + .bloc .project-title { font-size: 14px; padding: 0 0 20px 0; @@ -65,12 +77,88 @@ } .blocmargin { - margin-right:15px; + margin:0 15px 15px 0; + } .spacer { clear: left; height:20px; } + + #detail { + height:440px; + clear: both; + display:none; + margin-bottom: 15px; + opacity: 0; + filter:alpha(opacity=0); + -moz-opacity:0; + } + + #detail .detailLeft { + float:left; + width:250px; + padding-right:15px; + + .titre { + font-size: 32px; + } + + .legende { + font-size: 14px; + color: #545454; + } + + .agence { + font-size: 14px; + color: #545454; + } + + .description { + font-size: 14px; + color: #545454; + margin-bottom: 20px; + margin-top:20px; + } + + } + + .link { + background-color: #3885e0; + border-radius: 2px; + padding: 5px 20px; + color:#fff; + } + + .link:hover { + background-color: #84ae1e; + color:#fff; + } + + #detail .detailRight { + //float:left; + position: absolute; + right: 0; + + .slides { + overflow: hidden; + width: 1000px; + } + + .close { + position:absolute; + right: 0; + top: 0; + background-image: url('../images/rea_close.jpg'); + width: 62px; + height: 62px; + cursor: pointer; + } + + } + + + +} -} \ No newline at end of file