BxBaseCmtsForm.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 TridentCore Trident Core
  7. * @{
  8. */
  9. class BxBaseCmtsForm extends BxTemplFormView
  10. {
  11. protected $_sStorageObject;
  12. protected $_sTranscoderPreview;
  13. protected $_aImageUploaders;
  14. public function __construct($aInfo, $oTemplate)
  15. {
  16. parent::__construct($aInfo, $oTemplate);
  17. $this->_sStorageObject = 'sys_cmts_images';
  18. $this->_sTranscoderPreview = 'sys_cmts_images_preview';
  19. $this->_aImageUploaders = array('sys_cmts_simple');
  20. if(isset($this->aInputs['cmt_image'])) {
  21. $aFormNested = array(
  22. 'params' =>array(
  23. 'nested_form_template' => 'comments_uploader_nfw.html'
  24. ),
  25. 'inputs' => array(),
  26. );
  27. $oFormNested = new BxDolFormNested('cmt_image', $aFormNested, 'cmt_submit');
  28. $this->aInputs['cmt_image']['storage_object'] = $this->_sStorageObject;
  29. $this->aInputs['cmt_image']['images_transcoder'] = $this->_sTranscoderPreview;
  30. $this->aInputs['cmt_image']['uploaders'] = !empty($this->aInputs['cmt_image']['value']) ? unserialize($this->aInputs['cmt_image']['value']) : $this->_aImageUploaders;
  31. $this->aInputs['cmt_image']['upload_buttons_titles'] = array('Simple' => 'camera');
  32. $this->aInputs['cmt_image']['multiple'] = true;
  33. $this->aInputs['cmt_image']['ghost_template'] = $oFormNested;
  34. }
  35. }
  36. public function getStorageObjectName()
  37. {
  38. return $this->_sStorageObject;
  39. }
  40. public function getTranscoderPreviewName()
  41. {
  42. return $this->_sTranscoderPreview;
  43. }
  44. }
  45. /** @} */