BxCreditsGridOrdersAdministration.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 Credits Credits
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. require_once('BxCreditsGrid.php');
  12. class BxCreditsGridOrdersAdministration extends BxCreditsGrid
  13. {
  14. public function __construct ($aOptions, $oTemplate = false)
  15. {
  16. parent::__construct ($aOptions, $oTemplate);
  17. $this->_sDefaultSortingOrder = 'DESC';
  18. $this->_aQueryReset = array($this->_aOptions['order_get_field'], $this->_aOptions['order_get_dir'], $this->_aOptions['paginate_get_start'], $this->_aOptions['paginate_get_per_page']);
  19. }
  20. protected function _getCellProfileId($mixedValue, $sKey, $aField, $aRow)
  21. {
  22. return parent::_getCellDefault($this->_getProfile($mixedValue), $sKey, $aField, $aRow);
  23. }
  24. protected function _getCellBundle($mixedValue, $sKey, $aField, $aRow)
  25. {
  26. if(!$this->_bIsApi)
  27. $mixedValue = $this->_oTemplate->parseHtmlByName('bundle_link.html', [
  28. 'href' => $this->_oModule->_oConfig->getBundleUrl(['id' => $aRow['bundle_id']]),
  29. 'title' => bx_html_attribute($mixedValue),
  30. 'content' => $mixedValue
  31. ]);
  32. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  33. }
  34. protected function _getCellType($mixedValue, $sKey, $aField, $aRow)
  35. {
  36. return parent::_getCellDefault(_t('_bx_credits_grid_column_value_ord_type_' . $mixedValue), $sKey, $aField, $aRow);
  37. }
  38. protected function _getCellAdded($mixedValue, $sKey, $aField, $aRow)
  39. {
  40. return parent::_getCellDefault(bx_time_js($mixedValue, BX_FORMAT_DATE, true), $sKey, $aField, $aRow);
  41. }
  42. protected function _getCellExpired($mixedValue, $sKey, $aField, $aRow)
  43. {
  44. $mixedValue = (int)$mixedValue != 0 ? bx_time_js($mixedValue, BX_FORMAT_DATE, true): _t('_bx_credits_txt_never');
  45. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  46. }
  47. protected function _getProfile($mixedValue)
  48. {
  49. $oProfile = BxDolProfile::getInstanceMagic($mixedValue);
  50. if(!$oProfile)
  51. return $mixedValue;
  52. return $oProfile->getUnit(0, ['template' => ['name' => 'unit', 'size' => 'icon']]);
  53. }
  54. }
  55. /** @} */