BxBaseUploaderSimple.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * Upload files using standard HTML forms.
  11. * @see BxDolUploader
  12. */
  13. class BxBaseUploaderSimple extends BxDolUploader
  14. {
  15. protected $_sIframeId;
  16. public 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. $this->_sJsTemplate = 'uploader_button_simple_js.html';
  22. $this->_sUploaderFormTemplate = 'uploader_form_simple.html';
  23. }
  24. /**
  25. * Get uploader button title
  26. */
  27. public function getUploaderButtonTitle($mixed = false)
  28. {
  29. if (is_string($mixed))
  30. return $mixed;
  31. elseif (is_array($mixed) && isset($mixed['Simple']))
  32. return $mixed['Simple'];
  33. else
  34. return _t('_sys_uploader_simple_button_name');
  35. }
  36. /**
  37. * Show uploader form.
  38. * @return HTML string
  39. */
  40. public function getUploaderForm($isMultiple = true, $iContentId = false, $isPrivate = true)
  41. {
  42. return $this->_oTemplate->parseHtmlByName($this->_sUploaderFormTemplate, array(
  43. 'form_container_id' => $this->_sFormContainerId,
  44. 'errors_container_id' => $this->_sErrorsContainerId,
  45. 'uploader_instance_name' => $this->getNameJsInstanceUploader(),
  46. 'restrictions_text' => $this->getRestrictionsText(),
  47. 'iframe_id' => $this->_sIframeId,
  48. 'engine' => $this->_aObject['object'],
  49. 'storage_object' => $this->_sStorageObject,
  50. 'uniq_id' => $this->_sUniqId,
  51. 'multiple' => $isMultiple,
  52. 'content_id' => $iContentId,
  53. 'storage_private' => $isPrivate,
  54. ));
  55. }
  56. }
  57. /** @} */