BxEditorGridToolbar.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 Editor integration
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxEditorGridToolbar extends BxTemplGrid
  12. {
  13. protected $_sModule;
  14. protected $_oModule;
  15. protected $_sMode;
  16. public function __construct ($aOptions, $oTemplate = false)
  17. {
  18. parent::__construct ($aOptions, $oTemplate);
  19. $this->_sModule = 'bx_editor';
  20. $this->_oModule = BxDolModule::getInstance($this->_sModule);
  21. $this->_sMode = bx_get('page') !== false && bx_get('page') !== 'settings' ? bx_get('page') : 'mini';
  22. $this->_aQueryAppend['mode'] = $this->_sMode;
  23. }
  24. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  25. {
  26. $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `mode` = ? ", $this->_sMode);
  27. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  28. }
  29. protected function _getCellName ($mixedValue, $sKey, $aField, $aRow)
  30. {
  31. $sName = isset($this->_oModule->_aButtons[$mixedValue]) ? _t($this->_oModule->_aButtons[$mixedValue]['text']) : '';
  32. return parent::_getCellDefault($sName, $sKey, $aField, $aRow);
  33. }
  34. }
  35. /** @} */