Explorar o código

Ticket #5001 - Spaces: Add browse category page.

AntonLV hai 1 ano
pai
achega
6a5a1b0040

+ 11 - 0
modules/base/general/classes/BxBaseModGeneralPageBrowse.php

@@ -23,6 +23,8 @@ class BxBaseModGeneralPageBrowse extends BxTemplPage
         parent::__construct($aObject, $oTemplate);
 
         $this->_oModule = BxDolModule::getInstance($this->MODULE);
+        
+        $CNF = &$this->_oModule->_oConfig->CNF;
 
         // select module submenu
         if (isset($this->_oModule->_oConfig->CNF['OBJECT_MENU_SUBMENU'])){
@@ -30,6 +32,15 @@ class BxBaseModGeneralPageBrowse extends BxTemplPage
             if($oMenuSubmenu)
                 $oMenuSubmenu->setObjectSubmenu($this->_oModule->_oConfig->CNF['OBJECT_MENU_SUBMENU']);
         }
+
+        if(!empty($CNF['OBJECT_CATEGORY']) && ($iCategory = bx_get('category')) !== false) {
+            $iCategory = bx_process_input($iCategory, BX_DATA_INT);
+
+            $this->addMarkers([
+                'category_id' => $iCategory,
+                'category_name' => BxDolCategory::getObjectInstance($CNF['OBJECT_CATEGORY'])->getCategoryTitle($iCategory),
+            ]);
+        }
     }
 
 }

+ 0 - 11
modules/base/text/classes/BxBaseModTextPageBrowse.php

@@ -17,17 +17,6 @@ class BxBaseModTextPageBrowse extends BxBaseModGeneralPageBrowse
     public function __construct($aObject, $oTemplate = false)
     {
         parent::__construct($aObject, $oTemplate);
-
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
-        if(!empty($CNF['OBJECT_CATEGORY']) && ($iCategory = bx_get('category')) !== false) {
-            $iCategory = bx_process_input($iCategory, BX_DATA_INT);
-
-            $this->addMarkers([
-                'category_id' => $iCategory,
-                'category_name' => BxDolCategory::getObjectInstance($CNF['OBJECT_CATEGORY'])->getCategoryTitle($iCategory),
-            ]);
-        }
     }
 }
 

+ 5 - 0
modules/boonex/russian/data/langs/bx_spaces/ru.xml

@@ -115,6 +115,7 @@
     <string name="_bx_spaces_page_title_browse_recent"><![CDATA[Новые пространства]]></string>
     <string name="_bx_spaces_page_title_browse_connections"><![CDATA[{0} связей]]></string>
     <string name="_bx_spaces_page_title_browse_connections_mutual"><![CDATA[{0} и {1} обоюдных связей]]></string>
+    <string name="_bx_spaces_page_title_browse_category"><![CDATA[Пространства в категории: {0}]]></string>
     <string name="_bx_spaces_page_title_sys_profile_friends"><![CDATA[Друзья]]></string>
     <string name="_bx_spaces_page_title_profile_friends"><![CDATA[Друзья]]></string>
     <string name="_bx_spaces_page_title_sys_space_fans"><![CDATA[Участники]]></string>
@@ -202,6 +203,10 @@
     <string name="_bx_spaces_page_block_title_favorites_entries_actions"><![CDATA[Действия]]></string>
     <string name="_bx_spaces_page_block_title_sys_cover_block"><![CDATA[Обложка]]></string>
     <string name="_bx_spaces_page_block_title_cover_block"><![CDATA[Обложка]]></string>
+    <string name="_bx_spaces_page_title_sys_entries_by_category"><![CDATA[Пространства в категории]]></string>
+    <string name="_bx_spaces_page_title_entries_by_category"><![CDATA[Пространства в {category_name}]]></string>
+    <string name="_bx_spaces_page_block_title_sys_entries_by_category"><![CDATA[Пространства в категории]]></string>
+    <string name="_bx_spaces_page_block_title_entries_by_category"><![CDATA[{category_name}]]></string>
 
     <string name="_bx_spaces_menu_title_submenu"><![CDATA[Пространства - Подменю]]></string>
     <string name="_bx_spaces_menu_set_title_submenu"><![CDATA[Пространства - Подменю]]></string>

+ 1 - 0
modules/boonex/spaces/classes/BxSpacesConfig.php

