AntonLV пре 8 година
родитељ
комит
846a0bd5c7

+ 30 - 25
modules/boonex/channels/classes/BxCnlModule.php

@@ -204,32 +204,37 @@ class BxCnlModule extends BxBaseModGroupsModule
          return '';
     }
     
-    public function serviceBrowseMyChannels()
-    {   
-        $iMyProfileId = bx_get_logged_profile_id();
-        if ($iMyProfileId){
-            $CNF = &$this->_oConfig->CNF;
-            $oConnection = BxDolConnection::getObjectInstance('sys_profiles_subscriptions');
-            $aProfile = $oConnection->getConnectedContent($iMyProfileId);
-            $aVars = array();
-            foreach ($aProfile as $iProfileId) {
-                $oProfile = BxDolProfile::getInstance($iProfileId);
-                if ($oProfile && $oProfile->getModule() == $this->getName()){
-                    $iContentId = $oProfile->getContentId();
-                    
-                    $aContentInfo = $this->_oDb->getContentInfoById($oProfile->getContentId());
-                    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)));
-                }
-            }
-            if (count($aVars) > 0){
-                return $this->_oTemplate->parseHtmlByName('my_channels.html', 
-                    array('bx_if:show_list' => array(
-                    'condition' => count($aVars) > 0,
-                    'content' => array('bx_repeat:items' => $aVars))
-                ));
-            }
+    public function serviceBrowseMyChannels($aParams = array())
+    {
+        $sResult = isset($aParams['empty_message']) && (bool)$aParams['empty_message'] === true ? MsgBox(_t('_Empty')) : '';
+
+        if(!isLogged())
+            return $sResult;
+
+        $CNF = &$this->_oConfig->CNF;
+
+        $oConnection = BxDolConnection::getObjectInstance('sys_profiles_subscriptions');
+        $aProfile = $oConnection->getConnectedContent(bx_get_logged_profile_id());
+        $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)));
         }
+
+        if(empty($aVars) || !is_array($aVars))
+            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))
+        ));
     }
     
     public function serviceDeleteProfileFromFansAndAdmins ($iProfileId)

+ 1 - 1
modules/boonex/channels/install/sql/enable.sql

@@ -103,7 +103,7 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 ('bx_channels_my', '_bx_channels_page_title_sys_entries_my', '_bx_channels_page_title_entries_my', 'bx_channels', 5, 2147483646, 1, 'channels-my', 'page.php?i=channels-my', '', '', '', 0, 1, 0, 'BxCnlPageBrowse', 'modules/boonex/channels/classes/BxCnlPageBrowse.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
-('bx_channels_my', 1, 'bx_channels', '_bx_channels_page_block_title_entries_my', 11, 2147483646, 'service', 'a:2:{s:6:"module";s:11:"bx_channels";s:6:"method";s:18:"browse_my_channels";}', 0, 1, 1, 1);
+('bx_channels_my', 1, 'bx_channels', '_bx_channels_page_block_title_entries_my', 11, 2147483646, 'service', 'a:3:{s:6:"module";s:11:"bx_channels";s:6:"method";s:18:"browse_my_channels";s:6:"params";a:1:{i:0;a:1:{s:13:"empty_message";b:1;}}}', 0, 1, 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