BxDolStudioFormsLabels.php 1.3 KB

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