Explorar o código

Ticket #4844 - Reputation module.

AntonLV hai 1 ano
pai
achega
d29a7738f1

+ 5 - 0
modules/boonex/reputation/classes/BxReputationConfig.php

@@ -28,9 +28,14 @@ class BxReputationConfig extends BxBaseModNotificationsConfig
             'FIELD_LEVEL_NAME' => 'name',
             'FIELD_LEVEL_ICON' => 'icon',
 
+            // page URIs
+            'URL_LEADERBOARD' => 'page.php?i=leaderboard',
+            'URL_HISTORY' => 'page.php?i=points-history',
+
             // some params
             'PARAM_MULTILEVEL' => 'bx_reputation_enable_multilevel',
             'PARAM_LEADERBOARD_LIMIT' => 'bx_reputation_leaderboard_limit',
+            'PARAM_HISTORY_LIMIT' => 'bx_reputation_history_limit',
 
             // objects
             'OBJECT_FORM_HANDLER' => 'bx_reputation_handler',

+ 40 - 5
modules/boonex/reputation/classes/BxReputationDb.php

@@ -37,19 +37,30 @@ class BxReputationDb extends BxBaseModNotificationsDb
         $aMethod = ['name' => 'getAll', 'params' => [0 => 'query']];
         $sSelectClause = '*';
         $sWhereClause = $sGroupClause = $sOrderClause = $sLimitClause = '';
-        
+
         switch($aParams['sample']) {
+            case 'owner_id':
+                $aMethod['params'][1] = [
+                    'owner_id' => $aParams['owner_id']
+                ];
+
+                $sWhereClause = 'AND `owner_id`=:owner_id';
+                $sOrderClause = '`date` DESC';
+                if(isset($aParams['start'], $aParams['limit']))
+                    $sLimitClause = $aParams['start'] . ', ' . $aParams['limit'];
+                break;
+
             case 'stats':
                 $aMethod['name'] = 'getPairs';
                 $aMethod['params'][1] = 'owner_id';
                 $aMethod['params'][2] = 'points';
                 $aMethod['params'][3] = [];
-                
+
                 $sSelectClause = '`owner_id`, SUM(`points`) AS `points`';
 
                 if(!empty($aParams['days']))
                     $sWhereClause = $this->prepareAsString('AND `date` >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL ? DAY))', (int)$aParams['days']);
-                
+
                 $sGroupClause = '`owner_id`';
                 $sOrderClause = '`points` DESC';
                 $sLimitClause = '0, ' . (int)$aParams['limit'];
@@ -75,7 +86,7 @@ class BxReputationDb extends BxBaseModNotificationsDb
 
         $aMethod = ['name' => 'getAll', 'params' => [0 => 'query']];
         $sSelectClause = '`trl`.*';
-        $sJoinClause = $sWhereClause = '';
+        $sJoinClause = $sWhereClause = $sOrderClause = '';
 
         if(!empty($aParams))
             switch($aParams['sample']) {
@@ -104,12 +115,36 @@ class BxReputationDb extends BxBaseModNotificationsDb
 
                     $sWhereClause = "AND `trl`.`points_in` <= :points AND IF(`trl`.`points_out` <> 0, `trl`.`points_out` > :points, 1)";
                     break;
+
+                case 'id':
+                    $aMethod['name'] = 'getRow';
+                    $aMethod['params'][1] = [
+                        'id' => $aParams['id']
+                    ];
+
+                    $sWhereClause = "AND `trl`.`id` = :id";
+                    break;
+                
+                case 'all':
+                    if(isset($aParams['active'])) {
+                        $aMethod['params'][1] = [
+                            'active' => (int)$aParams['active'] ? 1 : 0
+                        ];
+
+                        $sWhereClause = "AND `trl`.`active` = :active";
+                    }
+
+                    $sOrderClause = "`trl`.`order` ASC";
+                    break;
             }
 
+        if(!empty($sOrderClause))
+            $sOrderClause = "ORDER BY " . $sOrderClause;
+
         $aMethod['params'][0] = "SELECT 
                 " . $sSelectClause . " 
             FROM `" . $CNF['TABLE_LEVELS'] . "` AS `trl` " . $sJoinClause . " 
-            WHERE 1 " . $sWhereClause;
+            WHERE 1 " . $sWhereClause . " " . $sOrderClause;
 
         return call_user_func_array([$this, $aMethod['name']], $aMethod['params']);
     }

