BxBaseUploaderSimple.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup TridentCore Trident Core
  7. * @{
  8. */
  9. /**
  10. * Upload files using standard HTML forms.
  11. * @see BxDolUploader
  12. */
  13. class BxBaseUploaderSimple extends BxDolUploader
  14. {
  15. protected $_sIframeId;
  16. function __construct ($aObject, $sStorageObject, $sUniqId, $oTemplate)
  17. {
  18. parent::__construct($aObject, $sStorageObject, $sUniqId, $oTemplate);
  19. $this->_sIframeId = 'bx-form-input-files-' . $sUniqId . '-iframe';
  20. $this->_sButtonTemplate = 'uploader_button_simple.html';
  21. }
  22. /**
  23. * Get uploader button title
  24. */
  25. public function getUploaderButtonTitle($mixed = false)
  26. {
  27. if (is_string($mixed))
  28. return $mixed;
  29. elseif (is_array($mixed) && isset($mixed['Simple']))
  30. return $mixed['Simple'];
  31. else
  32. return _t('_sys_uploader_simple_button_name');
  33. }
  34. /**
  35. * Show uploader form.
  36. * @return HTML string
  37. */
  38. public function getUploaderForm($isMultiple = true, $iContentId = false, $isPrivate = true)
  39. {
  40. return $this->_oTemplate->parseHtmlByName('uploader_form_simple.html', array(
  41. 'form_container_id' => $this->_sFormContainerId,
  42. 'errors_container_id' => $this->_sErrorsContainerId,
  43. 'uploader_instance_name' => $this->getNameJsInstanceUploader(),
  44. 'restrictions_text' => $this->getRestrictionsText(),
  45. 'iframe_id' => $this->_sIframeId,
  46. 'engine' => $this->_aObject['object'],
  47. 'storage_object' => $this->_sStorageObject,
  48. 'uniq_id' => $this->_sUniqId,
  49. 'multiple' => $isMultiple,
  50. 'content_id' => $iContentId,
  51. 'storage_private' => $isPrivate,
  52. ));
  53. }
  54. }
  55. /** @} */