Commit ba693ea8 authored by Dainis Abols's avatar Dainis Abols
Browse files

Tag and process update v4.4.0

Changelog:
- archived documents changed to status "Nav aktuāls"
- added tag to document view
- added tag to table list view
- added new field process
- added new field process to table list view
- removed outdated "Studiju ceļvedis" link
- added red "Archived" mark to document title in table list view
- renamed tags
- renamed archived checkbox

Update executables:
`UPDATE tx_lunas_domain_model_document SET process_id = 0 WHERE process_id IS NULL;`
parent f9950f51
......@@ -6,7 +6,9 @@ use Lu\LuApi\DataSources\SolrRegulations;
use Lu\LuNas\Domain\Model\Document;
use Lu\LuNas\Domain\Model\Issuer;
use Lu\LuNas\Domain\Model\OrderType;
use Lu\LuNas\Domain\Model\Process;
use Lu\LuNas\Domain\Model\Status;
use Lu\LuNas\Domain\Model\Tag;
use Lu\LuNas\Domain\Model\Type;
use Lu\LuNas\Domain\Repository\DocumentRepository;
use Lu\LuNas\Domain\Session\BackendSessionHandler;
......@@ -257,6 +259,8 @@ class FrontController extends ActionController
$typeModel = new Type();
$statusModel = new Status();
$issuerModel = new Issuer();
$processModel = new Process();
$tagModel = new Tag();
$documentsModel = new Document();
$orderTypeModel = new OrderType();
......@@ -296,6 +300,16 @@ class FrontController extends ActionController
$document['issuer'] = $issuer['title'];
}
// Get process name
if ($document['process_id']) {
$document['process'] = $processModel->getProcessById($document['process_id']);
}
// Get tags
if ($document['tags']) {
$document['tag_names'] = $tagModel->getTagNamesById($document['tags']);
}
// Get related
$related = $documentsModel->getRelated();
......
......@@ -234,6 +234,8 @@ class Document extends AbstractEntity
$orderTypesModel = new OrderType();
$typesModel = new Type();
$statusModel = new Status();
$processModel = new Process();
$tagModel = new Tag();
// Build the query
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName);
......@@ -281,6 +283,8 @@ class Document extends AbstractEntity
'order_name' => $orderTypesModel->getOrderTypeById($row['order_doc_id']),
'type_name' => $typesModel->getTypeById($row['document_type_id']),
'status_icon' => $statusModel->getStatusIcon($row['status_id']),
'process' => $processModel->getProcessById($row['process_id']),
'tag_names' => $tagModel->getTagNamesById($row['tags']),
] + $row;
}
......@@ -479,6 +483,7 @@ class Document extends AbstractEntity
$queryBuilder->expr()->lt('date_archived', strtotime(date("Y-m-d")))
)
->set('archived', 1)
->set('status_id', 3)
->execute();
return true;
......
<?php
namespace Lu\LuNas\Domain\Model;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
/**
* Class Process
*
* @author Dainis Abols <dainis.abols@lu.lv>
* @owner University of Latvia
* @since 01.11.2021
*
* @package Lu\LuNas\Domain\Model
*/
class Process extends AbstractEntity
{
/**
* Define table name
*
* @var string
*/
private $tableName = 'tx_lunas_domain_model_process';
/**
* The process names
*
* @var array
*/
private $process = [];
/**
* OrderType constructor.
*/
public function __construct()
{
$data = $this->loadAll();
$this->setProcess($data);
}
/**
* Get the table name
*
* @return string
*/
public function getTableName()
{
return $this->tableName;
}
/**
* Sets the process names
*
* @param $process
*/
public function setProcess($process)
{
$this->process = $process;
}
/**
* Gets the process
*/
public function getProcess(): array
{
return $this->process;
}
/**
* Retrieve process name by its ID
*
* @param $processId
*
* @return string
*/
public function getProcessById($processId): string
{
$result = isset($this->process[$processId]) ? $this->process[$processId] : '';
return (string)$result;
}
/**
* Loads and returns all order document processes
*
* @return array
*/
public function loadAll(): array
{
// Pre-set variables
$data = [];
// Build query
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName);
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder->select('*')->from($this->tableName);
// Read and load groups
$result = $queryBuilder->execute()->fetchAll();
foreach($result as $row) {
$data[$row['uid']] = $row['title'];
}
// Return the data array
return $data;
}
}
<?php
namespace Lu\LuNas\Domain\Model;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
/**
* Class Tag
*
* @author Dainis Abols <dainis.abols@lu.lv>
* @owner University of Latvia
* @since 01.11.2021
*
* @package Lu\LuNas\Domain\Model
*/
class Tag extends AbstractEntity
{
/**
* Define table name
*
* @var string
*/
private $tableName = 'tx_lunas_domain_model_tags';
/**
* The tag names
*
* @var array
*/
private $tag = [];
/**
* OrderType constructor.
*/
public function __construct()
{
$data = $this->loadAll();
$this->setTag($data);
}
/**
* Get the table name
*
* @return string
*/
public function getTableName()
{
return $this->tableName;
}
/**
* Sets the tag names
*
* @param $tag
*/
public function setTag($tag)
{
$this->tag = $tag;
}
/**
* Gets the tag
*/
public function getTag(): array
{
return $this->tag;
}
/**
* Retrieve tag name by its ID
*
* @param $tagIds
*
* @return array
*/
public function getTagNamesById($tagIds): array
{
$tags = explode(",", $tagIds);
$result = [];
foreach($tags as $tagId) {
$tagName = isset($this->tag[$tagId]) ? $this->tag[$tagId] : '';
if ($tagName && strlen($tagName) > 1) {
$result[] = trim($tagName);
}
}
return $result;
}
/**
* Loads and returns all order document tags
*
* @return array
*/
public function loadAll(): array
{
// Pre-set variables
$data = [];
// Build query
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName);
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder->select('*')->from($this->tableName);
// Read and load groups
$result = $queryBuilder->execute()->fetchAll();
foreach($result as $row) {
$data[$row['uid']] = $row['title'];
}
// Return the data array
return $data;
}
}
......@@ -67,7 +67,6 @@ return [
],
],
'archived' => [
'exclude' => true,
'l10n_mode' => 'mergeIfNotBlank',
......@@ -141,6 +140,20 @@ return [
],
],
'process_id' => [
'exclude' => true,
'label' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:document.process',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'minitems' => 0,
'maxitems' => 1,
'foreign_table' => 'tx_lunas_domain_model_process',
'foreign_table_where' => 'ORDER BY tx_lunas_domain_model_process.title ASC',
'items' => [['', '',]],
],
],
'filename_lv' => [
'exclude' => 1,
'label' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:document.filename_lv',
......@@ -251,7 +264,7 @@ return [
'showitem' => 'number, date_accepted, date_archived, archived',
],
'group-2' => [
'showitem' => 'order_doc_id, document_type_id, issuer_id, status_id',
'showitem' => 'order_doc_id, document_type_id, issuer_id, status_id, process_id',
],
'filenames' => [
'showitem' => 'filename_lv, filename_en',
......
<?php
return [
'ctrl' => [
'title' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:process.title',
'label' => 'title',
'typeicon_classes' => [
'default' => 'lunas-process',
],
'security' => [
'ignoreWebMountRestriction' => 1,
'ignoreRootLevelRestriction' => 1,
],
'rootLevel' => -1,
],
'columns' => [
'title' => [
'exclude' => true,
'label' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:process.title',
'config' => [
'type' => 'input',
'eval' => 'trim,required',
'size' => 16,
'default' => '',
],
],
],
'types' => [
'0' => ['showitem' => 'title'],
],
];
......@@ -5,7 +5,7 @@ return [
'title' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:tags.title',
'label' => 'title',
'typeicon_classes' => [
'default' => 'actions-tag',
'default' => 'lunas-tag',
],
'security' => [
'ignoreWebMountRestriction' => 1,
......
......@@ -29,6 +29,12 @@
<trans-unit id="document.document_ordertype">
<source><![CDATA[Rīkojuma dokumenta veids]]></source>
</trans-unit>
<trans-unit id="document.tag">
<source><![CDATA[Atslēgvārdi]]></source>
</trans-unit>
<trans-unit id="document.process">
<source><![CDATA[Process]]></source>
</trans-unit>
<trans-unit id="document.document_type">
<source><![CDATA[Dokumenta tips]]></source>
</trans-unit>
......@@ -42,7 +48,7 @@
<source><![CDATA[Dokumenta izdevējs]]></source>
</trans-unit>
<trans-unit id="document.name">
<source><![CDATA[LU NAS]]></source>
<source><![CDATA[NAS Dokuments]]></source>
</trans-unit>
<trans-unit id="document.none_found">
<source><![CDATA[Pēc izvēlētiem meklēšanas kritērijiem netika atrasts neviens dokuments]]></source>
......@@ -83,6 +89,12 @@
<trans-unit id="facet.rikojuma_dokum">
<source><![CDATA[Rīkojuma dokumenta tips]]></source>
</trans-unit>
<trans-unit id="facet.tag">
<source><![CDATA[Atslēgvārdi]]></source>
</trans-unit>
<trans-unit id="facet.process">
<source><![CDATA[Process]]></source>
</trans-unit>
<trans-unit id="form.acceptedDate">
<source><![CDATA[Pieņemšanas datums]]></source>
</trans-unit>
......@@ -114,7 +126,7 @@
<source><![CDATA[Meklēt]]></source>
</trans-unit>
<trans-unit id="form.archived">
<source><![CDATA[Rādīt arhivētos]]></source>
<source><![CDATA[Rādīt tikai arhivētos]]></source>
</trans-unit>
<trans-unit id="form.status">
<source><![CDATA[Statuss]]></source>
......@@ -129,13 +141,13 @@
<source><![CDATA[Rādīt skatītākos dokumentus]]></source>
</trans-unit>
<trans-unit id="issuer.title">
<source><![CDATA[LU NAS Izdevējs]]></source>
<source><![CDATA[NAS Izdevējs]]></source>
</trans-unit>
<trans-unit id="ordertype.title">
<source><![CDATA[LU NAS Rīkojuma dokuments]]></source>
<source><![CDATA[NAS Rīkojuma dokuments]]></source>
</trans-unit>
<trans-unit id="status.title">
<source><![CDATA[LU NAS Statuss]]></source>
<source><![CDATA[NAS Statuss]]></source>
</trans-unit>
<trans-unit id="sync.description">
<source><![CDATA[Meklētāja dati tiek sinhrinizēti, tas var prasīt līdz 10 minūtēm]]></source>
......@@ -150,10 +162,13 @@
<source><![CDATA[Nosaukums]]></source>
</trans-unit>
<trans-unit id="type.title">
<source><![CDATA[LU NAS Veids]]></source>
<source><![CDATA[NAS Veids]]></source>
</trans-unit>
<trans-unit id="tags.title">
<source><![CDATA[Tagi]]></source>
<source><![CDATA[NAS Atslēgvārdi]]></source>
</trans-unit>
<trans-unit id="process.title">
<source><![CDATA[NAS Process]]></source>
</trans-unit>
<trans-unit id="dateFormat">
<source><![CDATA[d.m.Y]]></source>
......
......@@ -33,6 +33,14 @@
<source><![CDATA[Arhivēts]]></source>
<target><![CDATA[Arhivēts]]></target>
</trans-unit>
<trans-unit id="document.tag">
<source><![CDATA[Atslēgvārdi]]></source>
<target><![CDATA[Atslēgvārdi]]></target>
</trans-unit>
<trans-unit id="document.process">
<source><![CDATA[Process]]></source>
<target><![CDATA[Process]]></target>
</trans-unit>
<trans-unit id="document.document_type" approved="yes">
<source><![CDATA[Dokumenta tips]]></source>
<target><![CDATA[Dokumenta tips]]></target>
......@@ -50,8 +58,8 @@
<target><![CDATA[Dokumenta izdevējs]]></target>
</trans-unit>
<trans-unit id="document.name" approved="yes">
<source><![CDATA[LU NAS]]></source>
<target><![CDATA[LU NAS]]></target>
<source><![CDATA[NAS Dokuments]]></source>
<target><![CDATA[NAS Dokuments]]></target>
</trans-unit>
<trans-unit id="document.none_found" approved="yes">
<source><![CDATA[Pēc izvēlētiem meklēšanas kritērijiem netika atrasts neviens dokuments]]></source>
......@@ -101,6 +109,14 @@
<source><![CDATA[Izdevējs]]></source>
<target><![CDATA[Izdevējs]]></target>
</trans-unit>
<trans-unit id="facet.tag">
<source><![CDATA[Atslēgvārdi]]></source>
<target><![CDATA[Atslēgvārdi]]></target>
</trans-unit>
<trans-unit id="facet.process">
<source><![CDATA[Process]]></source>
<target><![CDATA[Process]]></target>
</trans-unit>
<trans-unit id="facet.rikojuma_dokum" approved="yes">
<source><![CDATA[Rīkojuma dokumenta tips]]></source>
<target><![CDATA[Rīkojuma dokumenta tips]]></target>
......@@ -146,8 +162,8 @@
<target><![CDATA[Statuss]]></target>
</trans-unit>
<trans-unit id="form.arcived" approved="yes">
<source><![CDATA[Rādīt arhivētos]]></source>
<target><![CDATA[Rādīt arhivētos]]></target>
<source><![CDATA[Rādīt tikai arhivētos]]></source>
<target><![CDATA[Rādīt tikai arhivētos]]></target>
</trans-unit>
<trans-unit id="form.study_guide" approved="yes">
<source><![CDATA[Studiju ceļvedis]]></source>
......@@ -162,16 +178,16 @@
<target><![CDATA[Rādīt skatītākos dokumentus]]></target>
</trans-unit>
<trans-unit id="issuer.title" approved="yes">
<source><![CDATA[LU NAS Izdevējs]]></source>
<target><![CDATA[LU NAS Izdevējs]]></target>
<source><![CDATA[NAS Izdevējs]]></source>
<target><![CDATA[NAS Izdevējs]]></target>
</trans-unit>
<trans-unit id="ordertype.title" approved="yes">
<source><![CDATA[LU NAS Rīkojuma dokuments]]></source>
<target><![CDATA[LU NAS Rīkojuma dokuments]]></target>
<source><![CDATA[NAS Rīkojuma dokuments]]></source>
<target><![CDATA[NAS Rīkojuma dokuments]]></target>
</trans-unit>
<trans-unit id="status.title" approved="yes">
<source><![CDATA[LU NAS Statuss]]></source>
<target><![CDATA[LU NAS Statuss]]></target>
<source><![CDATA[NAS Statuss]]></source>
<target><![CDATA[NAS Statuss]]></target>
</trans-unit>
<trans-unit id="sync.description" approved="yes">
<source><![CDATA[Meklētāja dati tiek sinhrinizēti, tas var prasīt līdz 10 minūtēm]]></source>
......@@ -190,12 +206,16 @@
<target><![CDATA[Nosaukums]]></target>
</trans-unit>
<trans-unit id="type.title" approved="yes">
<source><![CDATA[LU NAS Veids]]></source>
<target><![CDATA[LU NAS Veids]]></target>
<source><![CDATA[NAS Veids]]></source>
<target><![CDATA[NAS Veids]]></target>
</trans-unit>
<trans-unit id="tags.title">
<source><![CDATA[Tagi]]></source>
<target><![CDATA[Tags]]></target>
<source><![CDATA[NAS Atslēgvārdi]]></source>
<target><![CDATA[NAS Atslēgvārdi]]></target>
</trans-unit>
<trans-unit id="process.title">
<source><![CDATA[NAS Process]]></source>
<target><![CDATA[NAS Process]]></target>
</trans-unit>
<trans-unit id="dateFormat">
<source><![CDATA[d.m.Y]]></source>
......
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{hide} == tag">
<p>
<strong><f:translate key="form.filterByFacets" /></strong><br/>
......@@ -7,6 +8,7 @@
<f:then>{facets.error}</f:then>
<f:else>
<f:for each="{facets}" as="facet_field">
<f:if condition="{hide} != {facet_field.name}">
<p><strong><f:translate key="facet.{facet_field.name}"/></strong>
<div style="margin-top: -5px; margin-left: 15px;">
......@@ -15,9 +17,35 @@
</f:for>
</div>
</p>
</f:if>
</f:for>
</f:else>
</f:if>
</p>
</f:if>
</html>
\ No newline at end of file
<f:if condition="{show} == tag">
<p>
<f:if condition="{facets.error}">
<f:then>{facets.error}</f:then>
<f:else>
<strong><f:translate key="document.tag" /></strong><br/><br/>
<f:for each="{facets}" as="facet_field">
<f:if condition="{show} == {facet_field.name}">
<f:for each="{facet_field.items}" as="facet_item">
<f:if condition="{facet_item.name} != '-'">
<a class="nas_tag" href="{data.self}&tx_lunas_pi1[facet_field][{facet_field.name}]={facet_item.name}">
<span>{facet_item.name}</span>
<span class="nas_tag_count">{facet_item.count}</span>
</a>
</f:if>
</f:for>
</f:if>
</f:for>
</f:else>
</f:if>
</p>
</f:if>
</html>
......@@ -91,22 +91,22 @@
<!-- Search by status -->
<div class="form-group">
<label class="col-xs-4 control-label">
<label class="col-xs-4 control-label" for="nas-form-status">
<f:translate key="form.status"/>
</label>
<div class="col-xs-8">
<div class="form-control-clearable">
<f:form.select class="form-control" property="status" options="{status}" value="{filter.status}" />
<f:form.select id="nas-form-status" class="form-control" property="status" options="{status}" value="{filter.status}" />
</div>
</div>
</div>
<!-- Show/hide archived -->
<div class="form-group">
<label class="control-label" for="nas-form-status">
<label class="control-label" for="nas-form-archived">
<f:translate key="form.archived"/>
</label>
<f:form.checkbox id="nas-form-status" value="1" class="form-control" checked="{filter.archived} == 1" name="Filter[archived]" />
<f:form.checkbox id="nas-form-archived" value="1" class="form-control" checked="{filter.archived} == 1" name="Filter[archived]" />
</div>