Skip to content

Commit

Permalink
solve bug 0000269
Browse files Browse the repository at this point in the history
  • Loading branch information
domjos1994 committed Aug 29, 2019
1 parent 201a6f9 commit 70d7bfb
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 8 deletions.
12 changes: 10 additions & 2 deletions Classes/Controller/TimelineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class TimelineController extends ActionController {
private $layout;
private $year;
private $color, $foreColor;
private $order;

public function injectTimelineEventRepository(TimelineEventRepository $timelineEventRepository) {
$this->timelineEventRepository = $timelineEventRepository;
Expand Down Expand Up @@ -49,6 +50,13 @@ public function injectConfigurationManager(ConfigurationManagerInterface $config
} else {
$this->foreColor = $tmpColor;
}

$tmpOrder = $this->settings['order'];
if($tmpOrder == "fromTS") {
$this->order = $tsSettings['order'];
} else {
$this->order = $tmpOrder;
}
}

public function listAction() {
Expand All @@ -60,11 +68,11 @@ public function listAction() {

if(!is_null($timelineEvents)) {
if(empty($timelineEvents->toArray())) {
$query = $this->timelineEventRepository->getContentElementEntries($uid);
$query = $this->timelineEventRepository->getContentElementEntries($uid, $this->order);
$timelineEvents = $query->toArray();
}
} else {
$query = $this->timelineEventRepository->getContentElementEntries($uid);
$query = $this->timelineEventRepository->getContentElementEntries($uid, $this->order);
$timelineEvents = $query->toArray();
}

Expand Down
19 changes: 15 additions & 4 deletions Classes/Domain/Repository/TimelineEventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,28 @@ class TimelineEventRepository extends Repository {
* @param int $uid
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function getContentElementEntries($uid) {
public function getContentElementEntries($uid, $order) {
$query = $this->createQuery();
$ordering = null;

switch ($order) {
case "none":
$ordering = [];
break;
case "asc":
$ordering = ['start_date' => Query::ORDER_ASCENDING];
break;
case "desc":
$ordering = ['start_date' => Query::ORDER_DESCENDING];
break;
}

$query->getQuerySettings()->setRespectStoragePage(false);

$query->matching(
$query->equals('timetable_id', (int)$uid)
);
$query->setOrderings([
'start_date' => Query::ORDER_ASCENDING,
]);
$query->setOrderings($ordering);


$result = $query->execute();
Expand Down
26 changes: 26 additions & 0 deletions Configuration/FlexForms/flexform_timeline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,32 @@
</config>
</TCEforms>
</settings.fore_color>
<settings.order>
<TCEforms>
<label>LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.order</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.ts</numIndex>
<numIndex index="1">fromTS</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.order.none</numIndex>
<numIndex index="1">none</numIndex>
</numIndex>
<numIndex index="2" type="array">
<numIndex index="0">LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.order.asc</numIndex>
<numIndex index="1">asc</numIndex>
</numIndex>
<numIndex index="3" type="array">
<numIndex index="0">LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.order.desc</numIndex>
<numIndex index="1">desc</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</settings.order>
</el>
</ROOT>
</sDEF>
Expand Down
4 changes: 3 additions & 1 deletion Configuration/Typoscript/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ plugin.tx_timeline_pi1 {
back_color = #fff
# cat=tx_timeline_pi1/color/b; type=color; label=Background-Color:The Foreground-Color of the Timeline
fore_color = #000


# cat=tx_timeline_pi1/other/a; type=options[asc, desc, none]; label=Order:The Order of the timeline-items
order = desc

# cat=tx_timeline_pi1/file/a; type=string; label=Custom css: Include custom Stylesheet for Timeline
customCSS =
Expand Down
16 changes: 16 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@
<source>From Typoscript</source>
<target>Von Typoscript</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order">
<source>Order</source>
<source>Sortierung</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.asc">
<source>Ascending</source>
<source>Aufsteigend</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.desc">
<source>Descending</source>
<source>Absteigend</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.none">
<source>None</source>
<source>Keine</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.custom">
<source>Custom CSS-File</source>
<source>Eigene CSS-Datei</source>
Expand Down
16 changes: 16 additions & 0 deletions Resources/Private/Language/es.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@
<source>From Typoscript</source>
<target>De Typoscript</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order">
<source>Order</source>
<source>Clasificación</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.asc">
<source>Ascending</source>
<source>Ascendente</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.desc">
<source>Descending</source>
<source>Descendente</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.none">
<source>None</source>
<source>No</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.custom">
<source>Custom CSS-File</source>
<source>Propio CSS-Expediente</source>
Expand Down
16 changes: 16 additions & 0 deletions Resources/Private/Language/fr.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@
<source>From Typoscript</source>
<target>De Typoscript</target>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order">
<source>Order</source>
<source>Tri</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.asc">
<source>Ascending</source>
<source>Ascendant</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.desc">
<source>Descending</source>
<source>Descendant</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.none">
<source>None</source>
<source>Aucun</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.custom">
<source>Custom CSS-File</source>
<source>Propre CSS-Fichier</source>
Expand Down
12 changes: 12 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@
<trans-unit id="tx_timeline_domain_model_timeline.ts">
<source>From Typoscript</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order">
<source>Order</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.asc">
<source>Ascending</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.desc">
<source>Descending</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.order.none">
<source>None</source>
</trans-unit>
<trans-unit id="tx_timeline_domain_model_timeline.custom">
<source>Custom CSS-File</source>
</trans-unit>
Expand Down
1 change: 1 addition & 0 deletions Resources/Private/Templates/Timeline/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<f:for each="{events}" as="event" iteration="objIterator">
<f:switch expression="{layout}">
<f:case value="1">

<li class='work'>
<f:if condition="{objIterator.cycle}==1">
<f:then>
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/***************************************************************
* Extension Manager/Repository config file for ext "timeline".
*
* Auto generated 04-10-2018 15:57
* Auto generated 27-08-2019 08:55
*
* Manual updates:
* Only the data in the array - everything else is removed by next
Expand Down

0 comments on commit 70d7bfb

Please sign in to comment.