AntonLV 8 tahun lalu
induk
melakukan
ece2b3204d

+ 8 - 0
modules/boonex/russian/data/langs/bx_timeline/ru.xml

@@ -19,6 +19,8 @@
     <string name="_bx_timeline_option_videos_autoplay_off"><![CDATA[Отключено]]></string>
     <string name="_bx_timeline_option_videos_autoplay_on_mute"><![CDATA[Включено (без звука)]]></string>
     <string name="_bx_timeline_option_videos_autoplay_on"><![CDATA[Включено (cо звуком)]]></string>
+    <string name="_bx_timeline_option_enable_hot"><![CDATA[Включить сбор данных для листа 'горячих' сообщений]]></string>
+    <string name="_bx_timeline_option_hot_interval"><![CDATA[Интервал времени (в часах) для получения 'горячих' сообщений]]></string>
 
 	<string name="_bx_timeline_form_post"><![CDATA[Сообщение]]></string>
 	<string name="_bx_timeline_form_post_display_add"><![CDATA[Написать сообщение]]></string>
@@ -76,6 +78,8 @@
 	<string name="_bx_timeline_page_title_view"><![CDATA[Хроника новостей профайла]]></string>
 	<string name="_bx_timeline_page_title_sys_view_home"><![CDATA[Общая хроника новостей]]></string>
     <string name="_bx_timeline_page_title_view_home"><![CDATA[Общая хроника новостей]]></string>
+    <string name="_bx_timeline_page_title_sys_view_hot"><![CDATA[Хроника 'горячих' новостей]]></string>
+    <string name="_bx_timeline_page_title_view_hot"><![CDATA[Хроника 'горячих' новостей]]></string>
 	<string name="_bx_timeline_page_title_sys_item"><![CDATA[Элемент хроники]]></string>
 	<string name="_bx_timeline_page_title_item"><![CDATA[Элемент хроники]]></string>
 	<string name="_bx_timeline_page_title_sys_item_brief"><![CDATA[Предпросмотр элемента хроники]]></string>
@@ -104,6 +108,10 @@
 	<string name="_bx_timeline_page_block_title_view_home"><![CDATA[Общая хроника новостей]]></string>
 	<string name="_bx_timeline_page_block_title_system_view_home_outline"><![CDATA[Общая хроника новостей (сводка)]]></string>
 	<string name="_bx_timeline_page_block_title_view_home_outline"><![CDATA[Общая хроника новостей]]></string>
+	<string name="_bx_timeline_page_block_title_system_view_hot"><![CDATA[Хроника 'горячих' новостей (лента)]]></string>
+    <string name="_bx_timeline_page_block_title_view_hot"><![CDATA[Хроника 'горячих' новостей]]></string>
+    <string name="_bx_timeline_page_block_title_system_view_hot_outline"><![CDATA[Хроника 'горячих' новостей (сводка)]]></string>
+    <string name="_bx_timeline_page_block_title_view_hot_outline"><![CDATA[Хроника 'горячих' новостей]]></string>
 	<string name="_bx_timeline_page_block_title_browse_cmts"><![CDATA[Хроника новостей - Комментарии]]></string>
 
     <string name="_bx_timeline_menu_item_view_all"><![CDATA[Все сообщения]]></string>

+ 16 - 0
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -24,6 +24,9 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
     protected $_iCharsDisplayMaxTitle;
     protected $_sVideosAutoplay;
 
+    protected $_bHot;
+    protected $_iHotInterval;
+
     protected $_sStorageObject;
     protected $_sTranscoderObjectPreview;
     protected $_sTranscoderObjectView;
@@ -236,6 +239,9 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         $this->_iCharsDisplayMax = (int)getParam($sOptionPrefix . 'chars_display_max');
         $this->_iCharsDisplayMaxTitle = 20;
         $this->_sVideosAutoplay = getParam($sOptionPrefix . 'videos_autoplay');
+
+        $this->_bHot = getParam($sOptionPrefix . 'enable_hot') == 'on';
+        $this->_iHotInterval = (int)getParam($sOptionPrefix . 'hot_interval');
     }
 
     public function isAllowEdit()
@@ -253,6 +259,11 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         return $this->_bShowAll;
     }
 
+    public function isHot()
+    {
+        return $this->_bHot;
+    }
+
     public function getPostFormDisplay($sType)
     {
         if(empty($sType) || !array_key_exists($sType, $this->_aTypeToFormDisplay))
@@ -297,6 +308,11 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         return $this->_sVideosAutoplay;
     }
 