+ 3 - 17
modules/boonex/reputation/classes/BxReputationGridHandlers.php

@@ -42,7 +42,7 @@ class BxReputationGridHandlers extends BxTemplGrid
         $aUnits = $this->_oModule->_oDb->getHandlers(['type' => 'alert_units_list']);
         if(!empty($aUnits) && is_array($aUnits))
             foreach($aUnits as $sUnit) 
-                $this->_aFilter1Values[$sUnit] = $this->_getTitleByUnit($sUnit);
+                $this->_aFilter1Values[$sUnit] = $this->_oModule->getUnitTitle($sUnit);
 
     	$sFilter1 = bx_get($this->_sFilter1Name);
         if(!empty($sFilter1)) {
@@ -124,12 +124,12 @@ class BxReputationGridHandlers extends BxTemplGrid
 
     protected function _getCellAlertUnit($mixedValue, $sKey, $aField, $aRow)
     {
-        return self::_getCellDefault($this->_getTitleByUnit($mixedValue), $sKey, $aField, $aRow);
+        return self::_getCellDefault($this->_oModule->getUnitTitle($mixedValue), $sKey, $aField, $aRow);
     }
     
     protected function _getCellAlertAction($mixedValue, $sKey, $aField, $aRow)
     {
-        return self::_getCellDefault(_t('_bx_reputation_grid_column_value_hdr_aa_' . $mixedValue), $sKey, $aField, $aRow);
+        return self::_getCellDefault($this->_oModule->getActionTitle($mixedValue), $sKey, $aField, $aRow);
     }
 
     protected function _getFilterControls()
@@ -235,20 +235,6 @@ class BxReputationGridHandlers extends BxTemplGrid
 
         return $aIds;
     }
-    
-    protected function _getTitleByUnit($sUnit)
-    {
-        if(($sKey = '_' . $sUnit) && ($_sKey = _t($sKey)) && strcmp($sKey, $_sKey) != 0)
-            return $_sKey;
-
-        if(($sKey = '_bx_reputation_grid_column_title_hdr_au_' . $sUnit) && ($_sKey = _t($sKey)) && strcmp($sKey, $_sKey) != 0)
-            return $_sKey;
-
-        if(($iPosition = strpos($sUnit, '_fans')) !== false)
-            return _t('_bx_reputation_grid_column_title_hdr_au_module_fans', _t('_' . substr($sUnit, 0, $iPosition)));
-
-        return $sUnit;
-    }
 }
 
 /** @} */

+ 39 - 0
modules/boonex/reputation/classes/BxReputationModule.php

@@ -56,6 +56,16 @@ class BxReputationModule extends BxBaseModNotificationsModule
             'profile_id' => $iProfileId
         ]);
     }
+    
+    public function serviceGetBlockPoints()
+    {
+        return 'TODO: Block with Unit + Action --- points';
+    }
+
+    public function serviceGetBlockLevels()
+    {
+        return $this->_oTemplate->getBlockLevels();
+    }
 
     public function serviceGetBlockSummary($iProfileId = 0)
     {
@@ -67,6 +77,16 @@ class BxReputationModule extends BxBaseModNotificationsModule
         return $this->_oTemplate->getBlockSummary($iProfileId);
     }
 
+    public function serviceGetBlockHistory($iProfileId = 0, $iStart = 0, $iLimit = 0)
+    {
+        if(!$iProfileId && ($iLoggedId = bx_get_logged_profile_id()))
+            $iProfileId = $iLoggedId;
+        if(!$iProfileId)
+            return false;
+
+        return $this->_oTemplate->getBlockHistory($iProfileId, $iStart, $iLimit);
+    }
+
     public function serviceGetBlockLeaderboard($iDays = 0)
     {
         return $this->_oTemplate->getBlockLeaderboard($iDays);
@@ -118,6 +138,25 @@ class BxReputationModule extends BxBaseModNotificationsModule
 
         return false;
     }
+
+    public function  getUnitTitle($sUnit)
+    {
+        if(($sKey = '_' . $sUnit) && ($_sKey = _t($sKey)) && strcmp($sKey, $_sKey) != 0)
+            return $_sKey;
+
+        if(($sKey = '_bx_reputation_txt_au_' . $sUnit) && ($_sKey = _t($sKey)) && strcmp($sKey, $_sKey) != 0)
+            return $_sKey;
+
+        if(($iPosition = strpos($sUnit, '_fans')) !== false)
+            return _t('_bx_reputation_txt_au_module_fans', _t('_' . substr($sUnit, 0, $iPosition)));
+
+        return $sUnit;
+    }
+
+    public function  getActionTitle($sAction)
+    {
+        return _t('_bx_reputation_txt_aa_' . $sAction);
+    }
 }
 
 /** @} */

