BxAdsGridCommon.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 Ads Ads
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxAdsGridCommon extends BxBaseModTextGridCommon
  12. {
  13. public function __construct ($aOptions, $oTemplate = false)
  14. {
  15. $this->MODULE = 'bx_ads';
  16. parent::__construct ($aOptions, $oTemplate);
  17. }
  18. protected function _getCellStatusAdmin($mixedValue, $sKey, $aField, $aRow)
  19. {
  20. $CNF = &$this->_oModule->_oConfig->CNF;
  21. if(!empty($CNF['T']['filter_item_' . $mixedValue]))
  22. $mixedValue = $CNF['T']['filter_item_' . $mixedValue];
  23. else
  24. $mixedValue = '_undefined';
  25. return parent::_getCellDefault(_t($mixedValue), $sKey, $aField, $aRow);
  26. }
  27. protected function _getCellSwitcher ($mixedValue, $sKey, $aField, $aRow)
  28. {
  29. if(!$this->_switcherState2Checked($aRow['status_admin']))
  30. return parent::_getCellDefault('', $sKey, $aField, $aRow);
  31. return parent::_getCellSwitcher ($mixedValue, $sKey, $aField, $aRow);
  32. }
  33. protected function _isRowDisabled($aRow)
  34. {
  35. if(parent::_isRowDisabled($aRow))
  36. return true;
  37. return !$this->_switcherState2Checked($aRow['status_admin']);
  38. }
  39. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  40. {
  41. $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `author`=?", bx_get_logged_profile_id());
  42. return $this->__getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  43. }
  44. }
  45. /** @} */