BxBaseUploaderSimple.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * @package Dolphin Core
  4. * @copyright Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  5. * @license CC-BY - http://creativecommons.org/licenses/by/3.0/
  6. */
  7. defined('BX_DOL') or die('hack attempt');
  8. bx_import ('BxDolUploader');
  9. /**
  10. * Upload files using standard HTML forms.
  11. * @see BxDolUploader
  12. */
  13. class BxBaseUploaderSimple extends BxDolUploader {
  14. var $_sIframeId;
  15. function BxBaseUploaderSimple ($aObject, $sStorageObject, $sUniqId) {
  16. parent::BxDolUploader($aObject, $sStorageObject, $sUniqId);
  17. $this->_sIframeId = 'bx-form-input-files-' . $sUniqId . '-iframe';
  18. $this->_sButtonTemplate = 'uploader_button_simple.html';
  19. }
  20. /**
  21. * Get uploader button title
  22. */
  23. public function getUploaderButtonTitle($mixed = false) {
  24. if (is_string($mixed))
  25. return $mixed;
  26. elseif (is_array($mixed) && isset($mixed['Simple']))
  27. return $mixed['Simple'];
  28. else
  29. return _t('_sys_uploader_simple_button_name');
  30. }
  31. /**
  32. * Show uploader form.
  33. * @return HTML string
  34. */
  35. public function getUploaderForm($isMultiple = true, $iContentId = false) {
  36. parent::getUploaderForm($isMultiple, $iContentId);
  37. $oTemplate = BxDolTemplate::getInstance();
  38. $sForm = $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['engine'],
  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. }