@@ -86,6 +86,7 @@ class BxSpacesConfig extends BxBaseModGroupsConfig
             'URL_ENTRY_FANS' => 'page.php?i=space-fans',
             'URL_MANAGE_COMMON' => 'page.php?i=spaces-manage',
             'URL_MANAGE_ADMINISTRATION' => 'page.php?i=spaces-administration',
+            'URL_CATEGORY' => 'page.php?i=spaces-category',
 
             'PARAM_AUTO_APPROVE' => 'bx_spaces_enable_auto_approve',
             'PARAM_MULTILEVEL_HIERARCHY' => 'bx_spaces_enable_multilevel_hierarchy',

+ 16 - 1
modules/boonex/spaces/classes/BxSpacesSearchResult.php

@@ -29,6 +29,7 @@ class BxSpacesSearchResult extends BxBaseModGroupsSearchResult
                 'perofileStatus' => array('value' => 'active', 'field' => 'status', 'operator' => '='),
                 'perofileType' => array('value' => 'bx_spaces', 'field' => 'type', 'operator' => '='),
                 'owner' => array('value' => '', 'field' => 'author', 'operator' => '=', 'table' => 'bx_spaces_data'),
+                'category' => array('value' => '', 'field' => 'space_cat', 'operator' => '=', 'table' => 'bx_spaces_data'),
                 'featured' => array('value' => '', 'field' => 'featured', 'operator' => '<>', 'table' => 'bx_spaces_data'),
                 'status' => array('value' => 'active', 'field' => 'status', 'operator' => '=', 'table' => 'bx_spaces_data'),
                 'statusAdmin' => array('value' => 'active', 'field' => 'status_admin', 'operator' => '=', 'table' => 'bx_spaces_data'),
@@ -166,7 +167,21 @@ class BxSpacesSearchResult extends BxBaseModGroupsSearchResult
             case 'top_level':
                 $this->aCurrent['restriction']['level'] = array('value' => '0', 'field' => 'level', 'operator' => '=', 'table' => 'bx_spaces_data');
                 break;
-                
+
+            case 'category':
+                $iCategory = (int)$aParams['category'];
+                $this->addMarkers([
+                    'category_id' => $iCategory,
+                    'category_name' => BxDolCategory::getObjectInstance($CNF['OBJECT_CATEGORY'])->getCategoryTitle($iCategory),
+                ]);
+
+                $this->aCurrent['restriction']['category']['value'] = $iCategory;
+
+                $this->sBrowseUrl = $CNF['URL_CATEGORY'] . '&category={category_id}';
+                $this->aCurrent['title'] = _t('_bx_spaces_page_title_browse_category');
+                $this->aCurrent['rss']['link'] = 'modules/?r=spaces/rss/' . $sMode . '/' . $iCategory;
+                break;
+
             case '': // search results
                 $this->sBrowseUrl = BX_DOL_SEARCH_KEYWORD_PAGE;
                 $this->aCurrent['title'] = _t('_bx_spaces');

+ 5 - 0
modules/boonex/spaces/install/langs/en.xml

@@ -115,6 +115,7 @@
 	<string name="_bx_spaces_page_title_browse_recent"><![CDATA[New Spaces]]></string>
 	<string name="_bx_spaces_page_title_browse_connections"><![CDATA[{0} connections]]></string>
 	<string name="_bx_spaces_page_title_browse_connections_mutual"><![CDATA[{0} and {1} mutual connections]]></string>
+        <string name="_bx_spaces_page_title_browse_category"><![CDATA[Spaces by category: {0}]]></string>
 	<string name="_bx_spaces_page_title_sys_profile_friends"><![CDATA[Friends]]></string>
 	<string name="_bx_spaces_page_title_profile_friends"><![CDATA[Friends]]></string>
 	<string name="_bx_spaces_page_title_sys_space_fans"><![CDATA[Members]]></string>
@@ -206,6 +207,10 @@
         <string name="_bx_spaces_page_block_title_top_level_spaces"><![CDATA[Top Level Spaces]]></string>
         <string name="_bx_spaces_page_block_title_sys_cover_block"><![CDATA[Cover]]></string>
         <string name="_bx_spaces_page_block_title_cover_block"><![CDATA[Cover]]></string>
