Просмотр исходного кода

#4488 - Add Followed Groups/Events tabs

roman.lesnikov@gmail.com 3 лет назад
Родитель
Сommit
f3fba724b5

+ 10 - 0
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -678,6 +678,16 @@ class BxBaseModGroupsModule extends BxBaseModProfileModule
 
         return $this->_serviceBrowse ('joined_entries', array('joined_profile' => $iProfileId), BX_DB_PADDING_DEF, $bDisplayEmptyMsg);
     }
+    
+    public function serviceBrowseFollowedEntries ($iProfileId = 0, $bDisplayEmptyMsg = false)
+    {
+        if (!$iProfileId)
+            $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
+        if (!$iProfileId)
+            return '';
+
+        return $this->_serviceBrowse ('followed_entries', array('followed_profile' => $iProfileId), BX_DB_PADDING_DEF, $bDisplayEmptyMsg);
+    }
 
     public function serviceBrowseCreatedEntries ($iProfileId = 0, $bDisplayEmptyMsg = false)
     {

+ 1 - 0
modules/boonex/events/classes/BxEventsConfig.php

@@ -78,6 +78,7 @@ class BxEventsConfig extends BxBaseModGroupsConfig
             'URI_ENTRIES_BY_CONTEXT' => 'events-context',
             'URI_JOIN_ENTRY' => 'join-event-profile',
             'URI_JOINED_ENTRIES' => 'joined-events',
+            'URI_FOLLOWED_ENTRIES' => 'followed-events',
             'URI_MANAGE_COMMON' => 'events-manage',
             'URI_FAVORITES_LIST' => 'events-favorites',
 

+ 24 - 0
modules/boonex/events/classes/BxEventsSearchResult.php

@@ -120,6 +120,30 @@ class BxEventsSearchResult extends BxBaseModGroupsSearchResult
                 $this->aCurrent['title'] = _t('_bx_events_page_title_joined_entries');
                 $this->aCurrent['rss']['link'] = 'modules/?r=events/rss/' . $sMode . '/' . $oJoinedProfile->id();
                 break;
+                
+            case 'followed_entries':
+                $oJoinedProfile = BxDolProfile::getInstance((int)$aParams['followed_profile']);
+                if (!$oJoinedProfile) {
+                    $this->isError = true;
+                    break;
+                }
+
+                $bProcessConditionsForPrivateContent = false;
+
+                $this->aCurrent['join']['followed'] = array(
+                    'type' => 'INNER',
+                    'table' => 'sys_profiles_conn_subscriptions',
+                    'mainField' => 'id',
+                    'onField' => 'content',
+                    'joinFields' => array('initiator'),
+                );
+
+                $this->aCurrent['restriction']['followed'] = array('value' => $oJoinedProfile->id(), 'field' => 'initiator', 'operator' => '=', 'table' => 'sys_profiles_conn_subscriptions');
+
+                $this->sBrowseUrl = 'page.php?i=' . $CNF['URI_FOLLOWED_ENTRIES'] . '&profile_id={profile_id}';
+                $this->aCurrent['title'] = _t('_bx_groups_page_title_followed_entries');
+                $this->aCurrent['rss']['link'] = 'modules/?r=groups/rss/' . $sMode . '/' . $oJoinedProfile->id();
+                break;
 
             case 'connections':
                 if ($this->_setConnectionsConditions($aParams)) {

+ 7 - 0
modules/boonex/events/install/langs/en.xml

@@ -124,6 +124,8 @@
     <string name="_bx_events_page_title_sys_joined"><![CDATA[Profile Events]]></string>
     <string name="_bx_events_page_title_joined"><![CDATA[Profile Events]]></string>
     <string name="_bx_events_page_title_sys_joined_entries"><![CDATA[Profile Events]]></string>
+    <string name="_bx_events_page_title_followed"><![CDATA[Followed Events]]></string>
+    <string name="_bx_events_page_title_sys_followed"><![CDATA[Followed Events]]></string>
     <string name="_bx_events_page_title_joined_entries"><![CDATA[Profile Events]]></string>
     <string name="_bx_events_page_title_sys_entries_in_context"><![CDATA[Events in context]]></string>
     <string name="_bx_events_page_title_entries_in_context"><![CDATA[Events in {display_name}]]></string>
@@ -198,6 +200,8 @@
     <string name="_bx_events_page_block_title_sys_favorites_of_author"><![CDATA[Favorite Events]]></string>
     <string name="_bx_events_page_block_title_sys_joined_entries"><![CDATA[Joined Events]]></string>
     <string name="_bx_events_page_block_title_joined_entries"><![CDATA[Joined Events]]></string>
+    <string name="_bx_events_page_block_title_sys_followed_entries"><![CDATA[Followed Events]]></string>
+    <string name="_bx_events_page_block_title_followed_entries"><![CDATA[Followed Events]]></string>
     <string name="_bx_events_page_block_title_create_profile"><![CDATA[Create Event]]></string>
     <string name="_bx_events_page_block_title_edit_profile"><![CDATA[Edit Event]]></string>
     <string name="_bx_events_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
@@ -233,6 +237,7 @@
     <string name="_bx_events_page_block_title_manage"><![CDATA[Manage Events]]></string>
     <string name="_bx_events_page_block_title_top_profiles"><![CDATA[Top Events]]></string>
     <string name="_bx_events_page_block_title_joined_profiles"><![CDATA[Joined Events]]></string>
+    <string name="_bx_events_page_block_title_followed_profiles"><![CDATA[Followed Events]]></string>
     <string name="_bx_events_page_block_title_upcoming_profiles"><![CDATA[Upcoming Events]]></string>
     <string name="_bx_events_page_block_title_past_profiles"><![CDATA[Past Events]]></string>
     <string name="_bx_events_page_block_title_entry_all_actions"><![CDATA[All Actions]]></string>
@@ -346,6 +351,8 @@
     <string name="_bx_events_menu_item_title_system_entries_search"><![CDATA[Search]]></string>
     <string name="_bx_events_menu_item_title_entries_search"><![CDATA[Search]]></string>
     <string name="_bx_events_menu_item_title_system_entries_joined"><![CDATA[Joined]]></string>
+    <string name="_bx_events_menu_item_title_entries_followed"><![CDATA[Followed]]></string>
+    <string name="_bx_events_menu_item_title_system_entries_followed"><![CDATA[Followed]]></string>
     <string name="_bx_events_menu_item_title_entries_joined"><![CDATA[Joined]]></string>
     <string name="_bx_events_menu_item_title_system_entries_manage"><![CDATA[Manage]]></string>
     <string name="_bx_events_menu_item_title_entries_manage"><![CDATA[Manage]]></string>

+ 9 - 1
modules/boonex/events/install/sql/enable.sql

@@ -200,6 +200,13 @@ 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_joined_events', 1, 'bx_events', '_bx_events_page_block_title_joined_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_events";s:6:"method";s:21:"browse_joined_entries";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;b:1;}}', 0, 1, 0);
 
+-- PAGE: followed profiles
+
+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_followed_events', '_bx_events_page_title_sys_followed', '_bx_events_page_title_followed', 'bx_events', 5, 2147483647, 1, 'events-followed', 'page.php?i=events-followed', '', '', '', 0, 1, 0, 'BxEventsPageBrowse', 'modules/boonex/events/classes/BxEventsPageBrowse.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_followed_events', 1, 'bx_events', '_bx_events_page_block_title_followed_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_events";s:6:"method";s:23:"browse_followed_entries";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;b:1;}}', 0, 1, 0);
 
 -- PAGE: module manage own
 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 
@@ -385,7 +392,8 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_events_submenu', 'bx_events', 'events-calendar', '_bx_events_menu_item_title_system_calendar', '_bx_events_menu_item_title_calendar', 'page.php?i=events-calendar', '', '', '', '', 2147483647, 1, 1, 5),
 ('bx_events_submenu', 'bx_events', 'events-search', '_bx_events_menu_item_title_system_entries_search', '_bx_events_menu_item_title_entries_search', 'page.php?i=events-search', '', '', '', '', 2147483647, 1, 1, 6),
 ('bx_events_submenu', 'bx_events', 'events-joined', '_bx_events_menu_item_title_system_entries_joined', '_bx_events_menu_item_title_entries_joined', 'page.php?i=events-joined', '', '', '', '', 2147483647, 1, 1, 7),
-('bx_events_submenu', 'bx_events', 'events-manage', '_bx_events_menu_item_title_system_entries_manage', '_bx_events_menu_item_title_entries_manage', 'page.php?i=events-manage', '', '', '', '', 2147483646, 1, 1, 8);
+('bx_events_submenu', 'bx_events', 'events-followed', '_bx_events_menu_item_title_system_entries_followed', '_bx_events_menu_item_title_entries_followed', 'page.php?i=events-followed', '', '', '', '', 2147483647, 1, 1, 8),
+('bx_events_submenu', 'bx_events', 'events-manage', '_bx_events_menu_item_title_system_entries_manage', '_bx_events_menu_item_title_entries_manage', 'page.php?i=events-manage', '', '', '', '', 2147483646, 1, 1, 9);
 
 -- MENU: view submenu
 

+ 1 - 0
modules/boonex/groups/classes/BxGroupsConfig.php

@@ -71,6 +71,7 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
             'URI_EDIT_ENTRY' => 'edit-group-profile',
             'URI_JOIN_ENTRY' => 'join-group-profile',
             'URI_JOINED_ENTRIES' => 'joined-groups',
+            'URI_FOLLOWED_ENTRIES' => 'followed-groups',
             'URI_ENTRIES_BY_CONTEXT' => 'groups-context',
             'URI_MANAGE_COMMON' => 'groups-manage',
             'URI_FAVORITES_LIST' => 'groups-favorites',

+ 25 - 0
modules/boonex/groups/classes/BxGroupsSearchResult.php

@@ -113,6 +113,31 @@ class BxGroupsSearchResult extends BxBaseModGroupsSearchResult
                 $this->aCurrent['title'] = _t('_bx_groups_page_title_joined_entries');
                 $this->aCurrent['rss']['link'] = 'modules/?r=groups/rss/' . $sMode . '/' . $oJoinedProfile->id();
                 break;
+                
+                
+            case 'followed_entries':
+                $oJoinedProfile = BxDolProfile::getInstance((int)$aParams['followed_profile']);
+                if (!$oJoinedProfile) {
+                    $this->isError = true;
+                    break;
+                }
+
+                $bProcessConditionsForPrivateContent = false;
+
+                $this->aCurrent['join']['followed'] = array(
+                    'type' => 'INNER',
+                    'table' => 'sys_profiles_conn_subscriptions',
+                    'mainField' => 'id',
+                    'onField' => 'content',
+                    'joinFields' => array('initiator'),
+                );
+
+                $this->aCurrent['restriction']['followed'] = array('value' => $oJoinedProfile->id(), 'field' => 'initiator', 'operator' => '=', 'table' => 'sys_profiles_conn_subscriptions');
+
+                $this->sBrowseUrl = 'page.php?i=' . $CNF['URI_FOLLOWED_ENTRIES'] . '&profile_id={profile_id}';
+                $this->aCurrent['title'] = _t('_bx_groups_page_title_followed_entries');
+                $this->aCurrent['rss']['link'] = 'modules/?r=groups/rss/' . $sMode . '/' . $oJoinedProfile->id();
+                break;
 
             case 'connections':
                 if ($this->_setConnectionsConditions($aParams)) {

+ 8 - 2
modules/boonex/groups/install/langs/en.xml

@@ -127,8 +127,10 @@
 	<string name="_bx_groups_page_title_manage"><![CDATA[Manage Groups]]></string>
 	<string name="_bx_groups_page_title_sys_top"><![CDATA[Top Groups]]></string>
 	<string name="_bx_groups_page_title_top"><![CDATA[Top Groups]]></string>
-  <string name="_bx_groups_page_title_sys_joined"><![CDATA[Joined  Groups]]></string>
-  <string name="_bx_groups_page_title_joined"><![CDATA[Joined Groups]]></string>
+    <string name="_bx_groups_page_title_sys_joined"><![CDATA[Joined Groups]]></string>
+    <string name="_bx_groups_page_title_sys_followed"><![CDATA[Followed Groups]]></string>
+    <string name="_bx_groups_page_title_joined"><![CDATA[Joined Groups]]></string>
+    <string name="_bx_groups_page_title_followed"><![CDATA[Followed Groups]]></string>
 	<string name="_bx_groups_page_title_sys_invite_to_group"><![CDATA[Invite Members to the Group]]></string>
 	<string name="_bx_groups_page_title_invite_to_group"><![CDATA[Invite Members to the Group]]></string>
 	<string name="_bx_groups_page_title_sys_entries_search"><![CDATA[Search]]></string>
@@ -151,6 +153,8 @@
     <string name="_bx_groups_page_block_title_sys_entries_in_context"><![CDATA[Groups in context]]></string>
 	<string name="_bx_groups_page_block_title_sys_joined_entries"><![CDATA[Joined Groups]]></string>
 	<string name="_bx_groups_page_block_title_joined_entries"><![CDATA[Joined Groups]]></string>
+    <string name="_bx_groups_page_block_title_sys_followed_entries"><![CDATA[Followed Groups]]></string>
+	<string name="_bx_groups_page_block_title_followed_entries"><![CDATA[Followed Groups]]></string>
 	<string name="_bx_groups_page_block_title_create_profile"><![CDATA[Create Group]]></string>
 	<string name="_bx_groups_page_block_title_edit_profile"><![CDATA[Edit Group]]></string>
 	<string name="_bx_groups_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
@@ -300,6 +304,8 @@
     <string name="_bx_groups_menu_item_title_entries_search"><![CDATA[Search]]></string>
     <string name="_bx_groups_menu_item_title_system_entries_joined"><![CDATA[Joined]]></string>
     <string name="_bx_groups_menu_item_title_entries_joined"><![CDATA[Joined]]></string>
+    <string name="_bx_groups_menu_item_title_system_entries_followed"><![CDATA[Followed]]></string>
+    <string name="_bx_groups_menu_item_title_entries_followed"><![CDATA[Followed]]></string>
     <string name="_bx_groups_menu_item_title_system_entries_manage"><![CDATA[Manage]]></string>
     <string name="_bx_groups_menu_item_title_entries_manage"><![CDATA[Manage]]></string>
     <string name="_bx_groups_menu_item_title_system_entries_home"><![CDATA[Groups]]></string>

+ 9 - 1
modules/boonex/groups/install/sql/enable.sql

@@ -163,6 +163,13 @@ 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_joined_groups', 1, 'bx_groups', '_bx_groups_page_block_title_joined_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:21:"browse_joined_entries";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;b:1;}}', 0, 1, 0);
 
+-- PAGE: followed profiles
+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_followed_groups', '_bx_groups_page_title_sys_followed', '_bx_groups_page_title_followed', 'bx_groups', 5, 2147483647, 1, 'groups-followed', 'page.php?i=groups-followed', '', '', '', 0, 1, 0, 'BxGroupsPageBrowse', 'modules/boonex/groups/classes/BxGroupsPageBrowse.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_followed_groups', 1, 'bx_groups', '_bx_groups_page_block_title_followed_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:23:"browse_followed_entries";s:6:"params";a:2:{i:0;s:12:"{profile_id}";i:1;b:1;}}', 0, 1, 0);
+
 -- PAGE: module manage own
 
 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 
