1
0

BxBaseModGeneralConfig.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 BaseGeneral Base classes for modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModGeneralConfig extends BxDolModuleConfig
  12. {
  13. public $CNF;
  14. protected $_aObjects;
  15. protected $_aPrefixes;
  16. protected $_aJsClasses;
  17. protected $_aJsObjects;
  18. protected $_aGridObjects;
  19. function __construct($aModule)
  20. {
  21. parent::__construct($aModule);
  22. $this->CNF = array();
  23. $this->_aObjects = array();
  24. $this->_aPrefixes = array();
  25. $this->_aJsClasses = array();
  26. $this->_aJsObjects = array();
  27. $this->_aGridObjects = array();
  28. }
  29. public function getObject($sType = '')
  30. {
  31. if(empty($sType))
  32. return $this->_aObjects;
  33. return isset($this->_aObjects[$sType]) ? $this->_aObjects[$sType] : '';
  34. }
  35. public function getPrefix($sType = '')
  36. {
  37. if(empty($sType))
  38. return $this->_aPrefixes;
  39. return isset($this->_aPrefixes[$sType]) ? $this->_aPrefixes[$sType] : '';
  40. }
  41. public function getJsClass($sType)
  42. {
  43. return isset($this->_aJsClasses[$sType]) ? $this->_aJsClasses[$sType] : '';
  44. }
  45. public function getJsObject($sType)
  46. {
  47. return isset($this->_aJsObjects[$sType]) ? $this->_aJsObjects[$sType] : '';
  48. }
  49. public function getGridObject($sType)
  50. {
  51. return isset($this->_aGridObjects[$sType]) ? $this->_aGridObjects[$sType] : '';
  52. }
  53. /*
  54. * Note. The first Transcoder in the array $aTranscoders has the highest priority.
  55. */
  56. public function getImageUrl($iId, $aTranscoders)
  57. {
  58. $sResult = '';
  59. if(empty($iId) || empty($aTranscoders) || !is_array($aTranscoders))
  60. return $sResult;
  61. foreach($aTranscoders as $sTranscoder) {
  62. if(empty($this->CNF[$sTranscoder]))
  63. continue;
  64. $oTranscoder = BxDolTranscoderImage::getObjectInstance($this->CNF[$sTranscoder]);
  65. if(!$oTranscoder)
  66. continue;
  67. $sResult = $oTranscoder->getFileUrl($iId);
  68. if(!empty($sResult))
  69. break;
  70. }
  71. return $sResult;
  72. }
  73. }
  74. /** @} */