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

Merge branch 'master' of https://github.com/unaio/una

AntonLV 7 лет назад
Родитель
Сommit
57729ee809

+ 3 - 1
inc/classes/BxDolSearch.php

@@ -444,8 +444,10 @@ class BxDolSearchResult implements iBxDolReplaceable
     function displayResultBlock ()
     {
         $aData = $this->getSearchData();
+
+        $sCode = '';
         if (count($aData) > 0) {
-            $sCode .= $this->addCustomParts();
+            $sCode = $this->addCustomParts();
             foreach ($aData as $iKey => $aValue) {
                 $sCode .= $this->displaySearchUnit($aValue);
             }

+ 16 - 0
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -1482,6 +1482,22 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
 
         return parent::_getContent($iContentId, $sFuncGetContent);
     }
+
+    /** Returns list of members by mode with limited number of records for React Jot
+     * @param string $sMode
+     * @param int $iStart
+     * @param int $iPerPage
+     * @return mixed
+     */
+
+    public function serviceGetMembers($sMode = 'active', $iStart = 0, $iPerPage = 10){
+        bx_import('SearchResult', $this->_aModule);
+        $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
+        $o = new $sClass($sMode);
+
+        $o -> aCurrent['paginate'] = array('perPage' => $iPerPage, 'forceStart' => $iStart);
+        return $o -> getSearchData();
+    }
 }
 
 /** @} */

+ 38 - 0
modules/boonex/channels/classes/BxCnlModule.php

@@ -331,6 +331,44 @@ class BxCnlModule extends BxBaseModGroupsModule
             $oConn->addConnection($oProfile->id(), $oProfileChannel->id());
         }
     }
+
+    /** Returns profile's subscribed channels  React Jot
+     *
+     * @param int $iProfileId
+     * @param array $aParams
+     * @return array
+     */
+
+    public function serviceBrowseAuthorChannels($iProfileId = 0, $aParams = array())
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        if(empty($iProfileId))
+            $iProfileId = bx_get_logged_profile_id();
+
+        $oConnection = BxDolConnection::getObjectInstance('sys_profiles_subscriptions');
+        $aProfile = $oConnection->getConnectedContent($iProfileId);
+        $aVars = array();
+        foreach ($aProfile as $iProfileId) {
+            $oProfile = BxDolProfile::getInstance($iProfileId);
+            if (!$oProfile || $oProfile->getModule() != $this->getName())
+                continue;
+
+            $iContentId = $oProfile->getContentId();
+            $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+
+            if (isset($aContentInfo[$CNF['FIELD_NAME']]))
+                array_push($aVars, array(
+                    'title' => $aContentInfo[$CNF['FIELD_NAME']],
+                    'link' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $iContentId),
+                    'followers' => $oConnection -> getConnectedInitiatorsCount($iProfileId),
+                    'id' => $iProfileId,
+                    'icon' => $oProfile -> getThumb()
+                ));
+        }
+
+        return $aVars;
+    }
 }
 
 /** @} */

+ 16 - 0
modules/boonex/convos/classes/BxCnvModule.php

@@ -227,6 +227,22 @@ class BxCnvModule extends BxBaseModTextModule
         return $this->_oTemplate->getMessagesPreviews($a);
     }
 
