BxDolStudioFormsPreValues.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. define('BX_DOL_STUDIO_FIELD_PRE_VALUE_INT_MAX', round(log(BX_DOL_INT_MAX, 2)));
  10. class BxDolStudioFormsPreValues extends BxTemplStudioGrid
  11. {
  12. protected $sModule;
  13. protected $sList;
  14. protected $aList;
  15. public function __construct ($aOptions, $oTemplate = false)
  16. {
  17. parent::__construct ($aOptions, $oTemplate);
  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. $sList = bx_get('list');
  25. if(!empty($sList)) {
  26. $this->sList = bx_process_input($sList);
  27. $this->_aQueryAppend['list'] = $this->sList;
  28. $this->aList = array();
  29. $this->oDb->getLists(array('type' => 'by_key', 'value' => $this->sList), $this->aList, false);
  30. }
  31. }
  32. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  33. {
  34. if(empty($this->sList))
  35. return array();
  36. $this->_aOptions['source'] .= $this->oDb->prepareAsString(" AND `Key`=? ", $this->sList);
  37. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  38. }
  39. }
  40. /** @} */