1
0

BxBaseModGroupsGridInvites.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. $this->_aQueryAppend['profile_id'] = (int)bx_get('profile_id');
  22. }
  23. protected function _getCellName ($mixedValue, $sKey, $aField, $aRow)
  24. {
  25. $oProfile = BxDolProfile::getInstance($aRow['invited_profile_id']);
  26. if (!$oProfile)
  27. return _t('_sys_txt_error_occured');
  28. return parent::_getCellDefault ($oProfile->getUnit(), $sKey, $aField, $aRow);
  29. }
  30. protected function _getCellAdded ($mixedValue, $sKey, $aField, $aRow)
  31. {
  32. return parent::_getCellDefault(bx_time_js($mixedValue), $sKey, $aField, $aRow);
  33. }
  34. protected function _getActionDelete ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
  35. {
  36. $aCheck = checkActionModule(bx_get_logged_profile_id(), 'delete invites', $this->_sContentModule, false);
  37. if ($aRow['author_profile_id'] == bx_get_logged_profile_id() || $aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED)
  38. return parent::_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
  39. return '';
  40. }
  41. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  42. {
  43. $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `group_profile_id` = ?", (int)bx_get('profile_id'));
  44. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  45. }
  46. }
  47. /** @} */