Răsfoiți Sursa

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

roman.lesnikov@gmail.com 4 ani în urmă
părinte
comite
cbe1c412d7

+ 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>

+ 16 - 5
modules/boonex/notifications/classes/BxNtfsModule.php

@@ -307,19 +307,20 @@ class BxNtfsModule extends BxBaseModNotificationsModule
         if(!$iOwnerId)
             return 0;
 
-        $aParams = $this->_prepareParams(BX_NTFS_TYPE_DEFAULT, $iOwnerId, 0, PHP_INT_MAX);
+        $sModule = $this->_oConfig->getName();
+        $aBrowseParams = $this->_prepareParams(BX_NTFS_TYPE_DEFAULT, $iOwnerId, 0, PHP_INT_MAX);
 
         $sParamCheck = 'perform_privacy_check';
         $sParamCheckFor = 'perform_privacy_check_for';
 
         $iEvents = 0;
         if($this->_oConfig->isEventsGrouped()) {
-            $aEvents = $this->_oDb->getEvents($aParams);
+            $aEvents = $this->_oDb->getEvents($aBrowseParams);
 
             $this->groupEvents($aEvents);
 
             $iCount = 0;
-            $iLastRead = $this->_oDb->getLastRead((int)$aParams['owner_id']);
+            $iLastRead = $this->_oDb->getLastRead((int)$aBrowseParams['owner_id']);
             foreach($aEvents as $aEvent)
                 if($aEvent['id'] > $iLastRead)
                     $iCount++;
@@ -327,11 +328,11 @@ class BxNtfsModule extends BxBaseModNotificationsModule
             $aEvents = array_slice($aEvents, 0, $iCount);
         }
         else {
-            $aParams = array_merge($aParams, [
+            $aBrowseParams = array_merge($aBrowseParams, [
                 'new' => 1,
             ]);
 
-            $aEvents = $this->_oDb->getEvents($aParams);
+            $aEvents = $this->_oDb->getEvents($aBrowseParams);
         }
 
         foreach($aEvents as $aEvent) {
@@ -353,6 +354,16 @@ class BxNtfsModule extends BxBaseModNotificationsModule
             if($sSrvModule && BxDolRequest::serviceExists($sSrvModule, $sSrvMethod) && BxDolService::call($sSrvModule, $sSrvMethod, array('view', $this->_oConfig->getContentObjectId($aEvent), $iViewerId)) !== CHECK_ACTION_RESULT_ALLOWED)
                 continue;
 
+            $bEventCanceled = false;
+            bx_alert($sModule, 'is_notification', 0, 0, [
+                'event' => &$aEvent, 
+                'event_canceled' => &$bEventCanceled,
+                'browse_params' => $aBrowseParams
+            ]);
+
+            if($bEventCanceled)
+                continue;
+
             $iEvents++;
         }
 

+ 1 - 2
modules/boonex/notifications/classes/BxNtfsTemplate.php

@@ -201,12 +201,11 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
 
             $aEvent['content'][$sKey] = call_user_func_array('_t', $aCallParams);
         }
-        
-        $bEventCanceled = false;
 
         $sOwnerUnit = $oOwner->getUnit(0, ['template' => 'unit_wo_info_links']);
 
         $bEventParsed = false;
+        $bEventCanceled = false;
         bx_alert($this->_oConfig->getName(), 'get_notification', 0, 0, [
             'event' => &$aEvent, 
             'event_parsed' => &$bEventParsed,