+        <string name="_bx_spaces_page_title_sys_entries_by_category"><![CDATA[Spaces in category]]></string>
+        <string name="_bx_spaces_page_title_entries_by_category"><![CDATA[Spaces in {category_name}]]></string>
+        <string name="_bx_spaces_page_block_title_sys_entries_by_category"><![CDATA[Spaces in category]]></string>
+        <string name="_bx_spaces_page_block_title_entries_by_category"><![CDATA[{category_name}]]></string>
 
         <string name="_bx_spaces_menu_title_submenu"><![CDATA[Spaces Submenu]]></string>
 	<string name="_bx_spaces_menu_set_title_submenu"><![CDATA[Spaces Submenu]]></string>

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

@@ -8,7 +8,7 @@ DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
 -- PAGES
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_spaces';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_spaces' OR `object` IN('bx_spaces_create_profile', 'bx_spaces_delete_profile', 'bx_spaces_join_profile', 'bx_spaces_edit_profile', 'bx_spaces_edit_profile_cover', 'bx_spaces_edit_profile_settings', 'bx_spaces_invite', 'bx_spaces_view_profile', 'bx_spaces_view_profile_closed', 'bx_spaces_profile_info', 'bx_spaces_profile_pricing', 'bx_spaces_profile_comments', 'bx_spaces_home', 'bx_spaces_fans', 'bx_spaces_manage_item', 'bx_spaces_joined', 'bx_spaces_favorites', 'bx_spaces_top', 'bx_spaces_search', 'bx_spaces_manage', 'bx_spaces_administration');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_spaces' OR `object` IN('bx_spaces_create_profile', 'bx_spaces_delete_profile', 'bx_spaces_join_profile', 'bx_spaces_edit_profile', 'bx_spaces_edit_profile_cover', 'bx_spaces_edit_profile_settings', 'bx_spaces_invite', 'bx_spaces_view_profile', 'bx_spaces_view_profile_closed', 'bx_spaces_profile_info', 'bx_spaces_profile_pricing', 'bx_spaces_profile_comments', 'bx_spaces_home', 'bx_spaces_fans', 'bx_spaces_manage_item', 'bx_spaces_joined', 'bx_spaces_favorites', 'bx_spaces_top', 'bx_spaces_category', 'bx_spaces_search', 'bx_spaces_manage', 'bx_spaces_administration');
 
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_spaces';

+ 8 - 0
modules/boonex/spaces/install/sql/enable.sql

@@ -156,6 +156,14 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
 ('bx_spaces_top', 1, 'bx_spaces', '_bx_spaces_page_block_title_top_profiles', 11, 2147483647, 'service', 'a:3:{s:6:\"module\";s:9:\"bx_spaces\";s:6:\"method\";s:19:\"browse_top_profiles\";s:6:"params";a:1:{i:0;b:1;}}', 0, 1, 0);
 
+-- PAGE: profiles by category
+INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_spaces_category', 'spaces-category', '_bx_spaces_page_title_sys_entries_by_category', '_bx_spaces_page_title_entries_by_category', 'bx_spaces', 1, 2147483647, 1, 'page.php?i=spaces-category', '', '', '', 0, 1, 0, 'BxSpacesPageBrowse', 'modules/boonex/spaces/classes/BxSpacesPageBrowse.php');
+
+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_spaces_category', 1, 'bx_spaces', '', '_bx_spaces_page_block_title_categories', 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:14:"bx_spaces_cats";i:1;a:2:{s:10:\"show_empty\";b:1;s:21:\"show_empty_categories\";b:1;}}s:5:"class";s:20:"TemplServiceCategory";}', 0, 0, 1, 1),
+('bx_spaces_category', 2, 'bx_spaces', '_bx_spaces_page_block_title_sys_entries_by_category', '_bx_spaces_page_block_title_entries_by_category', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:15:"browse_category";s:6:"params";a:3:{s:9:"unit_view";s:7:"gallery";s:13:"empty_message";b:1;s:13:"ajax_paginate";b:0;}}', 0, 0, 1, 1);
+
 -- PAGE: search for entries
 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_spaces_search', '_bx_spaces_page_title_sys_entries_search', '_bx_spaces_page_title_entries_search', 'bx_spaces', 5, 2147483647, 1, 'spaces-search', 'page.php?i=spaces-search', '', '', '', 0, 1, 0, 'BxSpacesPageBrowse', 'modules/boonex/spaces/classes/BxSpacesPageBrowse.php');