+    /**
+     * Returns preview of profile's conversations with statistic for React Jot
+     * @param int $iProfileId
+     * @param int $iStart
+     * @param int $iPerPage
+     * @param int $iFolderId
+     * @return mixed
+     */
+    public function serviceGetMessagesPreviews ($iProfileId = 0, $iStart = 0, $iPerPage = 10, $iFolderId = BX_CNV_FOLDER_INBOX)
+    {
+        if (!$iProfileId)
+            $iProfileId = bx_get_logged_profile_id();
+
+        return $this->_oDb->getMessagesPreviews($iProfileId, (int)$iStart, (int)$iPerPage, $iFolderId);
+    }
+
     /**
      * Get number of unread messages for spme profile
      * @param $iProfileId - profile to get unread messages for, if omitted then currently logged is profile is used

+ 8 - 1
modules/boonex/notifications/classes/BxNtfsModule.php

@@ -239,7 +239,14 @@ class BxNtfsModule extends BxBaseModNotificationsModule
 		    $aParams = array_merge($aParams, $aBrowseParams);
 
 		list($aEvent) = $this->_oDb->getEvents($aParams, true);
-		return $aEvent;
+
+        // returns parsed content for React Jot
+		if (!is_array($aBrowseParams) && $aBrowseParams === 'return_parsed_content')
+		    foreach ($aEvent as &$aContent)
+                $this->_oTemplate->getPost($aContent, array('return_parsed_content'));
+
+
+        return $aEvent;
     }
 
     /**

+ 4 - 0
modules/boonex/notifications/classes/BxNtfsTemplate.php

@@ -180,6 +180,10 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
     	    $aEvent['content_parsed'] = $this->parseHtmlByContent($aEvent['content_parsed'], $aEvent['content'], array('{', '}'));
         }
 
+        // returns parsed content for React Jot
+        if(isset($aBrowseParams['return_parsed_content']))
+            return $aEvent;
+
         return $this->parseHtmlByName('event.html', array (
             'html_id' => $this->_oConfig->getHtmlIds('view', 'event') . $aEvent['id'],
             'style_prefix' => $this->_oConfig->getPrefix('style'),

+ 19 - 0
modules/boonex/oauth2/classes/BxOAuthAPI.php

@@ -317,8 +317,21 @@ class BxOAuthAPI extends BxDol
             unset($aProfileInfo['content_id']);
             unset($aProfileInfo['status']);
 
+            // --- account's profiles info
             $aProfileInfo['email'] = $oAccount->getEmail();
 
+            // ---- returns all accounts profiles React Jot
+            $aProfiles = $oAccount->getProfiles();
+            foreach($aProfiles as &$aProfile) {
+               $oSubProfile = BxDolProfile::getInstance($aProfile['id']);
+               $aProfileInfo['profiles'][$aProfile['id']] = array(
+                    'name' => $oSubProfile->getDisplayName(),
+                    'profile_link' => $oSubProfile->getUrl(),
+                    'picture' => $oSubProfile->getThumb(),
+                    'id' => $aProfile['id']
+               );
+            }
+
             // TODO: fetch extended info from profile module
         }
 
@@ -328,6 +341,12 @@ class BxOAuthAPI extends BxDol
         $aProfileInfo['profile_display_name'] = $oProfile->getDisplayName();
         $aProfileInfo['profile_link'] = $oProfile->getUrl();
         $aProfileInfo['picture'] = $oProfile->getPicture();
+		
+		// ---- additional profile's fields for React Jot
+        $aProfileInfo['cover'] = $oProfile->getCover();
+        $aProfileInfo['followers'] = (int)BxDolConnection::getObjectInstance('sys_profiles_subscriptions')->getConnectedInitiatorsCount($aProfileInfo['id']);
+        $aProfileInfo['following'] = (int)BxDolConnection::getObjectInstance('sys_profiles_subscriptions')->getConnectedContentCount($aProfileInfo['id']);
+        $aProfileInfo['friends'] = (int)BxDolConnection::getObjectInstance('sys_profiles_friends')->getConnectedContentCount($aProfileInfo['id'], true);
 
         return $aProfileInfo;
     }

+ 3 - 6
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -3527,20 +3527,17 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
 
         switch($sTab)
         {
-            case 'feed':
-                $sType = BX_BASE_MOD_NTFS_TYPE_PUBLIC;
-                break;
             case 'latest':
-                $sType = BX_TIMELINE_TYPE_OWNER_AND_CONNECTIONS;
-                $sFilter = BX_TIMELINE_FILTER_OWNER;
+                $sType = BX_BASE_MOD_NTFS_TYPE_PUBLIC;
                 break;
             case 'popular':
                 $sType = BX_TIMELINE_TYPE_HOT;
                 break;
             case 'profile':
                 $sType = BX_BASE_MOD_NTFS_TYPE_OWNER;
-                $sFilter = BX_TIMELINE_FILTER_OWNER;
                 break;
+            default:
+                $sType = BX_TIMELINE_TYPE_OWNER_AND_CONNECTIONS;
         }
 
         $aModules = array();