| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php defined('BX_DOL') or die('hack attempt');
- /**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup Stream Stream
- * @ingroup UnaModules
- *
- * @{
- */
- /**
- * Create/Edit entry form
- */
- class BxStrmFormEntry extends BxBaseModTextFormEntry
- {
- protected $_sGhostTemplateCover = 'form_ghost_template_cover.html';
-
- public function __construct($aInfo, $oTemplate = false)
- {
- $this->MODULE = 'bx_stream';
- parent::__construct($aInfo, $oTemplate);
- $CNF = &$this->_oModule->_oConfig->CNF;
- if(isset($CNF['FIELD_COVER']) && isset($this->aInputs[$CNF['FIELD_COVER']])) {
- if($this->_oModule->checkAllowedSetThumb() === CHECK_ACTION_RESULT_ALLOWED) {
- $this->aInputs[$CNF['FIELD_COVER']]['storage_object'] = $CNF['OBJECT_STORAGE'];
- $this->aInputs[$CNF['FIELD_COVER']]['uploaders'] = !empty($this->aInputs[$CNF['FIELD_COVER']]['value']) ? unserialize($this->aInputs[$CNF['FIELD_COVER']]['value']) : $CNF['OBJECT_UPLOADERS'];
- $this->aInputs[$CNF['FIELD_COVER']]['upload_buttons_titles'] = array(
- 'Simple' => _t('_bx_stream_form_entry_input_covers_uploader_simple_title'),
- 'HTML5' => _t('_bx_stream_form_entry_input_covers_uploader_html5_title')
- );
- $this->aInputs[$CNF['FIELD_COVER']]['images_transcoder'] = $CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW'];
- $this->aInputs[$CNF['FIELD_COVER']]['storage_private'] = 0;
- $this->aInputs[$CNF['FIELD_COVER']]['multiple'] = false;
- $this->aInputs[$CNF['FIELD_COVER']]['content_id'] = 0;
- $this->aInputs[$CNF['FIELD_COVER']]['ghost_template'] = '';
- }
- else
- unset($this->aInputs[$CNF['FIELD_COVER']]);
- }
- }
- public function insert ($aValsToAdd = [], $isIgnore = false)
- {
- $CNF = &$this->_oModule->_oConfig->CNF;
- return parent::insert(array_merge($aValsToAdd, [
- $CNF['FIELD_STATUS'] => 'awaiting', // streams are always in 'awaiting' status inless stream is live
- $CNF['FIELD_KEY'] => genRndPwd(12, false)
- ]), $isIgnore);
- }
- }
- /** @} */
|