BxMarketUploaderHTML5.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 Market Market
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxMarketUploaderHTML5 extends BxTemplUploaderHTML5
  12. {
  13. protected $_oModule;
  14. public function __construct ($aObject, $sStorageObject, $sUniqId, $oTemplate)
  15. {
  16. parent::__construct($aObject, $sStorageObject, $sUniqId, $oTemplate);
  17. $this->_oModule = BxDolModule::getInstance('bx_market');
  18. }
  19. public function getGhostsWithOrder($iProfileId, $sFormat, $sImagesTranscoder = false, $iContentId = false, $isLatestOnly = false)
  20. {
  21. $CNF = &$this->_oModule->_oConfig->CNF;
  22. $a = $this->getGhosts($iProfileId, 'array', $sImagesTranscoder, $iContentId);
  23. if(!$isLatestOnly) {
  24. if($iContentId && ($aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId))) {
  25. if(!empty($aContentInfo[$CNF['FIELD_THUMB']]))
  26. unset($a[$aContentInfo[$CNF['FIELD_THUMB']]]);
  27. if(!empty($aContentInfo[$CNF['FIELD_COVER']]))
  28. unset($a[$aContentInfo[$CNF['FIELD_COVER']]]);
  29. }
  30. }
  31. else
  32. $a = array_slice($a, 0, 1, true);
  33. if(!empty($a) && is_array($a))
  34. $a = ['g' => $a, 'o' => array_keys($a)];
  35. return $sFormat == 'json' ? json_encode($a) : $a;
  36. }
  37. protected function getGhostTemplateVars($aFile, $iProfileId, $iContentId, $oStorage, $oImagesTranscoder)
  38. {
  39. return $this->_oModule->getGhostTemplateVars($aFile, $iProfileId, $iContentId, $oStorage, $oImagesTranscoder);
  40. }
  41. }
  42. /** @} */