--- /dev/null
+.updates {
+ background:#f4f1f1;
+ position: relative;
+ font-weight:400;
+ font-style:italic;
+ font-size:14px;
+ line-height:31px;
+}
+.updates .holder{
+ margin:0 auto;
+ width:981px;
+ position:relative;
+ padding: 19px 0 16px;
+ background-image:url(../images/news.svg);
+ background-position: 0 50%;
+}
+.updates .mask {
+ position: relative;
+ overflow: hidden;
+ width: 910px;
+}
+.updates .slideset {
+ position: relative;
+ overflow: hidden;
+ width: 870px;
+ height: 30px;
+ left:39px;
+}
+.updates .slide {
+ width: 870px;
+ display:none;
+ position:absolute;
+ top:0px;
+}
+.updates .btn-prev,
+.updates .btn-next {
+ width: 30px;
+ height: 31px;
+ text-indent: -9999px;
+ overflow: hidden;
+ bottom: 68px;
+ float:left;
+ background-image: url(../images/arrow-news-left.svg);
+ background-size: 30px 30px;
+}
+.updates .btn-next {
+ margin:0 0 0 5px;
+ background-image: url(../images/arrow-news-right.svg);
+}
+.updates .btn-area{
+ position:absolute;
+ right:0;
+ top:20px;
+}
+.updates p{white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
+.updates .date{
+ font-weight:500;
+ margin: 0 5px 0 0;
+ font-style:italic;
+}
\ No newline at end of file
padding: 0 0 0 17px;
}
.services .col p{margin:0 0 17px;}
-.updates {
- background:#f4f1f1;
- position: relative;
- font-weight:400;
- font-style:italic;
- font-size:14px;
- line-height:31px;
-}
-.updates .holder{
- margin:0 auto;
- width:981px;
- position:relative;
- padding: 19px 0 16px;
- background-image:url(../images/news.svg);
- background-position: 0 50%;
-}
-.updates .mask {
- position: relative;
- overflow: hidden;
- width: 910px;
-}
-.updates .slideset {
- width: 9999px;
- float: left;
-}
-.updates .slide {
- width: 910px;
- float: left;
-}
-.updates .btn-prev,
-.updates .btn-next {
- width: 30px;
- height: 31px;
- text-indent: -9999px;
- overflow: hidden;
- bottom: 68px;
- float:left;
- background-image: url(../images/arrow-news-left.svg);
- background-size: 30px 30px;
-}
-.updates .btn-next {
- margin:0 0 0 5px;
- background-image: url(../images/arrow-news-right.svg);
-}
-.updates .btn-area{
- position:absolute;
- right:0;
- top:20px;
-}
-.updates p{margin:0 0 0 39px;}
-.updates .date{
- font-weight:500;
- margin: 0 5px 0 0;
- font-style:italic;
-}
\ No newline at end of file
<?php
-class CCGM_Form_CMS_Home extends CCGM_Form_CMS{
- public function init(){
+class CCGM_Form_CMS_Home extends CCGM_Form_CMS {
+
+ public function init() {
parent::init();
+
+ $actualites = new CCGM_Form_CMS_Sub_Home_Actualites();
+ $actualites->setLegend('Actualités');
+ $this->addSubForm($actualites, 'actualites');
}
+
}
-?>
--- /dev/null
+<?php\r
+\r
+class CCGM_Form_CMS_Sub_Home_Actualite extends CubeIT_Form_SubForm {\r
+\r
+ public function init() {\r
+ parent::init();\r
+\r
+ $date = new CubeIT_Form_Element_Date('date');\r
+ $date->setLabel('Date');\r
+ $date->setPrecision(CubeIT_Date::DAY);\r
+ $this->addElement($date);\r
+\r
+ $news = new Zend_Form_Element_Textarea('news');\r
+ $news->setLabel('Information');\r
+ $news->setAttrib('rows', 2);\r
+ $this->addElement($news);\r
+\r
+ $lien = new CubeIT_Form_Element_Link();\r
+ $lien->setLabel('Lien');\r
+ $lien->removeElement('label');\r
+ $this->addSubForm($lien, 'lien');\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+<?php\r
+\r
+class CCGM_Form_CMS_Sub_Home_Actualites extends CubeIT_Form_Multi_SubForm {\r
+\r
+ public function init() {\r
+ parent::init();\r
+\r
+ $actualite = new CCGM_Form_CMS_Sub_Home_Actualite();\r
+ $this->setBaseSubForm($actualite);\r
+ $this->setBaseLegend('Edition de l`actualité « $news »');\r
+ $this->setNewLegend('Nouvelle actualité');\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+<?php\r
+\r
+class CCGM_View_Helper_Actualites extends Zend_View_Helper_Abstract {\r
+\r
+ public function actualites($actus) {\r
+ $actus = $this->_filter($actus);\r
+ if (!count($actus)) {\r
+ return;\r
+ }\r
+\r
+ $this->view->headScript()->addScriptAndStyle('actualites')\r
+ ->addGSAP();\r
+ $res = '<div class="updates">';\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
+ }\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
+ return $res;\r
+ }\r
+\r
+ protected function _actu($a) {\r
+ $res = '<div class="slide"><p>';\r
+ $res.=$this->view->dateTime($a['date'], Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR, array('class' => 'date')) . ' ';\r
+ $res.=$a['news'];\r
+ $res.='</p></div>';\r
+ return $res;\r
+ }\r
+\r
+ protected function _filter($actus) {\r
+ $res = array();\r
+ foreach ($actus as $a) {\r
+ if (trim($a['news']) == '') {\r
+ continue;\r
+ }\r
+ $res[] = $a;\r
+ }\r
+\r
+ usort($res, array($this, '_sort'));\r
+ return $res;\r
+ }\r
+\r
+ protected function _sort($a, $b) {\r
+ $da = new Zend_Date($a['date'], CubeIT_Date::MYSQL);\r
+ $db = new Zend_Date($b['date'], CubeIT_Date::MYSQL);\r
+\r
+ return -1 * $da->compare($db);\r
+ }\r
+\r
+}\r
</div>\r
</section>\r
</div>\r
-<div class="updates">\r
- <div class="holder">\r
- <div class="mask">\r
- <div class="slideset">\r
- <div class="slide"><p><time datetime="2013-02-13" class="date">13/02/2013</time> Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe autem quibusdam et aut officiis debitis </p></div>\r
- <div class="slide"><p><time datetime="2013-02-13" class="date">13/02/2013</time> Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe autem quibusdam et aut officiis debitis </p></div>\r
- <div class="slide"><p><time datetime="2013-02-13" class="date">13/02/2013</time> Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe autem quibusdam et aut officiis debitis </p></div>\r
- </div>\r
- </div>\r
- <div class="btn-area">\r
- <a class="btn-prev" href="#">Previous</a>\r
- <a class="btn-next" href="#">Next</a>\r
- </div>\r
- </div>\r
-</div>
\ No newline at end of file
+<?php\r
+\r
+echo $this->actualites($this->actualites);\r
+?>
\ No newline at end of file
--- /dev/null
+(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 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.endTransition(index);\r
+ return;\r
+ }\r
+ var currentActu = this.getActu(this.currentIndex);\r
+ var w = 870;\r
+\r
+ $(nextActu).css('left', w * -dir).show();\r
+ TweenMax.to(nextActu, 0.5, {left: 0});\r
+ TweenMax.to(currentActu, 0.5, {left: w * dir, onComplete: function() {\r
+ $this.endTransition(index);\r
+ }\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
+ if (this.currentIndex == 0) {\r
+ TweenMax.to(this.element.find('.btn-prev'), 0.5, {opacity: 0});\r
+ } else {\r
+\r
+ }\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
+}\r