1
0

BxBaseModTextGridCommon.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 BaseText Base classes for text modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModTextGridCommon extends BxBaseModTextGridAdministration
  12. {
  13. public function __construct ($aOptions, $oTemplate = false)
  14. {
  15. parent::__construct ($aOptions, $oTemplate);
  16. $CNF = &$this->_oModule->_oConfig->CNF;
  17. $this->_sFieldStatus = $CNF['FIELD_STATUS'];
  18. if($this->_oModule->_oConfig->isAutoApprove() && isset($this->_aFilter1Values[BX_BASE_MOD_TEXT_STATUS_PENDING]))
  19. unset($this->_aFilter1Values[BX_BASE_MOD_TEXT_STATUS_PENDING]);
  20. $this->_sManageType = BX_DOL_MANAGE_TOOLS_COMMON;
  21. }
  22. protected function _getCellSwitcher ($mixedValue, $sKey, $aField, $aRow)
  23. {
  24. if(!$this->_switcherState2Checked($aRow['status_admin']))
  25. return parent::_getCellDefault('', $sKey, $aField, $aRow);
  26. return parent::_getCellSwitcher ($mixedValue, $sKey, $aField, $aRow);
  27. }
  28. protected function _getCellStatusAdmin($mixedValue, $sKey, $aField, $aRow)
  29. {
  30. $CNF = &$this->_oModule->_oConfig->CNF;
  31. if(!empty($CNF['T']['filter_item_' . $mixedValue]))
  32. $mixedValue = $CNF['T']['filter_item_' . $mixedValue];
  33. else
  34. $mixedValue = '_undefined';
  35. return parent::_getCellDefault(_t($mixedValue), $sKey, $aField, $aRow);
  36. }
  37. protected function _isRowDisabled($aRow)
  38. {
  39. if(parent::_isRowDisabled($aRow))
  40. return true;
  41. return !$this->_switcherState2Checked($aRow['status_admin']);
  42. }
  43. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  44. {
  45. $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `author`=?", bx_get_logged_profile_id());
  46. return $this->__getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  47. }
  48. protected function __getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  49. {
  50. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  51. }
  52. }
  53. /** @} */