BxBaseUploaderSimple.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. protected $_sUploaderFormTemplate = 'uploader_form_simple.html';
  17. function __construct ($aObject, $sStorageObject, $sUniqId, $oTemplate)
  18. {
  19. parent::__construct($aObject, $sStorageObject, $sUniqId, $oTemplate);
  20. $this->_sIframeId = 'bx-form-input-files-' . $sUniqId . '-iframe';
  21. $this->_sButtonTemplate = 'uploader_button_simple.html';
  22. }
  23. /**
  24. * Get uploader button title
  25. */
  26. public function getUploaderButtonTitle($mixed = false)
  27. {
  28. if (is_string($mixed))
  29. return $mixed;
  30. elseif (is_array($mixed) && isset($mixed['Simple']))
  31. return $mixed['Simple'];
  32. else
  33. return _t('_sys_uploader_simple_button_name');
  34. }
  35. /**
  36. * Show uploader form.
  37. * @return HTML string
  38. */
  39. public function getUploaderForm($isMultiple = true, $iContentId = false, $isPrivate = true)
  40. {
  41. return $this->_oTemplate->parseHtmlByName($this->_sUploaderFormTemplate, array(
  42. 'form_container_id' => $this->_sFormContainerId,
  43. 'errors_container_id' => $this->_sErrorsContainerId,
  44. 'uploader_instance_name' => $this->getNameJsInstanceUploader(),
  45. 'restrictions_text' => $this->getRestrictionsText(),
  46. 'iframe_id' => $this->_sIframeId,
  47. 'engine' => $this->_aObject['object'],
  48. 'storage_object' => $this->_sStorageObject,
  49. 'uniq_id' => $this->_sUniqId,
  50. 'multiple' => $isMultiple,
  51. 'content_id' => $iContentId,
  52. 'storage_private' => $isPrivate,
  53. ));
  54. }
  55. }
  56. /** @} */