AntonLV 6 лет назад
Родитель
Сommit
ce1e4064f5

+ 11 - 0
modules/boonex/forum/classes/BxForumGrid.php

@@ -28,6 +28,17 @@ class BxForumGrid extends BxTemplGrid
 
 
     public function setBrowseParams($aParams)
     public function setBrowseParams($aParams)
     {
     {
+        if(isset($aParams['ajax_paginate'])) {
+            if(!$aParams['ajax_paginate']) {
+                list($sPageLink, $aPageParams) = bx_get_base_url_inline();
+
+                $aPageParams[$this->_aOptions['paginate_get_start']] = '{start}';
+                $this->_aOptions['paginate_url'] = BxDolPermalinks::getInstance()->permalink(bx_append_url_params($sPageLink, $aPageParams));
+            }
+
+            unset($aParams['ajax_paginate']);
+        }
+
         parent::setBrowseParams($aParams);
         parent::setBrowseParams($aParams);
 
 
     	$sField = 'added';
     	$sField = 'added';

+ 75 - 23
modules/boonex/forum/classes/BxForumModule.php

@@ -185,7 +185,11 @@ class BxForumModule extends BxBaseModTextModule
     	if($sUnitView != 'table')   
     	if($sUnitView != 'table')   
         	return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
         	return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
 
 
-        return $this->_serviceBrowseTable(array('type' => $sType), $bShowHeader);
+        return $this->_serviceBrowseTable(array(
+            'type' => $sType,
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
+        ), $bShowHeader);
     }
     }
 
 
     /**
     /**
@@ -216,7 +220,11 @@ class BxForumModule extends BxBaseModTextModule
         if($sUnitView != 'table')
         if($sUnitView != 'table')
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
 
 
-        return $this->_serviceBrowseTable(array('type' => $sType), $bShowHeader);
+        return $this->_serviceBrowseTable(array(
+            'type' => $sType,
+            'empty_message' => $bEmptyMessage, 
+            'ajax_paginate' => $bAjaxPaginate
+        ), $bShowHeader);
     }
     }
 
 
     /**
     /**
@@ -253,7 +261,8 @@ class BxForumModule extends BxBaseModTextModule
             'grid' => $CNF['OBJECT_GRID_FEATURE'],
             'grid' => $CNF['OBJECT_GRID_FEATURE'],
             'type' => $sType, 
             'type' => $sType, 
             'where' => array('fld' => 'featured', 'val' => 0, 'opr' => '<>'),
             'where' => array('fld' => 'featured', 'val' => 0, 'opr' => '<>'),
-            'empty_message' => $bEmptyMessage
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
         ), $bShowHeader);
         ), $bShowHeader);
     }
     }
 
 
@@ -284,7 +293,11 @@ class BxForumModule extends BxBaseModTextModule
         if($sUnitView != 'table')
         if($sUnitView != 'table')
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
 
 
-        return $this->_serviceBrowseTable(array('type' => $sType), $bShowHeader);
+        return $this->_serviceBrowseTable(array(
+            'type' => $sType,
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
+        ), $bShowHeader);
     }
     }
 
 
     /**
     /**
@@ -314,7 +327,11 @@ class BxForumModule extends BxBaseModTextModule
         if($sUnitView != 'table')
         if($sUnitView != 'table')
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
 
 
-        return $this->_serviceBrowseTable(array('type' => $sType), $bShowHeader);
+        return $this->_serviceBrowseTable(array(
+            'type' => $sType,
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
+        ), $bShowHeader);
     }
     }
 
 
     /**
     /**
@@ -344,7 +361,11 @@ class BxForumModule extends BxBaseModTextModule
         if($sUnitView != 'table')
         if($sUnitView != 'table')
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
 
 
-        return $this->_serviceBrowseTable(array('type' => $sType), $bShowHeader);
+        return $this->_serviceBrowseTable(array(
+            'type' => $sType,
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
+        ), $bShowHeader);
     }
     }
 
 
         /**
         /**
@@ -406,7 +427,8 @@ class BxForumModule extends BxBaseModTextModule
             'join' => $aJoin,
             'join' => $aJoin,
             'where' => $aWhere,
             'where' => $aWhere,
             'group_by' => $aGroupBy,
             'group_by' => $aGroupBy,
-            'empty_message' => $bEmptyMessage
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
         ), $bShowHeader);
         ), $bShowHeader);
     }
     }
 
 
@@ -441,7 +463,8 @@ class BxForumModule extends BxBaseModTextModule
         return $this->_serviceBrowseTable(array(
         return $this->_serviceBrowseTable(array(
             'type' => $sType,
             'type' => $sType,
             'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_index'),
             'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_index'),
-            'empty_message' => $bEmptyMessage
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
         ), $bShowHeader);
         ), $bShowHeader);
     }
     }
 
 
@@ -478,12 +501,19 @@ class BxForumModule extends BxBaseModTextModule
             unset($aParams['empty_message']);
             unset($aParams['empty_message']);
         }
         }
 
 
+        $bAjaxPaginate = true;
+        if(isset($aParams['ajax_paginate'])) {
+            $bAjaxPaginate = (bool)$aParams['ajax_paginate'];
+            unset($aParams['ajax_paginate']);
+        }
+
         return $this->_serviceBrowseTable(array(
         return $this->_serviceBrowseTable(array(
         	'type' => 'author', 
         	'type' => 'author', 
         	'author' => $iProfileId, 
         	'author' => $iProfileId, 
         	'where' => array('fld' => 'author', 'val' => $iProfileId, 'opr' => '='), 
         	'where' => array('fld' => 'author', 'val' => $iProfileId, 'opr' => '='), 
         	'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_profile'),
         	'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_profile'),
-        	'empty_message' => $bEmptyMessage
+        	'empty_message' => $bEmptyMessage,
+                'ajax_paginate' => $bAjaxPaginate
         ), false);
         ), false);
     }
     }
 
 
@@ -531,6 +561,12 @@ class BxForumModule extends BxBaseModTextModule
             unset($aParams['empty_message']);
             unset($aParams['empty_message']);
         }
         }
 
 
+        $bAjaxPaginate = true;
+        if(isset($aParams['ajax_paginate'])) {
+            $bAjaxPaginate = (bool)$aParams['ajax_paginate'];
+            unset($aParams['ajax_paginate']);
+        }
+
         $aConditions = $oFavorite->getConditionsTrack($CNF['TABLE_ENTRIES'], 'id', $iProfileAuthor);
         $aConditions = $oFavorite->getConditionsTrack($CNF['TABLE_ENTRIES'], 'id', $iProfileAuthor);
         if(empty($aConditions) || !is_array($aConditions)) 
         if(empty($aConditions) || !is_array($aConditions)) 
             return '';
             return '';
@@ -543,27 +579,28 @@ class BxForumModule extends BxBaseModTextModule
                     'tbl1' => $aCondition['table'],
                     'tbl1' => $aCondition['table'],
                     'fld1' => $aCondition['onField'],
                     'fld1' => $aCondition['onField'],
                     'tbl2' => $aCondition['mainTable'],
                     'tbl2' => $aCondition['mainTable'],
-                	'fld2' => $aCondition['mainField']
+                    'fld2' => $aCondition['mainField']
                 );
                 );
 
 
         $aWhereGroup = array('grp' => true, 'opr' => 'AND', 'cnds' => array());
         $aWhereGroup = array('grp' => true, 'opr' => 'AND', 'cnds' => array());
         if(!empty($aConditions['restriction']))
         if(!empty($aConditions['restriction']))
             foreach($aConditions['restriction'] as $aCondition)
             foreach($aConditions['restriction'] as $aCondition)
                 $aWhereGroup['cnds'][] = array(
                 $aWhereGroup['cnds'][] = array(
-                	'tbl' => (!empty($aCondition['table']) ? $aCondition['table'] : ''), 
-                	'fld' => $aCondition['field'], 
-                	'val' => $aCondition['value'], 
-                	'opr' => $aCondition['operator']
+                    'tbl' => (!empty($aCondition['table']) ? $aCondition['table'] : ''), 
+                    'fld' => $aCondition['field'], 
+                    'val' => $aCondition['value'], 
+                    'opr' => $aCondition['operator']
                 );
                 );
 
 
         return $this->_serviceBrowseTable(array(
         return $this->_serviceBrowseTable(array(
-			'grid' => $CNF['OBJECT_GRID_FAVORITE'],
-        	'type' => 'favorite', 
-        	'author' => $iProfileId, 
+            'grid' => $CNF['OBJECT_GRID_FAVORITE'],
+            'type' => 'favorite', 
+            'author' => $iProfileId, 
             'join' => $aJoinGroup,
             'join' => $aJoinGroup,
-        	'where' => $aWhereGroup, 
-        	'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_profile'),
-        	'empty_message' => $bEmptyMessage
+            'where' => $aWhereGroup, 
+            'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_profile'),
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
         ), false);
         ), false);
     }
     }
 
 
@@ -599,7 +636,12 @@ class BxForumModule extends BxBaseModTextModule
         if($sUnitView != 'table')   
         if($sUnitView != 'table')   
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
 
 
-        return $this->_serviceBrowseTable(array('type' => $sType, 'where' => array('fld' => 'cat', 'val' => $iCategory, 'opr' => '=')), $bShowHeader);
+        return $this->_serviceBrowseTable(array(
+            'type' => $sType, 
+            'where' => array('fld' => 'cat', 'val' => $iCategory, 'opr' => '='),
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
+        ), $bShowHeader);
     }
     }
 
 
     /**
     /**
@@ -630,7 +672,12 @@ class BxForumModule extends BxBaseModTextModule
         if($sUnitView != 'table')   
         if($sUnitView != 'table')   
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
             return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
 
 
-        return $this->_serviceBrowseTable(array('type' => $sType, 'where' => $this->_getSearchKeywordDescriptor('#' . $sKeyword)), $bShowHeader);
+        return $this->_serviceBrowseTable(array(
+            'type' => $sType, 
+            'where' => $this->_getSearchKeywordDescriptor('#' . $sKeyword),
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
+        ), $bShowHeader);
     }
     }
 
 
     /**
     /**
@@ -678,7 +725,12 @@ class BxForumModule extends BxBaseModTextModule
         if(!empty($sKeyword))
         if(!empty($sKeyword))
             $aWhereGroupAnd['cnds'][] = $this->_getSearchKeywordDescriptor($sKeyword);
             $aWhereGroupAnd['cnds'][] = $this->_getSearchKeywordDescriptor($sKeyword);
 
 
-        return $this->_serviceBrowseTable(array('type' => $sType, 'where' => $aWhereGroupAnd), false);
+        return $this->_serviceBrowseTable(array(
+            'type' => $sType, 
+            'where' => $aWhereGroupAnd,
+            'empty_message' => $bEmptyMessage,
+            'ajax_paginate' => $bAjaxPaginate
+        ), false);
     }
     }
 
 
     /**
     /**

+ 1 - 1
modules/boonex/forum/install/sql/enable.sql

@@ -153,7 +153,7 @@ INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module
 
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
 ('bx_forum_home', 1, @sName, '', '_bx_forum_page_block_title_featured_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:8:"bx_forum";s:6:"method";s:15:"browse_featured";s:6:"params";a:4:{i:0;s:5:"table";i:1;b:0;i:2;b:1;i:3;b:0;}}', 0, 1, 1, 0),
 ('bx_forum_home', 1, @sName, '', '_bx_forum_page_block_title_featured_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:8:"bx_forum";s:6:"method";s:15:"browse_featured";s:6:"params";a:4:{i:0;s:5:"table";i:1;b:0;i:2;b:1;i:3;b:0;}}', 0, 1, 1, 0),
-('bx_forum_home', 1, @sName, '', '_bx_forum_page_block_title_latest_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:8:"bx_forum";s:6:"method";s:13:"browse_latest";s:6:"params";a:1:{i:0;s:5:"table";}}', 0, 1, 1, 1),
+('bx_forum_home', 1, @sName, '', '_bx_forum_page_block_title_latest_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:8:"bx_forum";s:6:"method";s:13:"browse_latest";s:6:"params";a:3:{i:0;s:5:"table";i:1;b:1;i:2;b:0;}}', 0, 1, 1, 1),
 ('bx_forum_home', 2, @sName, '', '_bx_forum_page_block_title_cats', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:15:"categories_list";s:6:"params";a:2:{i:0;s:13:"bx_forum_cats";i:1;a:1:{s:10:"show_empty";b:1;}}s:5:"class";s:20:"TemplServiceCategory";}', 0, 1, 1, 0),
 ('bx_forum_home', 2, @sName, '', '_bx_forum_page_block_title_cats', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:15:"categories_list";s:6:"params";a:2:{i:0;s:13:"bx_forum_cats";i:1;a:1:{s:10:"show_empty";b:1;}}s:5:"class";s:20:"TemplServiceCategory";}', 0, 1, 1, 0),
 ('bx_forum_home', 2, @sName, '', '_bx_forum_page_block_title_popular_keywords', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:14:"keywords_cloud";s:6:"params";a:2:{i:0;s:8:"bx_forum";i:1;s:8:"bx_forum";}s:5:"class";s:20:"TemplServiceMetatags";}', 0, 1, 1, 1),
 ('bx_forum_home', 2, @sName, '', '_bx_forum_page_block_title_popular_keywords', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:14:"keywords_cloud";s:6:"params";a:2:{i:0;s:8:"bx_forum";i:1;s:8:"bx_forum";}s:5:"class";s:20:"TemplServiceMetatags";}', 0, 1, 1, 1),
 ('bx_forum_home', 2, @sName, '', '_bx_forum_page_block_title_browse_labels', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:13:"browse_labels";s:5:"class";s:20:"TemplServiceMetatags";}', 0, 1, 0, 0),
 ('bx_forum_home', 2, @sName, '', '_bx_forum_page_block_title_browse_labels', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:13:"browse_labels";s:5:"class";s:20:"TemplServiceMetatags";}', 0, 1, 0, 0),