BxDolStudioFormsPreLists.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  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 DolphinStudio Dolphin Studio
  7. * @{
  8. */
  9. defined('BX_DOL') or die('hack attempt');
  10. bx_import('BxTemplStudioGrid');
  11. bx_import('BxDolStudioTemplate');
  12. bx_import('BxDolStudioFormsQuery');
  13. class BxDolStudioFormsPreLists extends BxTemplStudioGrid {
  14. public function __construct ($aOptions, $oTemplate = false) {
  15. parent::__construct ($aOptions, $oTemplate);
  16. $this->oDb = new BxDolStudioFormsQuery();
  17. }
  18. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage) {
  19. $sModule = '';
  20. if(strpos($sFilter, $this->sParamsDivider) !== false)
  21. list($sModule, $sFilter) = explode($this->sParamsDivider, $sFilter);
  22. if($sModule != '')
  23. $this->_aOptions['source'] .= $this->oDb->prepare(" AND `module`=?", $sModule);
  24. $aResults = parent::_getDataSql($sFilter, !empty($sOrderField) ? $sOrderField : 'title', $sOrderDir, $iStart, $iPerPage);
  25. $aLists = array();
  26. $this->oDb->getLists(array('type' => 'pairs_list_values'), $aLists, false);
  27. foreach($aResults as $iKey => $aResult)
  28. if(isset($aLists[$aResult['key']]))
  29. $aResults[$iKey]['values_count'] = (int)$aLists[$aResult['key']];
  30. return $aResults;
  31. }
  32. }
  33. /** @} */