+ 107 - 2
modules/boonex/reputation/classes/BxReputationTemplate.php

@@ -16,8 +16,61 @@ class BxReputationTemplate extends BxBaseModNotificationsTemplate
         parent::__construct($oConfig, $oDb);
     }
 
+    public function getBlockLevels()
+    {
+        $oFunctions = BxTemplFunctions::getInstance();
+
+        $aLevels = $this->_oDb->getLevels([
+            'sample' => 'all', 
+            'active' => true
+        ]);
+
+        $aTmplVarsLevels = [];
+        foreach($aLevels as $aLevel) {
+            list($sIconFont, $sIconUrl, $sIconA, $sIconHtml) = $oFunctions->getIcon($aLevel['icon']);
+            $bIconFont = !empty($sIconFont);
+            $bIconHtml = !empty($sIconHtml);
+
+            $aTmplVarsLevels[] = array_merge([
+                'id' => $aLevel['id'],
+                'name' => $aLevel['name'],
+                'title' => _t($aLevel['title']),
+                'icon' => $aLevel['icon'],
+                'points_in' => (int)$aLevel['points_in'],
+                'points_out' => (int)$aLevel['points_out'],
+            ], (!$this->_bIsApi ? [
+                'bx_if:icon' => [
+                    'condition' => $bIconFont || $bIconHtml,
+                    'content' => [
+                        'bx_if:icon_font' => [
+                            'condition' => $bIconFont,
+                            'content' => [
+                                'icon' => $sIconFont
+                            ]
+                        ],
+                        'bx_if:icon_html' => [
+                            'condition' => $bIconHtml,
+                            'content' => [
+                                'icon' => $sIconHtml
+                            ]
+                        ],
+                    ]
+                ],
+                'points' => _t('_bx_reputation_txt_from_to', (int)$aLevel['points_in'], (int)$aLevel['points_out'])
+            ] : [
+                'icon' => $bIconHtml ? $sIconHtml : ''
+            ]));
+        }
+
+        return $this->parseHtmlByName('block_levels.html', [
+            'bx_repeat:levels' => $aTmplVarsLevels
+        ]);
+    }
+
     public function getBlockSummary($iProfileId)
     {
+        $CNF = &$this->_oConfig->CNF;
+
         $oProfile = BxDolProfile::getInstance($iProfileId);
         if(!$oProfile)
             return false;
@@ -59,15 +112,19 @@ class BxReputationTemplate extends BxBaseModNotificationsTemplate
                 ],
                 'title' => $sTitle
             ] : [
+                'name' => $aProfileLevel['name'],
+                'title' => $sTitle,
                 'icon' => $bIconHtml ? $sIconHtml : '',
-                'title' => $sTitle
             ];
         }
 
+        $iProfilePoints = $bProfileInfo ? (int)$aProfileInfo['points'] : 0;
+        
         if($this->_bIsApi)
             return [
                 bx_api_get_block('reputation_summary', [
                     'author_data' => BxDolProfile::getData($iProfileId),
+                    'points' => $iProfilePoints,
                     'levels' => $aTmplVarsLevels,
                 ])
             ];
@@ -75,11 +132,59 @@ class BxReputationTemplate extends BxBaseModNotificationsTemplate
         return $this->parseHtmlByName('block_summary.html', [
             'profile_image' => $oProfile->getUnit($iProfileId, ['template' => ['name' => 'unit_wo_info', 'size' => 'ava']]),
             'profile_name' => $oProfile->getDisplayName(),
-            'points' => $bProfileInfo ? $aProfileInfo['points'] : 0,
+            'points' => $iProfilePoints,
+            'history_url' => BxDolPermalinks::getInstance()->permalink($CNF['URL_HISTORY']),
             'bx_repeat:levels' => $aTmplVarsLevels
         ]);
     }
 
