Преглед на файлове

Tickets #2790 - Upcomming connected events.

AntonLV преди 6 години
родител
ревизия
5df189610a
променени са 2 файла, в които са добавени 64 реда и са изтрити 1 реда
  1. 45 1
      modules/boonex/events/classes/BxEventsModule.php
  2. 19 0
      modules/boonex/events/classes/BxEventsSearchResult.php

+ 45 - 1
modules/boonex/events/classes/BxEventsModule.php

@@ -76,7 +76,7 @@ class BxEventsModule extends BxBaseModGroupsModule
      * @page service Service Calls
      * @section bx_events Events
      * @subsection bx_events-browse Browse
-     * @subsubsection bx_events-browse_upcoming_profiles browse_past_profiles
+     * @subsubsection bx_events-browse_upcoming_profiles browse_upcoming_profiles
      * 
      * @code bx_srv('bx_events', 'browse_upcoming_profiles', [...]); @endcode
      * 
@@ -107,6 +107,50 @@ class BxEventsModule extends BxBaseModGroupsModule
         return $this->_serviceBrowse ('upcoming', $aParams, BX_DB_PADDING_DEF, $bDisplayEmptyMsg, $bAjaxPaginate);
     }
 
+    /**
+     * @page service Service Calls
+     * @section bx_events Events
+     * @subsection bx_events-browse Browse
+     * @subsubsection bx_events-browse_upcoming_connected_profiles browse_upcoming_connected_profiles
+     * 
+     * @code bx_srv('bx_events', 'browse_upcoming_connected_profiles', [...]); @endcode
+     * 
+     * Browse upcoming connected (followed) events
+     * 
+     * @param $bDisplayEmptyMsg show "empty" message or not if nothing found
+     * @param $bAjaxPaginate use AJAX paginate or not
+     *
+     * @see BxEventsModule::serviceBrowseUpcomingConnectedProfiles
+     */
+    /** 
+     * @ref bx_events-browse_upcoming_connected_profiles "browse_upcoming_connected_profiles"
+     */
+    public function serviceBrowseUpcomingConnectedProfiles ($aParams = false)
+    {
+        if(!is_array($aParams) || empty($aParams['object']) || empty($aParams['profile']))
+            return '';
+
+        $bDisplayEmptyMsg = false;
+        if(isset($aParams['empty_message'])) {
+            $bDisplayEmptyMsg = (bool)$aParams['empty_message'];
+            unset($aParams['empty_message']);
+        }
+
+        $bAjaxPaginate = true;
+        if(isset($aParams['ajax_paginate'])) {
+            $bAjaxPaginate = (bool)$aParams['ajax_paginate'];
+            unset($aParams['ajax_paginate']);
+        }
+
+        $aDefaults = array(
+            'type' => 'content',
+            'mutual' => false,
+            'profile2' => 0
+        );
+
+        return $this->_serviceBrowse ('upcoming_connected', array_merge($aDefaults, $aParams), BX_DB_PADDING_DEF, $bDisplayEmptyMsg, $bAjaxPaginate);
+    }
+
     /**
      * @page service Service Calls
      * @section bx_events Events

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

@@ -185,6 +185,25 @@ class BxEventsSearchResult extends BxBaseModGroupsSearchResult
                 $this->sBrowseUrl = 'page.php?i=events-upcoming';
                 break;
 
+            case 'upcoming_connected':
+                if(!$this->_setConnectionsConditions($aParams)) 
+                    break;
+
+                $bProcessConditionsForPrivateContent = false;
+
+                $this->aCurrent['rss']['link'] = 'modules/?r=events/rss/upcoming';
+                $this->aCurrent['title'] = _t('_bx_events_page_title_browse_upcoming');
+                $this->aCurrent['restriction']['upcoming']['value'] = time();
+                if(!empty($aParams['date_start_from']))
+                    $this->aCurrent['restriction']['date_start_from']['value'] = $aParams['date_start_from'];
+                if(!empty($aParams['date_start_to']))
+                    $this->aCurrent['restriction']['date_start_to']['value'] = $aParams['date_start_to'];
+                $this->aCurrent['sorting'] = 'upcoming';
+                if(!empty($aParams['per_page']))
+                    $this->aCurrent['paginate']['perPage'] = is_numeric($aParams['per_page']) ? (int)$aParams['per_page'] : (int)getParam($aParams['per_page']);
+                $this->sBrowseUrl = 'page.php?i=events-upcoming';
+                break;
+
             case 'past':
                 $this->aCurrent['rss']['link'] = 'modules/?r=events/rss/' . $sMode;
                 $this->aCurrent['title'] = _t('_bx_events_page_title_browse_past');