BxBaseUploaderSimple.php 2.0 KB

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