+    public function getHotInterval()
+    {
+        return $this->_iHotInterval;
+    }
+
     public function getRepostDefaults()
     {
         return $this->_aRepostDefaults;

+ 79 - 0
modules/boonex/timeline/classes/BxTimelineCronHot.php

@@ -0,0 +1,79 @@
+<?php use Twilio\Rest\Api\V2010\Account\Usage\Record\ThisMonthInstance;
+defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Timeline Timeline
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxTimelineCronHot extends BxDolCron
+{
+	protected $_sModule;
+	protected $_oModule;
+
+	public function __construct()
+    {
+    	$this->_sModule = 'bx_timeline';
+    	$this->_oModule = BxDolModule::getInstance($this->_sModule);
+
+        parent::__construct();
+    }
+
+    function processing()
+    {
+        if(!$this->_oModule->_oConfig->isHot())
+            return;
+
+        $iInterval = $this->_oModule->_oConfig->getHotInterval();
+        $sCommon = $this->_oModule->_oConfig->getPrefix('common_post') . 'post';
+
+        $aSystems = BxDolVote::getSystems();
+        $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1));
+        
+        $aModulesActive = array();
+        foreach($aModules as $aModule)
+            $aModulesActive[] = $aModule['name'];
+
+        $aHandlers = $this->_oModule->_oConfig->getHandlers();
+        $aHandlersHidden = $this->_oModule->_oConfig->getHandlersHidden();
+        foreach($aHandlers as $sKey => $aHandler) {
+            if($aHandler['type'] != BX_BASE_MOD_NTFS_HANDLER_TYPE_INSERT || in_array($aHandler['id'], $aHandlersHidden))
+                continue;
+
+            $bCommon = $aHandler['alert_unit'] == $sCommon;
+            if(!$bCommon && !in_array($aHandler['alert_unit'], $aModulesActive))
+                continue;
+
+            if(!$bCommon) {
+                $oModule = BxDolModule::getInstance($aHandler['alert_unit']);
+                if(empty($oModule->_oConfig->CNF['OBJECT_VOTES']))
+                    continue;
+
+                $sMethod = 'getHotTrackModule';
+                $sModule = $oModule->getName();
+                $sSystem = $oModule->_oConfig->CNF['OBJECT_VOTES'];
+            }
+            else {
+                $sMethod = 'getHotTrack';
+                $sModule = $sCommon;
+                $sSystem = $this->_oModule->_oConfig->getObject('vote');
+            }
+
+            if(!isset($aSystems[$sSystem]) || (int)$aSystems[$sSystem]['is_on'] != 1)
+                continue;
+
+            $aTracks = $this->_oModule->_oDb->$sMethod($sModule, $aSystems[$sSystem]['table_track'], $iInterval);
+            if(empty($aTracks) || !is_array($aTracks))
+                continue;
+
+            foreach($aTracks as $aTrack)
+                $this->_oModule->_oDb->updateHotTrack($aTrack);
+        }
+    }
+}
+
+/** @} */

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

