BxBaseCmtsForm.php 1.7 KB

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