BxTimelineFormPost.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 Timeline Timeline
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxBaseModGeneralFormEntry');
  12. /**
  13. * Create/Edit entry form
  14. */
  15. class BxTimelineFormPost extends BxBaseModGeneralFormEntry
  16. {
  17. public function __construct($aInfo, $oTemplate = false)
  18. {
  19. $this->MODULE = 'bx_timeline';
  20. parent::__construct($aInfo, $oTemplate);
  21. $iUserId = $this->_oModule->getUserId();
  22. $iOwnerId = $this->_oModule->getOwnerId();
  23. $this->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'post/';
  24. $this->aInputs['owner_id']['value'] = $iOwnerId;
  25. if(isset($this->aInputs['link']))
  26. $this->aInputs['link']['content'] = $this->_oModule->_oTemplate->getAttachLinkField($iUserId);
  27. if(isset($this->aInputs['photo'])) {
  28. $aFormNested = array(
  29. 'params' =>array(
  30. 'nested_form_template' => 'uploader_nfw.html'
  31. ),
  32. 'inputs' => array(),
  33. );
  34. bx_import('BxDolFormNested');
  35. $oFormNested = new BxDolFormNested('photo', $aFormNested, 'do_submit', $this->_oModule->_oTemplate);
  36. $this->aInputs['photo']['storage_object'] = $this->_oModule->_oConfig->getObject('storage_photos');
  37. $this->aInputs['photo']['images_transcoder'] = $this->_oModule->_oConfig->getObject('transcoder_photos_preview');
  38. $this->aInputs['photo']['uploaders'] = $this->_oModule->_oConfig->getUploaders('photo');
  39. $this->aInputs['photo']['upload_buttons_titles'] = array('Simple' => 'camera');
  40. $this->aInputs['photo']['multiple'] = true;
  41. $this->aInputs['photo']['ghost_template'] = $oFormNested;
  42. }
  43. if(isset($this->aInputs['video'])) {
  44. $aFormNested = array(
  45. 'params' =>array(
  46. 'nested_form_template' => 'uploader_nfw.html'
  47. ),
  48. 'inputs' => array(),
  49. );
  50. bx_import('BxDolFormNested');
  51. $oFormNested = new BxDolFormNested('video', $aFormNested, 'do_submit', $this->_oModule->_oTemplate);
  52. $this->aInputs['video']['storage_object'] = $this->_oModule->_oConfig->getObject('storage_videos');
  53. $this->aInputs['video']['images_transcoder'] = $this->_oModule->_oConfig->getObject('transcoder_videos_poster');
  54. $this->aInputs['video']['uploaders'] = $this->_oModule->_oConfig->getUploaders('video');
  55. $this->aInputs['video']['upload_buttons_titles'] = array('Simple' => 'video-camera');
  56. $this->aInputs['video']['multiple'] = true;
  57. $this->aInputs['video']['ghost_template'] = $oFormNested;
  58. }
  59. if(isset($this->aInputs['attachments']))
  60. $this->aInputs['attachments']['content'] = '__attachments_menu__';
  61. }
  62. public function getCode($bDynamicMode = false)
  63. {
  64. $sResult = parent::getCode($bDynamicMode);
  65. return $this->_oModule->_oTemplate->parseHtmlByContent($sResult, array(
  66. 'attachments_menu' => $this->_oModule->getAttachmentsMenuObject()->getCode()
  67. ));
  68. }
  69. }
  70. /** @} */