Browse Source

#24 - Timeline.

AntonLV 13 years ago
parent
commit
da8d1a673f

+ 4 - 2
modules/boonex/timeline/classes/BxTimelineDb.php

@@ -246,7 +246,9 @@ class BxTimelineDb extends BxDolModuleDb
                 `te`.`action` AS `action`,
                 `te`.`content` AS `content`,
                 `te`.`date` AS `date`,
-                ROUND((UNIX_TIMESTAMP() - `te`.`date`)/86400) AS `ago_days`
+                DAYOFYEAR(FROM_UNIXTIME(`te`.`date`)) AS `day_date`,
+                DAYOFYEAR(NOW()) AS `day_now`,
+                (UNIX_TIMESTAMP() - `te`.`date`)/86400 AS `ago_days`
             FROM `" . $this->_sPrefix . "events` AS `te`
             LEFT JOIN `" . $this->_sPrefix . "handlers` AS `th` ON `te`.`type`=`th`.`alert_unit` AND `te`.`action`=`th`.`alert_action` " . $sJoinClause . " 
             WHERE 1 " . $sWhereClause . " " . $sOrderClause . " " . $sLimitClause;
@@ -260,7 +262,7 @@ class BxTimelineDb extends BxDolModuleDb
         if(empty($aEvent) || !is_array($aEvent))
             return 0;
 
-        return (int)$aEvent['ago_days'];
+        return $aEvent['day_date'] == $aEvent['day_now'] ? (int)floor($aEvent['ago_days']) : (int)ceil($aEvent['ago_days']);
     }
     
     

+ 0 - 10
modules/boonex/timeline/js/main.js

@@ -20,16 +20,6 @@ BxTimelineMain.prototype.initMasonry = function() {
 		oItems.addClass(this.sClassMasonry).masonry({
 		  itemSelector: '.bx-tl-item',
 		  columnWidth: '.bx-tl-grid-sizer'
-		}).masonry('on', 'layoutComplete', function() {
-			$('img.bx-tl-item-image').each(function() {
-				var oImg = $(this);
-
-				/*
-				var iImgWrpWidth = oImg.parents('div.bx-tl-item-image:first').width();
-				if(iImgWrpWidth < oImg.width())
-					oImg.width(iImgWrpWidth);
-				*/
-			});
 		});
 	}
 };