BxDolStudioFormsCategories.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 BxDolStudioFormsCategories extends BxTemplStudioGrid
  10. {
  11. protected $sModule;
  12. protected $_oCategory;
  13. public function __construct ($aOptions, $oTemplate = false)
  14. {
  15. parent::__construct ($aOptions, $oTemplate);
  16. $this->_sDefaultSortingOrder = 'DESC';
  17. $this->_oCategory = BxDolCategories::getInstance();
  18. $this->oDb = new BxDolStudioFormsQuery();
  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. /** @} */