}\r
\r
$this->view->headScript()->addScriptAndStyle('actualites')\r
- ->addGSAP();\r
+ ->addGSAP();\r
$res = '<div class="updates">';\r
- $res.='<div class="holder">';\r
- $res.='<div class="mask">';\r
- $res.='<div class="slideset">';\r
+ $res .= '<div class="holder">';\r
+ $res .= '<div class="mask">';\r
+ $res .= '<div class="slideset">';\r
foreach ($actus as $a) {\r
- $res.=$this->_actu($a);\r
+ $res .= $this->_actu($a);\r
}\r
- $res.='</div>';\r
- $res.='</div>';\r
- $res.='<div class="btn-area">';\r
- $res.='<a class="btn-prev" title="Actualités plus récente" href="#"></a>';\r
- $res.='<a class="btn-next" title="Actualités plus ancienne" href="#"></a>';\r
- $res.='</div>';\r
- $res.='</div>';\r
- $res.='</div>';\r
+ $res .= '</div>';\r
+ $res .= '</div>';\r
+ $res .= '<div class="btn-area">';\r
+ $res .= '<a class="btn-prev" title="Actualités plus récente" href="#"></a>';\r
+ $res .= '<a class="btn-next" title="Actualités plus ancienne" href="#"></a>';\r
+ $res .= $this->view->link('Voir les actualités', 'internal:news', ['class' => 'news']);\r
+ $res .= '</div>';\r
+ $res .= '</div>';\r
+ $res .= '</div>';\r
return $res;\r
}\r
\r
$res = '<div class="slide">';\r
$p = '';\r
if (!$a['noshowdate']) {\r
- $p.=$this->view->dateTime($a['date'], Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR, array('class' => 'date')) . ' ';\r
+ $p .= $this->view->dateTime($a['date'], Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR, array('class' => 'date')) . ' ';\r
} else {\r
$attrs['class'] = 'nodate';\r
}\r
- $p.=nl2br($a['news']);\r
- $res.=$this->view->htmlElement($p, 'p', $attrs);\r
- $res.='</div>';\r
+ $p .= nl2br($a['news']);\r
+ $res .= $this->view->htmlElement($p, 'p', $attrs);\r
+ $res .= '</div>';\r
return $res;\r
}\r
\r
-(function($) {\r
- function JQactualites(element) {\r
- this.element = element;\r
- this.currentIndex = -1;\r
- this.number = this.element.find('.slide').length;\r
- this.animating = false;\r
- this.init();\r
- }\r
-\r
- JQactualites.prototype = {\r
- init: function() {\r
- var $this = this;\r
-\r
- if (this.number < 2) {\r
- this.element.find('.btn-area').hide();\r
- }\r
-\r
- this.element.find('.btn-area a').click(function() {\r
- if ($(this).hasClass('btn-next')) {\r
- $this.goNext();\r
- } else if ($(this).hasClass('btn-prev')) {\r
- $this.goPrev();\r
- }\r
- return false;\r
- });\r
-\r
- this.gotoIndex(0);\r
- },\r
- goNext: function() {\r
- this.gotoIndex(this.currentIndex + 1);\r
- },\r
- goPrev: function() {\r
- this.gotoIndex(this.currentIndex - 1);\r
- },\r
- gotoIndex: function(index) {\r
-\r
- if (this.animating) {\r
- return;\r
- }\r
- var $this = this;\r
- this.animating = true;\r
- var w = 870;\r
- var d = 0.5;\r
- var dir = -1;\r
- if (index > this.currentIndex) {\r
- dir = 1;\r
- }\r
- dir *= -1;\r
- index = (index + this.number) % this.number;\r
- var nextActu = this.getActu(index);\r
-\r
- if (this.currentIndex == -1) {\r
- $(nextActu).show();\r
- this.arrowsVisibility(index, d);\r
- this.endTransition(index);\r
- return;\r
- }\r
- var currentActu = this.getActu(this.currentIndex);\r
-\r
-\r
- $(nextActu).css('left', w * -dir).show();\r
- TweenMax.to(nextActu, d, {left: 0});\r
- TweenMax.to(currentActu, d, {left: w * dir, onComplete: function() {\r
- $this.endTransition(index);\r
- }\r
- });\r
- this.arrowsVisibility(index, d);\r
-\r
-\r
-\r
-\r
- },\r
- arrowsVisibility: function(index, d) {\r
- var prev = this.element.find('.btn-prev');\r
- var next = this.element.find('.btn-next');\r
- if (index == 0) {\r
- $(prev).fadeOut(d * 1000);\r
- } else {\r
- $(prev).fadeIn(d * 1000);\r
- }\r
-\r
- if (index == this.number - 1) {\r
- $(next).fadeOut(d * 1000);\r
- } else {\r
- $(next).fadeIn(d * 1000);\r
- }\r
- },\r
- getActu: function(index) {\r
- return this.element.find('.slide:eq(' + index + ')');\r
- },\r
- endTransition: function(index) {\r
- this.animating = false;\r
- this.getActu(this.currentIndex).hide();\r
- this.currentIndex = index;\r
- },\r
- };\r
-\r
- jQuery.fn.actualites = function() {\r
- return this.each(function() {\r
- var $this = $(this);\r
- $(this).data('actualites', new JQactualites($this));\r
- })\r
- };\r
+(function ($) {\r
+ function JQactualites(element) {\r
+ this.element = element;\r
+ this.currentIndex = -1;\r
+ this.number = this.element.find('.slide').length;\r
+ this.animating = false;\r
+ this.init();\r
+ }\r
+\r
+ JQactualites.prototype = {\r
+ init: function () {\r
+ var $this = this;\r
+\r
+ if (this.number < 2) {\r
+ this.element.find('.btn-area').hide();\r
+ }\r
+\r
+ this.element.find('.btn-area a').click(function () {\r
+ if ($(this).hasClass('btn-next')) {\r
+ $this.goNext();\r
+ } else if ($(this).hasClass('btn-prev')) {\r
+ $this.goPrev();\r
+ } else {\r
+ return true;\r
+ }\r
+ return false;\r
+ });\r
+\r
+ this.gotoIndex(0);\r
+ },\r
+ goNext: function () {\r
+ this.gotoIndex(this.currentIndex + 1);\r
+ },\r
+ goPrev: function () {\r
+ this.gotoIndex(this.currentIndex - 1);\r
+ },\r
+ gotoIndex: function (index) {\r
+\r
+ if (this.animating) {\r
+ return;\r
+ }\r
+ var $this = this;\r
+ this.animating = true;\r
+ var w = 870;\r
+ var d = 0.5;\r
+ var dir = -1;\r
+ if (index > this.currentIndex) {\r
+ dir = 1;\r
+ }\r
+ dir *= -1;\r
+ index = (index + this.number) % this.number;\r
+ var nextActu = this.getActu(index);\r
+\r
+ if (this.currentIndex == -1) {\r
+ $(nextActu).show();\r
+ this.arrowsVisibility(index, d);\r
+ this.endTransition(index);\r
+ return;\r
+ }\r
+ var currentActu = this.getActu(this.currentIndex);\r
+\r
+\r
+ $(nextActu).css('left', w * -dir).show();\r
+ TweenMax.to(nextActu, d, {left: 0});\r
+ TweenMax.to(currentActu, d, {\r
+ left: w * dir, onComplete: function () {\r
+ $this.endTransition(index);\r
+ }\r
+ });\r
+ this.arrowsVisibility(index, d);\r
+\r
+\r
+ },\r
+ arrowsVisibility: function (index, d) {\r
+ var prev = this.element.find('.btn-prev');\r
+ var next = this.element.find('.btn-next');\r
+ if (index == 0) {\r
+ $(prev).fadeOut(d * 1000);\r
+ } else {\r
+ $(prev).fadeIn(d * 1000);\r
+ }\r
+\r
+ if (index == this.number - 1) {\r
+ $(next).fadeOut(d * 1000);\r
+ } else {\r
+ $(next).fadeIn(d * 1000);\r
+ }\r
+ },\r
+ getActu: function (index) {\r
+ return this.element.find('.slide:eq(' + index + ')');\r
+ },\r
+ endTransition: function (index) {\r
+ this.animating = false;\r
+ this.getActu(this.currentIndex).hide();\r
+ this.currentIndex = index;\r
+ },\r
+ };\r
+\r
+ jQuery.fn.actualites = function () {\r
+ return this.each(function () {\r
+ var $this = $(this);\r
+ $(this).data('actualites', new JQactualites($this));\r
+ })\r
+ };\r
})(jQuery);\r
\r
TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_actualites();';\r
\r
function load_actualites() {\r
- $(".updates").actualites();\r
+ $(".updates").actualites();\r
}\r