Skip to content

Commit

Permalink
Ticket #4817 - Courses improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Oct 25, 2024
1 parent 4cc2ba9 commit 80d4f85
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
18 changes: 16 additions & 2 deletions modules/base/files/classes/BxBaseModFilesModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,26 @@ public function serviceGetFile ($iContentId, $aParams = [])
if(empty($aContentInfo) || !is_array($aContentInfo))
return false;

$sStorage = !empty($aParams['storage']) ? $aParams['storage'] : $CNF['OBJECT_STORAGE'];
$sStorage = '';
if(!empty($aParams['storage']))
$sStorage = $aParams['storage'];
else if(!empty($CNF['OBJECT_STORAGE']))
$sStorage = $CNF['OBJECT_STORAGE'];
else
return false;

$oStorage = BxDolStorage::getObjectInstance($sStorage);
if(!$oStorage)
return false;

$sFieldFileId = !empty($aParams['field']) ? $aParams['field'] : $CNF['FIELD_FILE_ID'];
$sFieldFileId = '';
if(!empty($aParams['field']))
$sFieldFileId = $aParams['field'];
else if(!empty($CNF['FIELD_FILE_ID']))
$sFieldFileId = $CNF['FIELD_FILE_ID'];
else
return false;

return $oStorage->getFile($aContentInfo[$sFieldFileId]);
}
}
Expand Down
8 changes: 4 additions & 4 deletions modules/boonex/courses/classes/BxCoursesTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ protected function _entryNodeItems($iProfileId, $iContentId, $aNode, $iUsage)
if(!empty($aFileInfo) && is_array($aFileInfo)) {
$aTmplVarsShowSize['size'] = _t_format_size($aFileInfo['size']);

$bTmplVarsShowDownload = !empty($aFileInfo['url_download']);
$aTmplVarsShowDownload = [
'link' => $aFileInfo['url_download']
];
if(($bTmplVarsShowDownload = !empty($aFileInfo['url_download'])))
$aTmplVarsShowDownload = [
'link' => $aFileInfo['url_download']
];
}
}

Expand Down
12 changes: 12 additions & 0 deletions modules/boonex/videos/classes/BxVideosModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ public function serviceGetVideo ($iContentId)
return $this->getVideoData($aContentInfo);
}

public function serviceGetFile ($iContentId, $aParams = [])
{
$CNF = &$this->_oConfig->CNF;

if(!isset($aParams['storage']))
$aParams['storage'] = $CNF['OBJECT_STORAGE_VIDEOS'];
if(!isset($aParams['field']))
$aParams['field'] = $CNF['FIELD_VIDEO'];

return parent::serviceGetFile($iContentId, $aParams);
}

public function getVideoData($aContentInfo)
{
$CNF = &$this->_oConfig->CNF;
Expand Down

0 comments on commit 80d4f85

Please sign in to comment.