Переглянути джерело

Ticket #3998 - Channels: Followed channels block.

AntonLV 4 роки тому
батько
коміт
33b2804c9e

+ 17 - 19
modules/boonex/channels/classes/BxCnlModule.php

@@ -418,7 +418,7 @@ class BxCnlModule extends BxBaseModGroupsModule
     {
         return $this->_serviceBrowseWithParam ('followed_entries', 'profile_id', $iProfileId, $aParams);
     }
-    
+
     public function serviceBrowseAuthor($iProfileId = 0, $aParams = array())
     {
         $CNF = &$this->_oConfig->CNF;
@@ -429,32 +429,30 @@ class BxCnlModule extends BxBaseModGroupsModule
         $sResult = isset($aParams['empty_message']) && (bool)$aParams['empty_message'] === true ? MsgBox(_t('_Empty')) : '';
 
         $oConnection = BxDolConnection::getObjectInstance('sys_profiles_subscriptions');
-        $aProfile = $oConnection->getConnectedContent($iProfileId);
-        $aVars = array();
-        foreach ($aProfile as $iProfileId) {
+        if(!$oConnection)
+            return $sResult;
+
+        $aProfiles = $oConnection->getConnectedContentByType($iProfileId, $this->getName());
+
+        $aTmplVars = [];
+        foreach ($aProfiles as $iProfileId) {
             $oProfile = BxDolProfile::getInstance($iProfileId);
-            if (!$oProfile || $oProfile->getModule() != $this->getName())
+            if(!$oProfile)
                 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)));
+            $aTmplVars[] = [
+                'unit' => $oProfile->getUnit(0, ['template' => 'unit_wo_cover'])
+            ];
         }
 
-        if(empty($aVars) || !is_array($aVars))
+        if(empty($aTmplVars) || !is_array($aTmplVars))
             return $sResult;
 
-        return $this->_oTemplate->parseHtmlByName('my_channels.html', array(
-            'bx_if:show_list' => array(
-                'condition' => count($aVars) > 0,
-                'content' => array(
-                    'bx_repeat:items' => $aVars
-                )
-            )
-        ));
+        return $this->_oTemplate->parseHtmlByName('my_channels.html', [
+            'bx_repeat:items' => $aTmplVars
+        ]);
     }
-    
+
     public function serviceDeleteProfileFromFansAndAdmins ($iProfileId)
     {
         return true;

+ 3 - 7
modules/boonex/channels/template/my_channels.html

@@ -1,7 +1,3 @@
-<bx_if:show_list>
-    <ul class="bx-menu-verlit bx-menu-object-sys_account_dashboard_manage_tools bx-clearfix">
-        <bx_repeat:items>
-            <li class="bx-def-margin-sec-top "><a href="__link__">__title__</a></li>
-        </bx_repeat:items>
-    </ul>
-</bx_if:show_list>
+<div class="bx-base-pofile-units-wrapper flex flex-wrap items-start -mb-4">
+    <bx_repeat:items>__unit__</bx_repeat:items>
+</div>