]> _ Git - ccgm.git/commitdiff
done #1784 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 1 Dec 2017 18:10:46 +0000 (18:10 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 1 Dec 2017 18:10:46 +0000 (18:10 +0000)
framework/application/views/helpers/Actualites.php
js/actualites.js

index 067972cc9c857b763fd7ca5390a175a31340dda0..5a5ecf5bf1f97168371ecabb1b1fb991af39cf1b 100644 (file)
@@ -1,12 +1,9 @@
 <?php\r
 \r
-class CCGM_View_Helper_Actualites extends Zend_View_Helper_Abstract {\r
+class CCGM_View_Helper_Actualites extends CubeIT_View_Helper_Abstract {\r
 \r
        public function actualites($actus) {\r
-               $actus = $this->_filter($actus);\r
-               if (!count($actus)) {\r
-                       return;\r
-               }\r
+               $actus = CCGM_Model_News::factory()->order('date DESC')->find();\r
 \r
                $this->view->headScript()->addScriptAndStyle('actualites')\r
                        ->addGSAP();\r
@@ -30,41 +27,18 @@ class CCGM_View_Helper_Actualites extends Zend_View_Helper_Abstract {
        }\r
 \r
        protected function _actu($a) {\r
-               $nline = min(substr_count($a['news'], "\n") + 1, 2);\r
+               $nline = 1;\r
 \r
                $attrs = array('data-lines' => $nline);\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
-               } else {\r
-                       $attrs['class'] = 'nodate';\r
-               }\r
-               $p .= nl2br($a['news']);\r
+               $p .= $this->view->dateTime($a->getDate(), Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR, array('class' => 'date')) . ' ';\r
+               $p .= $a->getTitle();\r
                $res .= $this->view->htmlElement($p, 'p', $attrs);\r
                $res .= '</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
index 61e606f78a4170c999edfaad23dc4f631d4d053c..5ff0b42093e80d5edaa5b4b756c2bddb8c26bc2d 100644 (file)
         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
             if (this.animating) {\r
                 return;\r
             }\r
+\r
+            if(this.number==1){\r
+                this.getActu(index).show();\r
+                this.arrowsVisibility(index, 0.5);\r
+                this.endTransition(0);\r
+                return;\r
+            }\r
+\r
             var $this = this;\r
             this.animating = true;\r
             var w = 870;\r
@@ -59,7 +63,6 @@
             }\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
@@ -68,8 +71,6 @@
                 }\r
             });\r
             this.arrowsVisibility(index, d);\r
-\r
-\r
         },\r
         arrowsVisibility: function (index, d) {\r
             var prev = this.element.find('.btn-prev');\r
@@ -91,7 +92,9 @@
         },\r
         endTransition: function (index) {\r
             this.animating = false;\r
-            this.getActu(this.currentIndex).hide();\r
+            if(this.number>1) {\r
+                this.getActu(this.currentIndex).hide();\r
+            }\r
             this.currentIndex = index;\r
         },\r
     };\r