@@ -13,6 +13,7 @@ class BxTimelineDb extends BxBaseModNotificationsDb
 {
     protected $_sTableEvent2User;
     protected $_sTablesRepostTrack;
+    protected $_sTableHotTrack;
 
     protected $_aTablesMedia;
     protected $_aTablesMedia2Events;
@@ -25,6 +26,7 @@ class BxTimelineDb extends BxBaseModNotificationsDb
         parent::__construct($oConfig);
         $this->_sTableEvent2User = $this->_sPrefix . 'events2users';
         $this->_sTableRepostsTrack = $this->_sPrefix . 'reposts_track';
+        $this->_sTableHotTrack = $this->_sPrefix . 'hot_track';
 
         $this->_aTablesMedia = array(
         	BX_TIMELINE_MEDIA_PHOTO => $this->_sPrefix . 'photos',
@@ -275,6 +277,37 @@ class BxTimelineDb extends BxBaseModNotificationsDb
         return $this->getAll($sQuery);
     }
 
+    public function getHotTrack($sModule, $sTableTrack, $iInterval = 24)
+    {
+        $sQuery = "SELECT 
+    			`te`.`id` as `event_id`,
+    			SUM(`tt`.`value`) AS `value`
+    		FROM `" . $this->_sTable . "` AS `te`
+    		INNER JOIN `" . $sTableTrack . "` AS `tt` ON `te`.`id`=`tt`.`object_id` AND `te`.`type`=:module 
+    		WHERE `tt`.`date` > (UNIX_TIMESTAMP() - 3600 * :interval) 
+    		GROUP BY `te`.`id`";
+
+        return $this->getAll($sQuery, array('module' => $sModule, 'interval' => $iInterval));
+    }
+
+    public function getHotTrackModule($sModule, $sTableTrack, $iInterval = 24)
+    {
+        $sQuery = "SELECT 
+    			`te`.`id` as `event_id`,
+    			SUM(`tt`.`value`) AS `value`
+    		FROM `" . $this->_sTable . "` AS `te`
+    		INNER JOIN `" . $sTableTrack . "` AS `tt` ON `te`.`object_id`=`tt`.`object_id` AND `te`.`type`=:module 
+    		WHERE `tt`.`date` > (UNIX_TIMESTAMP() - 3600 * :interval) 
+    		GROUP BY `te`.`object_id`";
+
+        return $this->getAll($sQuery, array('module' => $sModule, 'interval' => $iInterval));
+    }
+
+    public function updateHotTrack($aTrack)
+    {
+        return (int)$this->query("REPLACE INTO `" . $this->_sTableHotTrack . "` SET " . $this->arrayToSQL($aTrack)) > 0;
+    }
+
     protected function _getFilterAddon($iOwnerId, $sFilter)
     {
         switch($sFilter) {
@@ -402,8 +435,10 @@ class BxTimelineDb extends BxBaseModNotificationsDb
 		//--- Check type
 		$sWhereSubclause = "";
 		switch($aParams['type']) {
-		    //--- Site (Public) Feed.
-		    case BX_BASE_MOD_NTFS_TYPE_PUBLIC:
+		    case BX_TIMELINE_TYPE_HOT: //--- Hot (Public) Feed.
+		        $sJoinClause .= " INNER JOIN `{$this->_sTableHotTrack}` ON `{$this->_sTable}`.`id`=`{$this->_sTableHotTrack}`.`event_id`";
+		        
+		    case BX_BASE_MOD_NTFS_TYPE_PUBLIC: //--- Site (Public) Feed.
 		        //--- Apply privacy filter
 		        $aPrivacyGroups = array(BX_DOL_PG_ALL);
 		        if(isLogged())

+ 67 - 2
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -14,6 +14,7 @@ bx_import('BxBaseModNotificationsModule');
 
 define('BX_TIMELINE_TYPE_ITEM', 'view_item');
 define('BX_TIMELINE_TYPE_OWNER_AND_CONNECTIONS', 'owner_and_connections');
+define('BX_TIMELINE_TYPE_HOT', 'hot');
 define('BX_TIMELINE_TYPE_DEFAULT', BX_BASE_MOD_NTFS_TYPE_OWNER);
 
 define('BX_TIMELINE_VIEW_ITEM', 'item');
@@ -888,6 +889,62 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         return $this->_serviceGetBlockViewHome($iProfileId, BX_TIMELINE_VIEW_OUTLINE, $iStart, $iPerPage, $this->_oConfig->getPerPage('home'), $iTimeline, $sFilter, $aModules);
     }
 
+	/**
+     * @page service Service Calls
+     * @section bx_timeline Timeline
+     * @subsection bx_timeline-page_blocks Page Blocks
+     * @subsubsection bx_timeline-get_block_view_hot get_block_view_hot
+     * 
+     * @code bx_srv('bx_timeline', 'get_block_view_hot', [...]); @endcode
+     * 
+     * Get Timeline View block with Hot public events.
+     * 
+     * @param $iProfileId (optional) profile ID. 0 should be used here.
+     * @param $iStart (optional) integer value with a page number. Is used in pagination.
+     * @param $iPerPage (optional) integer value with a number of items per page. Is used in pagination.
+     * @param $iTimeline (optional) integer value determining whether the timeline should be displayed or not. 
+     * @param $sFilter (optional) string value with filter name.
+     * @param $aModules (optional) an array of modules from which the events should be displayed. All available modules are used by default.
+     * @return an array describing a block to display on the site. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
+     * 
+     * @see BxTimelineModule::serviceGetBlockViewHot
+     */
+    /** 
+     * @ref bx_timeline-get_block_view_hot "get_block_view_hot"
+     */
+    public function serviceGetBlockViewHot($iProfileId = 0, $iStart = -1, $iPerPage = -1, $iTimeline = -1, $sFilter = '', $aModules = array())
+    {
+        return $this->_serviceGetBlockViewHot($iProfileId, BX_TIMELINE_VIEW_TIMELINE, $iStart, $iPerPage, $this->_oConfig->getPerPage('home'), $iTimeline, $sFilter, $aModules);
+    }
+
+    /**
+     * @page service Service Calls
+     * @section bx_timeline Timeline
+     * @subsection bx_timeline-page_blocks Page Blocks
+     * @subsubsection bx_timeline-get_block_view_hot_outline get_block_view_hot_outline
+     * 
+     * @code bx_srv('bx_timeline', 'get_block_view_hot_outline', [...]); @endcode
+     * 
+     * Get Outline View block with Hot public events.
+     * 
+     * @param $iProfileId (optional) profile ID. 0 should be used here.
+     * @param $iStart (optional) integer value with a page number. Is used in pagination.
+     * @param $iPerPage (optional) integer value with a number of items per page. Is used in pagination.
+     * @param $iTimeline (optional) integer value determining whether the timeline should be displayed or not. 
+     * @param $sFilter (optional) string value with filter name.
+     * @param $aModules (optional) an array of modules from which the events should be displayed. All available modules are used by default.
+     * @return an array describing a block to display on the site. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
+     * 
+     * @see BxTimelineModule::serviceGetBlockViewHotOutline
+     */
+    /** 
+     * @ref bx_timeline-get_block_view_hot_outline "get_block_view_hot_outline"
+     */
+	public function serviceGetBlockViewHotOutline($iProfileId = 0, $iStart = -1, $iPerPage = -1, $iTimeline = -1, $sFilter = '', $aModules = array())
+    {
+        return $this->_serviceGetBlockViewHot($iProfileId, BX_TIMELINE_VIEW_OUTLINE, $iStart, $iPerPage, $this->_oConfig->getPerPage('home'), $iTimeline, $sFilter, $aModules);
+    }
+
     /**
      * @page service Service Calls
      * @section bx_timeline Timeline
@@ -2239,8 +2296,16 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         $sRssUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'rss/' . BX_BASE_MOD_NTFS_TYPE_PUBLIC . '/';
         BxDolTemplate::getInstance()->addPageRssLink(_t('_bx_timeline_page_title_view_home'), $sRssUrl);
 
-        return $this->_serviceGetBlockViewByType($iProfileId, $sView, BX_BASE_MOD_NTFS_TYPE_PUBLIC, $iStart, $iPerPage, $this->_oConfig->getPerPage('home'), $iTimeline, $sFilter, $aModules);
-    } 
+        return $this->_serviceGetBlockViewByType($iProfileId, $sView, BX_BASE_MOD_NTFS_TYPE_PUBLIC, $iStart, $iPerPage, $iPerPageDefault, $iTimeline, $sFilter, $aModules);
+    }
+
+    protected function _serviceGetBlockViewHot($iProfileId = 0, $sView = BX_TIMELINE_VIEW_DEFAULT, $iStart = -1, $iPerPage = -1, $iPerPageDefault = -1,  $iTimeline = -1, $sFilter = '', $aModules = array())
+    {
+        $sRssUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'rss/' . BX_TIMELINE_TYPE_HOT . '/';
+        BxDolTemplate::getInstance()->addPageRssLink(_t('_bx_timeline_page_title_view_hot'), $sRssUrl);
+
+        return $this->_serviceGetBlockViewByType($iProfileId, $sView, BX_TIMELINE_TYPE_HOT, $iStart, $iPerPage, $iPerPageDefault, $iTimeline, $sFilter, $aModules);
+    }
 
     protected function _serviceGetBlockViewByType($iProfileId = 0, $sView = BX_TIMELINE_VIEW_DEFAULT, $sType = BX_TIMELINE_TYPE_DEFAULT, $iStart = -1, $iPerPage = -1, $iPerPageDefault = -1,  $iTimeline = -1, $sFilter = '', $aModules = array())
     {

+ 8 - 0
modules/boonex/timeline/install/langs/en.xml

@@ -19,6 +19,8 @@
 	<string name="_bx_timeline_option_videos_autoplay_off"><![CDATA[Disabled]]></string>
 	<string name="_bx_timeline_option_videos_autoplay_on_mute"><![CDATA[Enabled without sound]]></string>
 	<string name="_bx_timeline_option_videos_autoplay_on"><![CDATA[Enabled with sound]]></string>
+	<string name="_bx_timeline_option_enable_hot"><![CDATA[Enable Hot list aggregation]]></string>
+	<string name="_bx_timeline_option_hot_interval"><![CDATA[Interval of time (in hours) to get Hot events]]></string>	
 
 	<string name="_bx_timeline_form_post"><![CDATA[Post]]></string>
 	<string name="_bx_timeline_form_post_display_add"><![CDATA[Write Post]]></string>
@@ -76,6 +78,8 @@
 	<string name="_bx_timeline_page_title_view"><![CDATA[Profile Feed]]></string>
 	<string name="_bx_timeline_page_title_sys_view_home"><![CDATA[Public Feed]]></string>
     <string name="_bx_timeline_page_title_view_home"><![CDATA[Public Feed]]></string>
+    <string name="_bx_timeline_page_title_sys_view_hot"><![CDATA[Hot Feed]]></string>
+    <string name="_bx_timeline_page_title_view_hot"><![CDATA[Hot Feed]]></string>
 	<string name="_bx_timeline_page_title_sys_item"><![CDATA[Feed Item]]></string>
 	<string name="_bx_timeline_page_title_item"><![CDATA[Feed Item]]></string>
 	<string name="_bx_timeline_page_title_sys_item_brief"><![CDATA[Feed Item Preview]]></string>
@@ -104,6 +108,10 @@
 	<string name="_bx_timeline_page_block_title_view_home"><![CDATA[Public Feed]]></string>
 	<string name="_bx_timeline_page_block_title_system_view_home_outline"><![CDATA[Public Feed (Outline)]]></string>
 	<string name="_bx_timeline_page_block_title_view_home_outline"><![CDATA[Public Feed]]></string>
+	<string name="_bx_timeline_page_block_title_system_view_hot"><![CDATA[Hot Feed (Timeline)]]></string>
+    <string name="_bx_timeline_page_block_title_view_hot"><![CDATA[Hot Feed]]></string>
+    <string name="_bx_timeline_page_block_title_system_view_hot_outline"><![CDATA[Hot Feed (Outline)]]></string>
+    <string name="_bx_timeline_page_block_title_view_hot_outline"><![CDATA[Hot Feed]]></string>
 	<string name="_bx_timeline_page_block_title_browse_cmts"><![CDATA[Feeds' Comments]]></string>
 
     <string name="_bx_timeline_menu_item_view_all"><![CDATA[All posts]]></string>

+ 4 - 0
modules/boonex/timeline/install/sql/disable.sql

@@ -62,3 +62,7 @@ DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_timeline';
 
 -- CONTENT INFO
 DELETE FROM `sys_objects_content_info` WHERE `name` IN ('bx_timeline', 'bx_timeline_cmts');
+
+
+-- CRON
+DELETE FROM `sys_cron_jobs` WHERE `name` LIKE 'bx_timeline%';

+ 12 - 1
modules/boonex/timeline/install/sql/enable.sql

@@ -2,6 +2,7 @@
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_timeline_view', '_bx_timeline_page_title_sys_view', '_bx_timeline_page_title_view', 'bx_timeline', 5, 2147483647, 1, 'timeline-view', 'page.php?i=timeline-view', '', '', '', 0, 1, 0, 'BxTimelinePageView', 'modules/boonex/timeline/classes/BxTimelinePageView.php'),
 ('bx_timeline_view_home', '_bx_timeline_page_title_sys_view_home', '_bx_timeline_page_title_view_home', 'bx_timeline', 5, 2147483647, 1, 'timeline-view-home', 'page.php?i=timeline-view-home', '', '', '', 0, 1, 0, '', ''),
+('bx_timeline_view_hot', '_bx_timeline_page_title_sys_view_hot', '_bx_timeline_page_title_view_hot', 'bx_timeline', 5, 2147483647, 1, 'timeline-view-hot', 'page.php?i=timeline-view-hot', '', '', '', 0, 1, 0, '', ''),
 
 ('bx_timeline_item', '_bx_timeline_page_title_sys_item', '_bx_timeline_page_title_item', 'bx_timeline', 5, 2147483647, 1, 'item', 'page.php?i=item', '', '', '', 0, 1, 0, '', ''),
 ('bx_timeline_item_brief', '_bx_timeline_page_title_sys_item_brief', '_bx_timeline_page_title_item_brief', 'bx_timeline', 2, 2147483647, 1, 'item-quick', 'page.php?i=item-quick', '', '', '', 0, 1, 0, '', '');
@@ -15,6 +16,9 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `
 ('bx_timeline_view_home', 1, 'bx_timeline', '_bx_timeline_page_block_title_system_view_home', '_bx_timeline_page_block_title_view_home', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:19:"get_block_view_home";}', 0, 0, 0, 2),
 ('bx_timeline_view_home', 1, 'bx_timeline', '_bx_timeline_page_block_title_system_view_home_outline', '_bx_timeline_page_block_title_view_home_outline', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:27:"get_block_view_home_outline";}', 0, 0, 1, 3),
 
+('bx_timeline_view_hot', 1, 'bx_timeline', '_bx_timeline_page_block_title_system_view_hot', '_bx_timeline_page_block_title_view_hot', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:18:"get_block_view_hot";}', 0, 1, 0, 1),
+('bx_timeline_view_hot', 1, 'bx_timeline', '_bx_timeline_page_block_title_system_view_hot_outline', '_bx_timeline_page_block_title_view_hot_outline', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:26:"get_block_view_hot_outline";}', 0, 1, 1, 2),
+
 ('bx_timeline_item', 1, 'bx_timeline', '', '_bx_timeline_page_block_title_item', 0, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:14:"get_block_item";}', 0, 0, 1, 1),
 ('bx_timeline_item', 1, 'bx_timeline', '', '_bx_timeline_page_block_title_item_comments', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:23:"get_block_item_comments";}', 0, 0, 1, 2),
 
@@ -138,7 +142,9 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 ('bx_timeline_rss_length', '5', @iCategId, '_bx_timeline_option_rss_length', 'digit', '', '', '', '', 20),
 ('bx_timeline_events_hide', '', @iCategId, '_bx_timeline_option_events_hide', 'rlist', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:21:"get_actions_checklist";}', 30),
 ('bx_timeline_chars_display_max', '300', @iCategId, '_bx_timeline_option_chars_display_max', 'digit', 'GreaterThan', 'a:1:{s:3:"min";i:150;}', '_bx_timeline_option_err_chars_display_max', '', 40),
-('bx_timeline_videos_autoplay', 'off', @iCategId, '_bx_timeline_option_videos_autoplay', 'select', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:27:"get_options_videos_autoplay";}', 50);
+('bx_timeline_videos_autoplay', 'off', @iCategId, '_bx_timeline_option_videos_autoplay', 'select', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:27:"get_options_videos_autoplay";}', 50),
+('bx_timeline_enable_hot', '', @iCategId, '_bx_timeline_option_enable_hot', 'checkbox', '', '', '', '', 60),
+('bx_timeline_hot_interval', '48', @iCategId, '_bx_timeline_option_hot_interval', 'digit', '', '', '', '', 61);
 
 
 -- PRIVACY 
@@ -282,3 +288,8 @@ INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `B
 INSERT INTO `sys_objects_content_info` (`name`, `title`, `alert_unit`, `alert_action_add`, `alert_action_update`, `alert_action_delete`, `class_name`, `class_file`) VALUES
 ('bx_timeline', '_bx_timeline', 'bx_timeline', 'post_common', '', 'delete', '', ''),
 ('bx_timeline_cmts', '_bx_timeline_cmts', 'bx_timeline', 'commentPost', 'commentUpdated', 'commentRemoved', 'BxDolContentInfoCmts', '');
+
+
+-- CRON
+INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
+('bx_timeline_hot', '0 * * * *', 'BxTimelineCronHot', 'modules/boonex/timeline/classes/BxTimelineCronHot.php', '');

+ 8 - 0
modules/boonex/timeline/install/sql/install.sql

@@ -249,6 +249,14 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_reports_track` (
   KEY `report` (`object_id`, `author_nip`)
 );
 
+-- TABLE: hot track
+CREATE TABLE IF NOT EXISTS `bx_timeline_hot_track` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `event_id` int(11) NOT NULL default '0',
+  `value` tinyint(4) NOT NULL default '0',
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `event_id` (`event_id`)
+);
 
 -- STORAGES, TRANSCODERS, UPLOADERS
 SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');

+ 2 - 0
modules/boonex/timeline/install/sql/uninstall.sql

@@ -31,6 +31,8 @@ DROP TABLE IF EXISTS `bx_timeline_meta_mentions`;
 DROP TABLE IF EXISTS `bx_timeline_reports`;
 DROP TABLE IF EXISTS `bx_timeline_reports_track`;
 
+DROP TABLE IF EXISTS `bx_timeline_hot_track`;
+
 
 -- STORAGES, TRANSCODERS, UPLOADERS
 DELETE FROM `sys_objects_uploader` WHERE `object` LIKE 'bx_timeline%';