BxBaseModGroupsSearchResult.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup BaseGroup Base classes for group modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModGroupsSearchResult extends BxBaseModProfileSearchResult
  12. {
  13. public function __construct($sMode = '', $aParams = array())
  14. {
  15. parent::__construct($sMode, $aParams);
  16. }
  17. protected function _setFavoriteConditions($sMode, $aParams, &$oProfileAuthor)
  18. {
  19. $CNF = &$this->oModule->_oConfig->CNF;
  20. $oProfileAuthor = BxDolProfile::getInstance((int)$aParams['user']);
  21. if (!$oProfileAuthor)
  22. return false;
  23. $iProfileAuthor = $oProfileAuthor->id();
  24. $oFavorite = $this->oModule->getObjectFavorite();
  25. if(!$oFavorite->isPublic() && $iProfileAuthor != bx_get_logged_profile_id())
  26. return false;
  27. $aConditions = $oFavorite->getConditionsTrack($CNF['TABLE_ENTRIES'], 'id', $iProfileAuthor);
  28. if(!empty($aConditions) && is_array($aConditions)) {
  29. if(empty($this->aCurrent['restriction']) || !is_array($this->aCurrent['restriction']))
  30. $this->aCurrent['restriction'] = array();
  31. $this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], $aConditions['restriction']);
  32. if(empty($this->aCurrent['join']) || !is_array($this->aCurrent['join']))
  33. $this->aCurrent['join'] = array();
  34. $this->aCurrent['join'] = array_merge($this->aCurrent['join'], $aConditions['join']);
  35. }
  36. $this->sBrowseUrl = 'page.php?i=' . $CNF['URI_JOINED_ENTRIES'] . '&profile_id={profile_id}';
  37. $this->aCurrent['title'] = _t($CNF['T']['txt_all_entries_by_author']);
  38. $this->aCurrent['rss']['link'] = 'modules/?r=' . $this->oModule->_oConfig->getUri() . '/rss/' . $sMode . '/' . $iProfileAuthor;
  39. return true;
  40. }
  41. }
  42. /** @} */