@@ -347,7 +354,8 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_groups_submenu', 'bx_groups', 'groups-top', '_bx_groups_menu_item_title_system_entries_top', '_bx_groups_menu_item_title_entries_top', 'page.php?i=groups-top', '', '', '', '', 2147483647, 1, 1, 2),
 ('bx_groups_submenu', 'bx_groups', 'groups-search', '_bx_groups_menu_item_title_system_entries_search', '_bx_groups_menu_item_title_entries_search', 'page.php?i=groups-search', '', '', '', '', 2147483647, 1, 1, 3),
 ('bx_groups_submenu', 'bx_groups', 'groups-joined', '_bx_groups_menu_item_title_system_entries_joined', '_bx_groups_menu_item_title_entries_joined', 'page.php?i=groups-joined', '', '', '', '', 2147483647, 1, 1, 4),
-('bx_groups_submenu', 'bx_groups', 'groups-manage', '_bx_groups_menu_item_title_system_entries_manage', '_bx_groups_menu_item_title_entries_manage', 'page.php?i=groups-manage', '', '', '', '', 2147483646, 1, 1, 5);
+('bx_groups_submenu', 'bx_groups', 'groups-followed', '_bx_groups_menu_item_title_system_entries_followed', '_bx_groups_menu_item_title_entries_followed', 'page.php?i=groups-followed', '', '', '', '', 2147483647, 1, 1, 5),
+('bx_groups_submenu', 'bx_groups', 'groups-manage', '_bx_groups_menu_item_title_system_entries_manage', '_bx_groups_menu_item_title_entries_manage', 'page.php?i=groups-manage', '', '', '', '', 2147483646, 1, 1, 6);
 
 -- MENU: view submenu