BxResourcesGridAdministration.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 Resources Resources
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxResourcesGridAdministration extends BxBaseModTextGridAdministration
  12. {
  13. protected $_sFilter3Name;
  14. protected $_sFilter3Value;
  15. protected $_aFilter3Values;
  16. public function __construct ($aOptions, $oTemplate = false)
  17. {
  18. $this->MODULE = 'bx_resources';
  19. parent::__construct ($aOptions, $oTemplate);
  20. $this->_initFilter(3, $this->_oModule->getContexts());
  21. }
  22. protected function _getCellContextModule($mixedValue, $sKey, $aField, $aRow)
  23. {
  24. return parent::_getCellDefault($this->_oModule->getModuleTitle($mixedValue), $sKey, $aField, $aRow);
  25. }
  26. protected function _getFilterControls()
  27. {
  28. $sContent = $this->_getFilterSelectOne($this->_sFilter3Name, $this->_sFilter3Value, $this->_aFilter3Values);
  29. return $sContent . parent::_getFilterControls();
  30. }
  31. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  32. {
  33. $this->_parseFilterValue($sFilter);
  34. if(!empty($this->_sFilter3Value))
  35. $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `tp`.`type`=?", $this->_sFilter3Value);
  36. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  37. }
  38. }
  39. /** @} */