Przeglądaj źródła

Ticket #2962 - Core changes.

AntonLV 6 lat temu
rodzic
commit
bd6149fc7a

+ 14 - 0
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -129,6 +129,20 @@ class BxBaseModGroupsModule extends BxBaseModProfileModule
         return true;
         return true;
     }
     }
 
 
+    public function serviceIsEnableForContext($iProfileId = 0)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $sCnfKey = 'ENABLE_FOR_CONTEXT_IN_MODULES';
+        if(empty($iProfileId) || empty($CNF[$sCnfKey]) || !is_array($CNF[$sCnfKey]))
+            return false;
+
+        if(in_array(BxDolProfile::getInstance($iProfileId)->getModule(), $CNF[$sCnfKey]))
+            return true;
+
+        return false;
+    }
+
     /**
     /**
      * check if provided profile is member of the group 
      * check if provided profile is member of the group 
      */ 
      */ 

+ 26 - 0
modules/base/groups/classes/BxBaseModGroupsSearchResult.php

@@ -81,6 +81,32 @@ class BxBaseModGroupsSearchResult extends BxBaseModProfileSearchResult
 
 
         return true;
         return true;
     }
     }
+
+    protected function _updateCurrentForContext($sMode, $aParams, &$oProfileContext)
+    {
+        $CNF = &$this->oModule->_oConfig->CNF;
+        
+        $oProfileContext = BxDolProfile::getInstance((int)$aParams['context']);
+        if (!$oProfileContext) 
+            return false;
+
+        $iProfileIdContext = $oProfileContext->id();
+        $this->aCurrent['restriction']['context'] = array(
+            'value' => -$iProfileIdContext,
+            'field' => $CNF['FIELD_ALLOW_VIEW_TO'],
+            'operator' => '=',
+            'table' => $CNF['TABLE_ENTRIES']
+        );
+
+        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=' . $CNF['URI_ENTRIES_BY_CONTEXT'] . '&profile_id={profile_id}';
+        $this->aCurrent['title'] = _t($CNF['T']['txt_all_entries_by_context']);
+        $this->aCurrent['rss']['link'] = 'modules/?r=' . $this->oModule->_oConfig->getUri() . '/rss/' . $sMode . '/' . $iProfileIdContext;
+
+        return true;
+    }
 }
 }
 
 
 /** @} */
 /** @} */