Beispiel #1
0
 function blockFiles(&$aData)
 {
     $iEntryId = $aData['id'];
     $aReadyMedia = array();
     if ($iEntryId) {
         $aReadyMedia = $GLOBALS['oBxStoreModule']->_oDb->getFiles($iEntryId, true);
     }
     if (!$aReadyMedia) {
         return '';
     }
     $aVars = array('bx_repeat:files' => array());
     $sCurrencySign = getParam('pmt_default_currency_sign');
     foreach ($aReadyMedia as $r) {
         $iMediaId = $r['media_id'];
         $a = BxDolService::call('files', 'get_file_array', array($iMediaId), 'Search');
         if (!$a['date']) {
             continue;
         }
         bx_import('BxTemplFormView');
         $oForm = new BxTemplFormView(array());
         $aInputBtnDownload = array('type' => 'submit', 'name' => 'bx_store_download', 'value' => _t('_bx_store_download'), 'attrs' => array('onclick' => "window.open ('" . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . "download/{$r['id']}','_self');"));
         $aVars['bx_repeat:files'][] = array('id' => $iMediaId, 'title' => $a['title'], 'icon' => $a['file'], 'price' => $sCurrencySign . ' ' . $r['price'], 'for_group' => sprintf(_t('_bx_store_for_group'), $GLOBALS['oBxStoreModule']->getGroupName($r['allow_purchase_to'])), 'date' => defineTimeInterval($a['date']), 'bx_if:purchase' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedPurchase($r), 'content' => array('btn_purchase' => BxDolService::call('payment', 'get_add_to_cart_link', array($r['author_id'], $this->_oConfig->getId(), $r['id'], 1)))), 'bx_if:download' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedDownload($r), 'content' => array('btn_download' => $oForm->genInputButton($aInputBtnDownload))));
     }
     if (!$aVars['bx_repeat:files']) {
         return '';
     }
     return $this->parseHtmlByName('block_files', $aVars);
 }
Beispiel #2
0
 function _blockFiles($aReadyMedia, $iAuthorId = 0)
 {
     if (!$aReadyMedia) {
         return '';
     }
     $aVars = array('bx_repeat:files' => array());
     foreach ($aReadyMedia as $iMediaId) {
         $a = BxDolService::call('files', 'get_file_array', array($iMediaId), 'Search');
         if (!$a['date']) {
             continue;
         }
         bx_import('BxTemplFormView');
         $oForm = new BxTemplFormView(array());
         $aInputBtnDownload = array('type' => 'submit', 'name' => 'download', 'value' => _t('_download'), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => "window.open ('" . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . "download/" . $this->aDataEntry[$this->_oDb->_sFieldId] . "/{$iMediaId}','_self');"));
         $aVars['bx_repeat:files'][] = array('id' => $iMediaId, 'title' => $a['title'], 'icon' => $a['file'], 'date' => defineTimeInterval($a['date']), 'btn_download' => $oForm->genInputButton($aInputBtnDownload));
     }
     if (!$aVars['bx_repeat:files']) {
         return '';
     }
     return $this->_oTemplate->parseHtmlByName('entry_view_block_files', $aVars);
 }