BxBaseModGroupsGridInvites.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 BaseGroups Base classes for groups modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModGroupsGridinvites extends BxTemplGrid
  12. {
  13. protected $_sContentModule;
  14. protected $_iGroupProfileId;
  15. protected $_oModule;
  16. protected $_aContentInfo = array();
  17. public function __construct ($aOptions, $oTemplate = false)
  18. {
  19. $this->_oModule = BxDolModule::getInstance($this->_sContentModule);
  20. parent::__construct ($aOptions, $oTemplate);
  21. }
  22. protected function _getCellName ($mixedValue, $sKey, $aField, $aRow)
  23. {
  24. $oProfile = BxDolProfile::getInstance($aRow['invited_profile_id']);
  25. if (!$oProfile)
  26. return _t('_sys_txt_error_occured');
  27. return parent::_getCellDefault ($oProfile->getUnit(), $sKey, $aField, $aRow);
  28. }
  29. protected function _getActionDelete ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
  30. {
  31. $aCheck = checkActionModule(bx_get_logged_profile_id(), 'delete invites', $this->_sContentModule, false);
  32. if ($aRow['author_profile_id'] == bx_get_logged_profile_id() || $aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED)
  33. return parent::_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
  34. return '';
  35. }
  36. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  37. {
  38. $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `group_profile_id` = ?", (int)bx_get('profile_id'));
  39. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  40. }
  41. }
  42. /** @} */