Commit 65cf9643 authored by Dainis Abols's avatar Dainis Abols
Browse files

Fixed new file relation issues

v4.2.2
parent 003af661
......@@ -17,6 +17,7 @@ use Lu\LuNas\Sort;
//use TYPO3\CMS\Backend\View\BackendTemplateView;
use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Resource\FileRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
......@@ -295,12 +296,18 @@ class FrontController extends ActionController
// Get related
$related = $documentsModel->getRelated();
// Get document files
$fileLv = $this->getFileReferences($uid, 'filename_lv');
$fileEn = $this->getFileReferences($uid, 'filename_en');
// Assign data to view
$this->view->assign('document', $document);
$this->view->assign('self', $this->uriBuilder->setArguments(['tx_lunas_pi1[controller]' => 'Front'])->setAddQueryString(true)->build());
$this->view->assign('related', $related);
$this->view->assign('upload_folder', '/uploads/lu_nas/');
$this->view->assign('back_url', parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH));
$this->view->assign('file_lv', $fileLv);
$this->view->assign('file_en', $fileEn);
}
/**
......@@ -336,4 +343,19 @@ class FrontController extends ActionController
return '&moduleToken='.$token;
}
}
/**
* Get document file from UID
*
* @param $uid
*
* @return \TYPO3\CMS\Core\Resource\FileReference
*/
private function getFileReferences($uid, $tableField)
{
$personTable = GeneralUtility::makeInstance(Document::class)->getTableName();
$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
return $fileRepository->findByRelation($personTable, $tableField, $uid);
}
}
......@@ -54,18 +54,18 @@
</f:if>
<!-- LV File download -->
<f:if condition="{document.filename_lv}">
<f:if condition="{file_lv.0.originalFile.name}">
<tr>
<td></td>
<td><a target="_blank" href="{upload_folder}{document.filename_lv}"><f:translate key="form.download" /></a></td>
<td><a target="_blank" href="{upload_folder}{file_lv.0.originalFile.name}"><f:translate key="form.download" /></a></td>
</tr>
</f:if>
<!-- EN File download -->
<f:if condition="{document.filename_en}">
<f:if condition="{file_en.0.originalFile.name}">
<tr>
<td></td>
<td><a target="_blank" href="{upload_folder}{document.filename_en}"><f:translate key="form.download" /></a></td>
<td><a target="_blank" href="{upload_folder}{file_en.0.originalFile.name}"><f:translate key="form.download" /></a></td>
</tr>
</f:if>
......
{
"name": "luitd/lu-nas",
"version": "4.2.1",
"version": "4.2.2",
"description": "Latvijas Universitātes Normatīvo Aktu sistēmas TYPO3 spraudnis",
"type": "typo3-cms-extension",
"keywords": [
......
......@@ -9,7 +9,7 @@ $EM_CONF[$_EXTKEY] = [
'author_email' => 'dainis.abols@lu.lv',
'state' => 'stable',
'clearCacheOnLoad' => true,
'version' => '4.2.1',
'version' => '4.2.2',
'constraints' => [
'depends' => [
'typo3' => '9.5.0-10.9.99',
......
......@@ -4,7 +4,7 @@ TYPO3 Extension for Regulations (NAS)
## Version
4.2.1
4.2.2
## Dependecies
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment