BxDolStudioBadgesGrid.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 UnaStudio UNA Studio
  7. * @{
  8. */
  9. class BxDolStudioBadgesGrid extends BxTemplStudioGrid
  10. {
  11. protected $sModule;
  12. protected $_oBadges;
  13. public function __construct ($aOptions, $oTemplate = false)
  14. {
  15. parent::__construct ($aOptions, $oTemplate);
  16. $this->oDb = new BxDolBadgesQuery();
  17. $this->_oBadges = BxDolBadges::getInstance();
  18. $this->_sDefaultSortingOrder = 'DESC';
  19. $sModule = bx_get('module');
  20. if(!empty($sModule)) {
  21. $this->sModule = bx_process_input($sModule);
  22. $this->_aQueryAppend['module'] = $this->sModule;
  23. }
  24. }
  25. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  26. {
  27. $sModule = $this->sModule;
  28. if(strpos($sFilter, $this->sParamsDivider) !== false)
  29. list($sModule, $sFilter) = explode($this->sParamsDivider, $sFilter);
  30. if($sModule != '')
  31. $this->_aOptions['source'] .= $this->oDb->prepareAsString(" AND `module` = ?", $sModule);
  32. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  33. }
  34. }
  35. /** @} */