1
0

BxBaseModTextGridCommon.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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->_sStatusField = $CNF['FIELD_STATUS'];
  18. $this->_aStatusValues = array('active', 'hidden');
  19. if($this->_oModule->_oConfig->isAutoApprove() && isset($this->_aFilter1Values[BX_BASE_MOD_GENERAL_STATUS_PENDING]))
  20. unset($this->_aFilter1Values[BX_BASE_MOD_GENERAL_STATUS_PENDING]);
  21. $this->_sManageType = BX_DOL_MANAGE_TOOLS_COMMON;
  22. }
  23. protected function _getCellSwitcher ($mixedValue, $sKey, $aField, $aRow)
  24. {
  25. if(!$this->_switcherState2Checked($aRow['status_admin']))
  26. return parent::_getCellDefault('', $sKey, $aField, $aRow);
  27. return parent::_getCellSwitcher ($mixedValue, $sKey, $aField, $aRow);
  28. }
  29. protected function _getCellStatusAdmin($mixedValue, $sKey, $aField, $aRow)
  30. {
  31. $CNF = &$this->_oModule->_oConfig->CNF;
  32. if(!empty($CNF['T']['filter_item_' . $mixedValue]))
  33. $mixedValue = $CNF['T']['filter_item_' . $mixedValue];
  34. else
  35. $mixedValue = '_undefined';
  36. return parent::_getCellDefault(_t($mixedValue), $sKey, $aField, $aRow);
  37. }
  38. protected function _isRowDisabled($aRow)
  39. {
  40. if(parent::_isRowDisabled($aRow))
  41. return true;
  42. return !$this->_switcherState2Checked($aRow['status_admin']);
  43. }
  44. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  45. {
  46. $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `author`=?", bx_get_logged_profile_id());
  47. return $this->__getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  48. }
  49. protected function __getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  50. {
  51. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  52. }
  53. }
  54. /** @} */