BxBaseUploaderSimple.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 DolphinCore Dolphin Core
  7. * @{
  8. */
  9. bx_import ('BxDolUploader');
  10. /**
  11. * Upload files using standard HTML forms.
  12. * @see BxDolUploader
  13. */
  14. class BxBaseUploaderSimple extends BxDolUploader
  15. {
  16. protected $_sIframeId;
  17. function __construct ($aObject, $sStorageObject, $sUniqId)
  18. {
  19. parent::__construct($aObject, $sStorageObject, $sUniqId);
  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)
  40. {
  41. parent::getUploaderForm($isMultiple, $iContentId);
  42. $sForm = $this->_oTemplate->parseHtmlByName('uploader_form_simple.html', 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. ));
  54. bx_import('BxTemplFunctions');
  55. return BxTemplFunctions::getInstance()->transBox('', $sForm);
  56. }
  57. }
  58. /** @} */