|
|
@@ -109,15 +109,14 @@ class BxBaseModGroupsSearchResult extends BxBaseModProfileSearchResult
|
|
|
{
|
|
|
$CNF = &$this->oModule->_oConfig->CNF;
|
|
|
|
|
|
- $oProfileAuthor = BxDolProfile::getInstance((int)$aParams['author']);
|
|
|
- if (!$oProfileAuthor)
|
|
|
- return false;
|
|
|
+ if(!($oProfileAuthor = BxDolProfile::getInstance((int)$aParams['author'])))
|
|
|
+ return !($this->isError = true);
|
|
|
|
|
|
$iProfileAuthor = $oProfileAuthor->id();
|
|
|
$this->aCurrent['restriction']['owner']['value'] = $iProfileAuthor;
|
|
|
|
|
|
if(!empty($aParams['per_page']))
|
|
|
- $this->aCurrent['paginate']['perPage'] = is_numeric($aParams['per_page']) ? (int)$aParams['per_page'] : (int)getParam($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_JOINED_ENTRIES'] . '&profile_id={profile_id}';
|
|
|
$this->aCurrent['title'] = _t($CNF['T']['txt_all_entries_by_author']);
|
|
|
@@ -130,9 +129,8 @@ class BxBaseModGroupsSearchResult extends BxBaseModProfileSearchResult
|
|
|
{
|
|
|
$CNF = &$this->oModule->_oConfig->CNF;
|
|
|
|
|
|
- $oProfileAuthor = BxDolProfile::getInstance((int)$aParams['user']);
|
|
|
- if (!$oProfileAuthor)
|
|
|
- return false;
|
|
|
+ if(!($oProfileAuthor = BxDolProfile::getInstance((int)$aParams['user'])))
|
|
|
+ return !($this->isError = true);
|
|
|
|
|
|
$iListId = 0;
|
|
|
if(isset($aParams['list_id']))
|
|
|
@@ -141,16 +139,16 @@ class BxBaseModGroupsSearchResult extends BxBaseModProfileSearchResult
|
|
|
$iProfileAuthor = $oProfileAuthor->id();
|
|
|
$oFavorite = $this->oModule->getObjectFavorite();
|
|
|
if(!$oFavorite || (!$oFavorite->isPublic() && $iProfileAuthor != bx_get_logged_profile_id()))
|
|
|
- return false;
|
|
|
+ return !($this->isError = true);
|
|
|
|
|
|
$aConditions = $oFavorite->getConditionsTrack($CNF['TABLE_ENTRIES'], 'id', $iProfileAuthor, $iListId);
|
|
|
if(!empty($aConditions) && is_array($aConditions)) {
|
|
|
if(empty($this->aCurrent['restriction']) || !is_array($this->aCurrent['restriction']))
|
|
|
- $this->aCurrent['restriction'] = array();
|
|
|
+ $this->aCurrent['restriction'] = [];
|
|
|
$this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], $aConditions['restriction']);
|
|
|
|
|
|
if(empty($this->aCurrent['join']) || !is_array($this->aCurrent['join']))
|
|
|
- $this->aCurrent['join'] = array();
|
|
|
+ $this->aCurrent['join'] = [];
|
|
|
$this->aCurrent['join'] = array_merge($this->aCurrent['join'], $aConditions['join']);
|
|
|
}
|
|
|
|
|
|
@@ -165,25 +163,24 @@ class BxBaseModGroupsSearchResult extends BxBaseModProfileSearchResult
|
|
|
{
|
|
|
$CNF = &$this->oModule->_oConfig->CNF;
|
|
|
|
|
|
- $oJoinedProfile = BxDolProfile::getInstance((int)$aParams['joined_profile']);
|
|
|
- if (!$oJoinedProfile)
|
|
|
- return false;
|
|
|
+ if(!($oJoinedProfile = BxDolProfile::getInstance((int)$aParams['joined_profile'])))
|
|
|
+ return !($this->isError = true);
|
|
|
|
|
|
- $bProcessConditionsForPrivateContent = false;
|
|
|
+ $sDbPrefix = $this->oModule->_oConfig->getDbPrefix();
|
|
|
|
|
|
- $this->aCurrent['join']['fans'] = array(
|
|
|
+ $this->aCurrent['join']['fans'] = [
|
|
|
'type' => 'INNER',
|
|
|
- 'table' => 'bx_groups_fans',
|
|
|
+ 'table' => $sDbPrefix . 'fans',
|
|
|
'mainField' => 'id',
|
|
|
'onField' => 'content',
|
|
|
- 'joinFields' => array('initiator'),
|
|
|
- );
|
|
|
+ 'joinFields' => ['initiator'],
|
|
|
+ ];
|
|
|
|
|
|
- $this->aCurrent['restriction']['fans'] = array('value' => $oJoinedProfile->id(), 'field' => 'initiator', 'operator' => '=', 'table' => 'bx_groups_fans');
|
|
|
+ $this->aCurrent['restriction']['fans'] = ['value' => $oJoinedProfile->id(), 'field' => 'initiator', 'operator' => '=', 'table' => $sDbPrefix . 'fans'];
|
|
|
|
|
|
$this->sBrowseUrl = 'page.php?i=' . $CNF['URI_JOINED_ENTRIES'] . '&profile_id={profile_id}';
|
|
|
$this->aCurrent['title'] = ($sKey = 'txt_joined_entries') && !empty($CNF['T'][$sKey]) ? _t($CNF['T'][$sKey]) : '';
|
|
|
- $this->aCurrent['rss']['link'] = 'modules/?r=groups/rss/' . $sMode . '/' . $oJoinedProfile->id();
|
|
|
+ $this->aCurrent['rss']['link'] = 'modules/?r=' . $this->oModule->_oConfig->getUri() . '/rss/' . $sMode . '/' . $oJoinedProfile->id();
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -191,18 +188,17 @@ class BxBaseModGroupsSearchResult extends BxBaseModProfileSearchResult
|
|
|
protected function _updateCurrentForContext($sMode, $aParams, &$oProfileContext)
|
|
|
{
|
|
|
$CNF = &$this->oModule->_oConfig->CNF;
|
|
|
-
|
|
|
- $oProfileContext = BxDolProfile::getInstance((int)$aParams['context']);
|
|
|
- if (!$oProfileContext)
|
|
|
- return false;
|
|
|
+
|
|
|
+ if(!($oProfileContext = BxDolProfile::getInstance((int)$aParams['context'])))
|
|
|
+ return !($this->isError = true);
|
|
|
|
|
|
$iProfileIdContext = $oProfileContext->id();
|
|
|
- $this->aCurrent['restriction']['context'] = array(
|
|
|
+ $this->aCurrent['restriction']['context'] = [
|
|
|
'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']);
|
|
|
@@ -213,6 +209,30 @@ class BxBaseModGroupsSearchResult extends BxBaseModProfileSearchResult
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ protected function _updateCurrentForFollowedEntries($sMode, $aParams, &$oJoinedProfile)
|
|
|
+ {
|
|
|
+ $CNF = &$this->oModule->_oConfig->CNF;
|
|
|
+
|
|
|
+ if(!($oJoinedProfile = BxDolProfile::getInstance((int)$aParams['followed_profile'])))
|
|
|
+ return !($this->isError = true);
|
|
|
+
|
|
|
+ $this->aCurrent['join']['followed'] = [
|
|
|
+ 'type' => 'INNER',
|
|
|
+ 'table' => 'sys_profiles_conn_subscriptions',
|
|
|
+ 'mainField' => 'id',
|
|
|
+ 'onField' => 'content',
|
|
|
+ 'joinFields' => ['initiator'],
|
|
|
+ ];
|
|
|
+
|
|
|
+ $this->aCurrent['restriction']['followed'] = ['value' => $oJoinedProfile->id(), 'field' => 'initiator', 'operator' => '=', 'table' => 'sys_profiles_conn_subscriptions'];
|
|
|
+
|
|
|
+ $this->sBrowseUrl = 'page.php?i=' . $CNF['URI_FOLLOWED_ENTRIES'] . '&profile_id={profile_id}';
|
|
|
+ $this->aCurrent['title'] = ($sKey = 'txt_followed_entries') && !empty($CNF['T'][$sKey]) ? _t($CNF['T'][$sKey]) : '';
|
|
|
+ $this->aCurrent['rss']['link'] = 'modules/?r=' . $this->oModule->_oConfig->getUri() . '/rss/' . $sMode . '/' . $oJoinedProfile->id();
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/** @} */
|