+    public function getBlockHistory($iProfileId, $iStart = 0, $iLimit = 0)
+    {
+        $CNF = &$this->_oConfig->CNF;
+        $oModule = $this->getModule();
+
+        if(!$iLimit)
+            $iLimit = (int)getParam($CNF['PARAM_HISTORY_LIMIT']);
+
+        $aItems = $this->_oDb->getEvents([
+            'sample' => 'owner_id', 
+            'owner_id' => $iProfileId,
+            'start' => $iStart,
+            'limit' => $iLimit + 1
+        ]);
+
+        $aTmplVarsItems = [];        
+        foreach($aItems as $aItem) {
+            $aTmplVarsItems[] = [
+                'unit' => $oModule->getUnitTitle($aItem['type']),
+                'action' => $oModule->getActionTitle($aItem['action']),
+                'points' => ($iPoints = (int)$aItem['points']) > 0 ? '+' . $iPoints : $iPoints,
+                'date' => bx_time_js($aItem['date'])
+            ];
+        }
+
+        if($this->_bIsApi)
+            return $aTmplVarsItems;
+
+        $oPaginate = new BxTemplPaginate([
+            'start' => $iStart,
+            'per_page' => $iLimit,
+            'on_change_page' => "return !loadDynamicBlockAutoPaginate(this, '{start}', '{per_page}')"
+        ]);
+        $oPaginate->setNumFromDataArray($aTmplVarsItems);
+        $sPaginate = $oPaginate->getSimplePaginate();
+
+        return $this->parseHtmlByName('block_history.html', [
+            'bx_repeat:items' => $aTmplVarsItems,
+            'bx_if:show_paginate' => [
+                'condition' => !empty($sPaginate),
+                'content' => [
+                    'paginate' => $sPaginate
+                ]
+            ]
+        ]);
+    }
+
     public function getBlockLeaderboard($iDays = 0, $iLimit = 0)
     {
         $CNF = &$this->_oConfig->CNF;

+ 26 - 19
modules/boonex/reputation/install/langs/en.xml

@@ -5,6 +5,7 @@
     <!-- Options -->
     <string name="_bx_reputation_option_enable_multilevel"><![CDATA[Enable the ability to have multiple levels at the same time]]></string>
     <string name="_bx_reputation_option_leaderboard_limit"><![CDATA[Number of items in leaderboard]]></string>
+    <string name="_bx_reputation_option_history_limit"><![CDATA[Number of items per page in points history]]></string>
 
     <!-- Forms -->
     <string name="_bx_reputation_form_handler"><![CDATA[Handler]]></string>
@@ -49,6 +50,7 @@
     <string name="_bx_reputation_form_input_err"><![CDATA[The field is essential. Please, fill it in.]]></string>
 
     <!-- Pages -->
+    <string name="_bx_reputation_page_block_title_levels"><![CDATA[Levels]]></string>
     <string name="_bx_reputation_page_title_sys_leaderboard"><![CDATA[Leaderboard]]></string>
     <string name="_bx_reputation_page_title_leaderboard"><![CDATA[Leaderboard]]></string>
     <string name="_bx_reputation_page_block_title_leaderboard_week"><![CDATA[Leaderboard (7-days)]]></string>
@@ -56,6 +58,9 @@
     <string name="_bx_reputation_page_block_title_leaderboard_all_time"><![CDATA[Leaderboard (all-time)]]></string>
     <string name="_bx_reputation_page_block_title_system_summary"><![CDATA[Summary]]></string>
     <string name="_bx_reputation_page_block_title_summary"><![CDATA[Summary]]></string>
+    <string name="_bx_reputation_page_title_sys_history"><![CDATA[Points history]]></string>
+    <string name="_bx_reputation_page_title_history"><![CDATA[History]]></string>
+    <string name="_bx_reputation_page_block_title_history"><![CDATA[History]]></string>
 
     <!-- Menus -->
     <string name="_bx_reputation_menu_item_title_system_leaderboard"><![CDATA[Leaderboard]]></string>
@@ -67,25 +72,6 @@
     <string name="_bx_reputation_grid_column_title_hdr_active"><![CDATA[Active]]></string>
     <string name="_bx_reputation_grid_column_title_hdr_alert_unit"><![CDATA[Section]]></string>
     <string name="_bx_reputation_grid_column_title_hdr_alert_action"><![CDATA[Action]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_added"><![CDATA[Add]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_post_common"><![CDATA[Write post]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_repost"><![CDATA[Do repost]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_deleted"><![CDATA[Remove]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_delete"><![CDATA[Remove post]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_delete_repost"><![CDATA[Remove repost]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_commentPost"><![CDATA[Post comment]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_commentRemoved"><![CDATA[Remove comment]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_doVote"><![CDATA[Do vote]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_undoVote"><![CDATA[Undo vote]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_doVoteUp"><![CDATA[Do up vote]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_undoVoteUp"><![CDATA[Undo up vote]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_doVoteDown"><![CDATA[Do down vote]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_undoVoteDown"><![CDATA[Undo down vote]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_connection_added"><![CDATA[Add connection]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_connection_removed"><![CDATA[Remove connection]]></string>
-    <string name="_bx_reputation_grid_column_title_hdr_au_sys_profiles_friends"><![CDATA[Friendship]]></string>
-    <string name="_bx_reputation_grid_column_title_hdr_au_sys_profiles_subscriptions"><![CDATA[Following]]></string>
-    <string name="_bx_reputation_grid_column_title_hdr_au_module_fans"><![CDATA[{0}' members]]></string>
     <string name="_bx_reputation_grid_column_title_hdr_points_active"><![CDATA[Points (active)]]></string>
     <string name="_bx_reputation_grid_column_title_hdr_points_passive"><![CDATA[Points (passive)]]></string>
     <string name="_bx_reputation_grid_action_title_hdr_activate"><![CDATA[Activate]]></string>
@@ -110,4 +96,25 @@
 
     <!-- Other -->
     <string name="_bx_reputation_txt_points"><![CDATA[points]]></string>
+    <string name="_bx_reputation_txt_from_to"><![CDATA[{0}]]></string>
+
+    <string name="_bx_reputation_txt_au_sys_profiles_friends"><![CDATA[Friendship]]></string>
+    <string name="_bx_reputation_txt_au_sys_profiles_subscriptions"><![CDATA[Following]]></string>
+    <string name="_bx_reputation_txt_au_module_fans"><![CDATA[{0}' members]]></string>
+    <string name="_bx_reputation_txt_aa_added"><![CDATA[Add]]></string>
+    <string name="_bx_reputation_txt_aa_post_common"><![CDATA[Write post]]></string>
+    <string name="_bx_reputation_txt_aa_repost"><![CDATA[Do repost]]></string>
+    <string name="_bx_reputation_txt_aa_deleted"><![CDATA[Remove]]></string>
+    <string name="_bx_reputation_txt_aa_delete"><![CDATA[Remove post]]></string>
+    <string name="_bx_reputation_txt_aa_delete_repost"><![CDATA[Remove repost]]></string>
+    <string name="_bx_reputation_txt_aa_commentPost"><![CDATA[Post comment]]></string>
+    <string name="_bx_reputation_txt_aa_commentRemoved"><![CDATA[Remove comment]]></string>
+    <string name="_bx_reputation_txt_aa_doVote"><![CDATA[Do vote]]></string>
+    <string name="_bx_reputation_txt_aa_undoVote"><![CDATA[Undo vote]]></string>
+    <string name="_bx_reputation_txt_aa_doVoteUp"><![CDATA[Do up vote]]></string>
+    <string name="_bx_reputation_txt_aa_undoVoteUp"><![CDATA[Undo up vote]]></string>
+    <string name="_bx_reputation_txt_aa_doVoteDown"><![CDATA[Do down vote]]></string>
+    <string name="_bx_reputation_txt_aa_undoVoteDown"><![CDATA[Undo down vote]]></string>
+    <string name="_bx_reputation_txt_aa_connection_added"><![CDATA[Add connection]]></string>
+    <string name="_bx_reputation_txt_aa_connection_removed"><![CDATA[Remove connection]]></string>
 </resources>

+ 1 - 1
modules/boonex/reputation/install/sql/disable.sql

@@ -7,7 +7,7 @@ DELETE FROM `tot`, `toc`, `to` USING `sys_options_types` AS `tot` LEFT JOIN `sys
 
 -- PAGES & BLOCKS
 DELETE FROM `sys_objects_page` WHERE `module` = @sName;
-DELETE FROM `sys_pages_blocks` WHERE `module` = @sName OR `object` IN('bx_reputation_leaderboard');
+DELETE FROM `sys_pages_blocks` WHERE `module` = @sName OR `object` IN('bx_reputation_leaderboard', 'bx_reputation_history');
 
 
 -- MENU

+ 15 - 2
modules/boonex/reputation/install/sql/enable.sql

@@ -13,7 +13,8 @@ SET @iCategId = LAST_INSERT_ID();
 
 INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
 ('bx_reputation_enable_multilevel', '', @iCategId, '_bx_reputation_option_enable_multilevel', 'checkbox', '', '', '', 1),
-('bx_reputation_leaderboard_limit', '10', @iCategId, '_bx_reputation_option_leaderboard_limit', 'digit', '', '', '', 11);
+('bx_reputation_leaderboard_limit', '10', @iCategId, '_bx_reputation_option_leaderboard_limit', 'digit', '', '', '', 11),
+('bx_reputation_history_limit', '20', @iCategId, '_bx_reputation_option_history_limit', 'digit', '', '', '', 13);
 
 
 -- PAGE: leaderboard
@@ -25,18 +26,30 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 ('bx_reputation_leaderboard', 3, @sName, '_bx_reputation_page_block_title_leaderboard_month', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:13:"bx_reputation";s:6:"method";s:21:"get_block_leaderboard";s:6:"params";a:1:{i:0;i:30;}}', 0, 1, 1),
 ('bx_reputation_leaderboard', 4, @sName, '_bx_reputation_page_block_title_leaderboard_all_time', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:13:"bx_reputation";s:6:"method";s:21:"get_block_leaderboard";}', 0, 1, 1);
 
+-- PAGE: history
+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_reputation_history', '_bx_reputation_page_title_sys_history', '_bx_reputation_page_title_history', @sName, 13, 2147483647, 1, 'points-history', 'page.php?i=points-history', '', '', '', 0, 1, 0, '', '');
+
+INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
+('bx_reputation_history', 2, @sName, '_bx_reputation_page_block_title_summary', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:13:"bx_reputation";s:6:"method";s:17:"get_block_summary";}', 0, 1, 1),
+('bx_reputation_history', 3, @sName, '_bx_reputation_page_block_title_history', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:13:"bx_reputation";s:6:"method";s:17:"get_block_history";}', 0, 1, 1);
 
 -- PAGES: add page block on home
 SET @iPBCellHome = 2;
 SET @iPBOrderHome = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_pages_blocks` WHERE `object` = 'sys_home' AND `cell_id` = @iPBCellHome ORDER BY `order` DESC LIMIT 1);
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `tabs`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
-('sys_home', @iPBCellHome, @sName, '_bx_reputation_page_block_title_system_summary', '_bx_reputation_page_block_title_summary', 13, 0, 2147483644, 'service', 'a:2:{s:6:"module";s:13:"bx_reputation";s:6:"method";s:17:"get_block_summary";}', 0, 1, 1, @iPBOrderHome + 1);
+('sys_home', @iPBCellHome, @sName, '_bx_reputation_page_block_title_system_summary', '_bx_reputation_page_block_title_summary', 13, 0, 2147483644, 'service', 'a:2:{s:6:"module";s:13:"bx_reputation";s:6:"method";s:17:"get_block_summary";}', 0, 0, 1, @iPBOrderHome + 1);
 
 -- PAGES: add page block to profiles modules (trigger* page objects are processed separately upon modules enable/disable)
 SET @iPBCellProfile = 3;
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
 ('trigger_page_profile_view_entry', @iPBCellProfile, @sName, '_bx_reputation_page_block_title_system_summary', '_bx_reputation_page_block_title_summary', 13, 2147483647, 'service', 'a:3:{s:6:"module";s:13:"bx_reputation";s:6:"method";s:17:"get_block_summary";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 0, 1, 0);
 
+-- PAGE: service blocks
+SET @iBlockOrder = (SELECT `order` FROM `sys_pages_blocks` WHERE `object` = '' AND `cell_id` = 0 ORDER BY `order` DESC LIMIT 1);
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('', 0, @sName, '', '_bx_reputation_page_block_title_levels', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:13:"bx_reputation";s:6:"method";s:16:"get_block_levels";}', 0, 1, IFNULL(@iBlockOrder, 0) + 1);
+
 
 -- MENU: add to site menu
 SET @iSiteMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_site' AND `active` = 1 AND `order` < 9999 ORDER BY `order` DESC LIMIT 1);

+ 14 - 0
modules/boonex/reputation/template/block_history.html

@@ -0,0 +1,14 @@
+<div class="bx-reputation-history">
+    <div class="bx-reputation-h-items">
+        <bx_repeat:items>
+            <div class="bx-reputation-h-item flex items-center w-full mt-2 first:mt-0 space-x-4">
+                <div class="bx-reputation-hi-title flex-1">__unit__: __action__</div>
+                <div class="bx-reputation-hi-points min-w-16 text-xl text-center">__points__</div>
+                <div class="bx-reputation-hi-date min-w-32 text-center">__date__</div>
+            </div>
+        </bx_repeat:items>
+    </div>
+    <bx_if:show_paginate>
+        <div class="bx-reputation-h-paginate mt-4">__paginate__</div>
+    </bx_if:show_paginate>
+</div>

+ 14 - 0
modules/boonex/reputation/template/block_levels.html

@@ -0,0 +1,14 @@
+<div class="bx-reputation-levels">
+    <bx_repeat:levels>
+        <div class="bx-reputation-level flex items-center w-full mt-2 first:mt-0">
+            <bx_if:icon>
+                <div class="bx-reputation-l-icon ltr:mr-2 rtl:ml-2">
+                    <bx_if:icon_font><i class="sys-icon __icon__"></i></bx_if:icon_font>
+                    <bx_if:icon_html>__icon__</bx_if:icon_html>
+                </div>
+            </bx_if:icon>
+            <div class="bx-reputation-l-title flex-1 text-2xl font-semibold">__title__</div>
+            <div class="bx-reputation-l-points text-center text-xl">__points__</div>
+        </div>
+    </bx_repeat:levels>
+</div>

+ 5 - 1
modules/boonex/reputation/template/block_summary.html

@@ -1,7 +1,11 @@
 <div class="bx-reputation-summary flex flex-col items-center">
     <div class="bx-reputation-s-profile-icon">__profile_image__</div>
     <div class="bx-reputation-s-profile-name mt-2 text-xl">__profile_name__</div>
-    <div class="bx-reputation-s-points mt-2"><span class="mr-2 text-2xl font-bold">__points__</span><span><bx_text:_bx_reputation_txt_points /></span></div>
+    <div class="bx-reputation-s-points mt-2">
+        <a href="__history_url__">
+            <span class="mr-2 text-2xl font-bold">__points__</span><span><bx_text:_bx_reputation_txt_points /></span>
+        </a>
+    </div>
     <div class="bx-reputation-s-levels flex mt-2 space-x-4 rtl:space-x-reverse">
         <bx_repeat:levels>
             <div class="bx-reputation-s-level flex items-center">

+ 26 - 19
modules/boonex/russian/data/langs/bx_reputation/ru.xml

@@ -5,6 +5,7 @@
     <!-- Options -->
     <string name="_bx_reputation_option_enable_multilevel"><![CDATA[Включить возможность иметь несколько уровней одновременно]]></string>
     <string name="_bx_reputation_option_leaderboard_limit"><![CDATA[Количество элементов в таблице лидеров]]></string>
+    <string name="_bx_reputation_option_history_limit"><![CDATA[Количество элементов на странице в истории баллов]]></string>
 
     <!-- Forms -->
     <string name="_bx_reputation_form_handler"><![CDATA[Обработчик]]></string>
@@ -46,6 +47,7 @@
     <string name="_bx_reputation_form_input_err"><![CDATA[Поле обязательно. Пожалуйста, заполните его.]]></string>
 
     <!-- Pages -->
+    <string name="_bx_reputation_page_block_title_levels"><![CDATA[Уровни]]></string>
     <string name="_bx_reputation_page_title_sys_leaderboard"><![CDATA[Таблица лидеров]]></string>
     <string name="_bx_reputation_page_title_leaderboard"><![CDATA[Таблица лидеров]]></string>
     <string name="_bx_reputation_page_block_title_leaderboard_week"><![CDATA[Таблица лидеров (7 дней)]]></string>
@@ -53,6 +55,9 @@
     <string name="_bx_reputation_page_block_title_leaderboard_all_time"><![CDATA[Таблица лидеров (за все время)]]></string>
     <string name="_bx_reputation_page_block_title_system_summary"><![CDATA[Сводка]]></string>
     <string name="_bx_reputation_page_block_title_summary"><![CDATA[Сводка]]></string>
+    <string name="_bx_reputation_page_title_sys_history"><![CDATA[История баллов]]></string>
+    <string name="_bx_reputation_page_title_history"><![CDATA[История]]></string>
+    <string name="_bx_reputation_page_block_title_history"><![CDATA[История]]></string>
 
     <!-- Menus -->
     <string name="_bx_reputation_menu_item_title_system_leaderboard"><![CDATA[Таблица лидеров]]></string>
@@ -64,25 +69,6 @@
     <string name="_bx_reputation_grid_column_title_hdr_active"><![CDATA[Активные]]></string>
     <string name="_bx_reputation_grid_column_title_hdr_alert_unit"><![CDATA[Раздел]]></string>
     <string name="_bx_reputation_grid_column_title_hdr_alert_action"><![CDATA[Действие]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_added"><![CDATA[Добавить]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_post_common"><![CDATA[Написать пост]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_repost"><![CDATA[Сдулать репост]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_deleted"><![CDATA[Удалить]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_delete"><![CDATA[Удалить пост]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_delete_repost"><![CDATA[Удалить репост]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_commentPost"><![CDATA[Оставить комментарий]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_commentRemoved"><![CDATA[Удалить комментарий]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_doVote"><![CDATA[Проголосовать]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_undoVote"><![CDATA[Отменить голосование]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_doVoteUp"><![CDATA[Проголосовать 'за']]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_undoVoteUp"><![CDATA[Отменить голосование 'за']]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_doVoteDown"><![CDATA[Проголосовать 'против']]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_undoVoteDown"><![CDATA[Отменить голосование 'против']]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_connection_added"><![CDATA[Добавить соединение]]></string>
-    <string name="_bx_reputation_grid_column_value_hdr_aa_connection_removed"><![CDATA[Удалить соединение]]></string>
-    <string name="_bx_reputation_grid_column_title_hdr_au_sys_profiles_friends"><![CDATA[Дружба]]></string>
-    <string name="_bx_reputation_grid_column_title_hdr_au_sys_profiles_subscriptions"><![CDATA[Подписка]]></string>
-    <string name="_bx_reputation_grid_column_title_hdr_au_module_fans"><![CDATA[{0}' пользователи]]></string>
     <string name="_bx_reputation_grid_column_title_hdr_points_active"><![CDATA[Баллы (активные)]]></string>
     <string name="_bx_reputation_grid_column_title_hdr_points_passive"><![CDATA[Баллы (пассивные)]]></string>
     <string name="_bx_reputation_grid_action_title_hdr_activate"><![CDATA[Активировать]]></string>
@@ -107,4 +93,25 @@
 
     <!-- Other -->
     <string name="_bx_reputation_txt_points"><![CDATA[баллов]]></string>
+    <string name="_bx_reputation_txt_from_to"><![CDATA[{0}]]></string>
+
+    <string name="_bx_reputation_txt_au_sys_profiles_friends"><![CDATA[Дружба]]></string>
+    <string name="_bx_reputation_txt_au_sys_profiles_subscriptions"><![CDATA[Подписка]]></string>
+    <string name="_bx_reputation_txt_au_module_fans"><![CDATA[{0}' пользователи]]></string>
+    <string name="_bx_reputation_txt_aa_added"><![CDATA[Добавить]]></string>
+    <string name="_bx_reputation_txt_aa_post_common"><![CDATA[Написать пост]]></string>
+    <string name="_bx_reputation_txt_aa_repost"><![CDATA[Сдулать репост]]></string>
+    <string name="_bx_reputation_txt_aa_deleted"><![CDATA[Удалить]]></string>
+    <string name="_bx_reputation_txt_aa_delete"><![CDATA[Удалить пост]]></string>
+    <string name="_bx_reputation_txt_aa_delete_repost"><![CDATA[Удалить репост]]></string>
+    <string name="_bx_reputation_txt_aa_commentPost"><![CDATA[Оставить комментарий]]></string>
+    <string name="_bx_reputation_txt_aa_commentRemoved"><![CDATA[Удалить комментарий]]></string>
+    <string name="_bx_reputation_txt_aa_doVote"><![CDATA[Проголосовать]]></string>
+    <string name="_bx_reputation_txt_aa_undoVote"><![CDATA[Отменить голосование]]></string>
+    <string name="_bx_reputation_txt_aa_doVoteUp"><![CDATA[Проголосовать 'за']]></string>
+    <string name="_bx_reputation_txt_aa_undoVoteUp"><![CDATA[Отменить голосование 'за']]></string>
+    <string name="_bx_reputation_txt_aa_doVoteDown"><![CDATA[Проголосовать 'против']]></string>
+    <string name="_bx_reputation_txt_aa_undoVoteDown"><![CDATA[Отменить голосование 'против']]></string>
+    <string name="_bx_reputation_txt_aa_connection_added"><![CDATA[Добавить соединение]]></string>
+    <string name="_bx_reputation_txt_aa_connection_removed"><![CDATA[Удалить соединение]]></string>
 </resources>