1
0

BxDolStudioFormsLabels.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 BxDolStudioFormsLabels extends BxTemplStudioGrid
  10. {
  11. protected $_oLabel;
  12. protected $_iParent;
  13. protected $_aParent;
  14. public function __construct ($aOptions, $oTemplate = false)
  15. {
  16. parent::__construct ($aOptions, $oTemplate);
  17. $this->oDb = new BxDolStudioFormsQuery();
  18. $this->_oLabel = BxDolLabel::getInstance();
  19. $this->_iParent = bx_get('parent') !== false ? (int)bx_get('parent') : 0;
  20. $this->_aQueryAppend['parent'] = $this->_iParent;
  21. $this->_aParent = array();
  22. if(!empty($this->_iParent))
  23. $this->_aParent = $this->_oLabel->getLabels(array('type' => 'id', 'id' => $this->_iParent));
  24. }
  25. protected function _delete ($mixedId)
  26. {
  27. $this->_oLabel->onDelete($mixedId);
  28. return parent::_delete($mixedId);
  29. }
  30. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  31. {
  32. $this->_aOptions['source'] .= $this->oDb->prepareAsString(" AND `parent`=?", $this->_iParent);
  33. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  34. }
  35. }
  36. /** @} */