BxRibbonsGrid.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 Ribbons Ribbons
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxRibbonsGrid extends BxTemplGrid
  12. {
  13. protected $MODULE;
  14. protected $_oModule;
  15. public function __construct ($aOptions, $oTemplate = false)
  16. {
  17. $this->MODULE = 'bx_ribbons';
  18. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  19. parent::__construct ($aOptions, $oTemplate);
  20. }
  21. protected function _getCellText($mixedValue, $sKey, $aField, $aRow)
  22. {
  23. $mixedValue = strip_tags(htmlspecialchars_decode($mixedValue));
  24. return parent::_getCellDefault ($mixedValue, $sKey, $aField, $aRow);
  25. }
  26. protected function _getActionAdd ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
  27. {
  28. $CNF = &$this->_oModule->_oConfig->CNF;
  29. $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_ADD_ENTRY']);
  30. unset($a['attr']['bx_grid_action_independent']);
  31. $a['attr'] = array_merge($a['attr'], array(
  32. "onclick" => "window.open('" . $sUrl . "','_self');"
  33. ));
  34. return parent::_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
  35. }
  36. protected function _getActionEdit ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
  37. {
  38. if(isset($aRow["date_sent"]) && $aRow["date_sent"] != '0')
  39. return '';
  40. $CNF = &$this->_oModule->_oConfig->CNF;
  41. $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_EDIT_ENTRY'] . '&id=' . $aRow[$CNF['FIELD_ID']]);
  42. $a['attr'] = array_merge($a['attr'], array(
  43. "onclick" => "window.open('" . $sUrl . "','_self');"
  44. ));
  45. return $this->_getActionDefault ($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
  46. }
  47. }
  48. /** @} */