BxDolStudioFormsPreLists.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup TridentStudio Trident Studio
  7. * @{
  8. */
  9. bx_import('BxTemplStudioGrid');
  10. bx_import('BxDolStudioTemplate');
  11. bx_import('BxDolStudioFormsQuery');
  12. class BxDolStudioFormsPreLists extends BxTemplStudioGrid
  13. {
  14. public function __construct ($aOptions, $oTemplate = false)
  15. {
  16. parent::__construct ($aOptions, $oTemplate);
  17. $this->oDb = new BxDolStudioFormsQuery();
  18. }
  19. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  20. {
  21. $sModule = '';
  22. if(strpos($sFilter, $this->sParamsDivider) !== false)
  23. list($sModule, $sFilter) = explode($this->sParamsDivider, $sFilter);
  24. if($sModule != '')
  25. $this->_aOptions['source'] .= $this->oDb->prepare(" AND `module`=?", $sModule);
  26. $aResults = parent::_getDataSql($sFilter, !empty($sOrderField) ? $sOrderField : 'title', $sOrderDir, $iStart, $iPerPage);
  27. $aLists = array();
  28. $this->oDb->getLists(array('type' => 'pairs_list_values'), $aLists, false);
  29. foreach($aResults as $iKey => $aResult)
  30. if(isset($aLists[$aResult['key']]))
  31. $aResults[$iKey]['values_count'] = (int)$aLists[$aResult['key']];
  32. return $aResults;
  33. }
  34. }
  35. /** @} */