BxDolStudioFormsPreValues.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. protected $aIconTypes;
  16. public function __construct ($aOptions, $oTemplate = false)
  17. {
  18. parent::__construct ($aOptions, $oTemplate);
  19. $this->oDb = new BxDolStudioFormsQuery();
  20. $sModule = bx_get('module');
  21. if(!empty($sModule)) {
  22. $this->sModule = bx_process_input($sModule);
  23. $this->_aQueryAppend['module'] = $this->sModule;
  24. }
  25. $sList = bx_get('list');
  26. if(!empty($sList)) {
  27. $this->sList = bx_process_input($sList);
  28. $this->_aQueryAppend['list'] = $this->sList;
  29. $this->aList = array();
  30. $this->oDb->getLists(array('type' => 'by_key', 'value' => $this->sList), $this->aList, false);
  31. }
  32. $this->aIconTypes = ['icon', 'emoji', 'image'];
  33. }
  34. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  35. {
  36. if(empty($this->sList))
  37. return array();
  38. $this->_aOptions['source'] .= $this->oDb->prepareAsString(" AND `Key`=? ", $this->sList);
  39. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  40. }
  41. }
  42. /** @} */