Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
domjos1994 committed Aug 19, 2018
1 parent 697a2c7 commit 9189403
Show file tree
Hide file tree
Showing 24 changed files with 871 additions and 0 deletions.
66 changes: 66 additions & 0 deletions Classes/Controller/TimelineController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

namespace DominicJoas\Timeline\Controller;

use DominicJoas\Timeline\Domain\Repository\TimelineEventRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;

class TimelineController extends ActionController {
private $timelineEventRepository;
protected $configurationManager;
private $layout;
private $color;

public function injectTimelineEventRepository(TimelineEventRepository $timelineEventRepository) {
$this->timelineEventRepository = $timelineEventRepository;
}

public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager) {
parent::injectConfigurationManager($configurationManager);
$this->configurationManager = $configurationManager;
$tsSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, "timeline_pi1")['settings'];

$tmpLayout = $this->settings['layout'];
if($tmpLayout == 0) {
$this->layout = str_replace("Layout ", "", $tsSettings['layout']);
} else {
$this->layout = $tmpLayout;
}

$tmpColor = $this->settings['color'];
if(empty($tmpColor)) {
$this->color = $tsSettings['color'];
} else {
$this->color = $tmpColor;
}
}

public function listAction() {
$uid = $this->configurationManager->getContentObject()->data['uid'];
$timelineEvents = $this->timelineEventRepository->findAll();

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

$uniqueIDs = null;
$i = 0;
foreach($timelineEvents as $var) {
$uniqueIDs[$i] = uniqid(rand(), true);
$i++;
}
$this->view->assign('events', $timelineEvents);
$this->view->assign('uid', $uid);
$this->view->assign("layout", $this->layout);
$this->view->assign("color", $this->color);
return $this->view->render();
}

}
77 changes: 77 additions & 0 deletions Classes/Domain/Model/TimelineEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace DominicJoas\Timeline\Domain\Model;

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class TimelineEvent extends AbstractEntity {

/**
* The title of the Event
*
* @var string
* */
protected $title = '';

/**
* The description of the Event
*
* @var string
* */
protected $description = '';

/**
* The start-date of the Event
*
* @var int
* */
protected $startDate = 0;

/**
* The End-Date of the Event
*
* @var int
* */
protected $endDate = 0;

public function __construct($title = '', $description = '', $startDate = null, $endDate = null) {
$this->title = $title;
$this->description = $description;
$this->startDate = $startDate;
$this->endDate = $endDate;
}

public function setTitle($title) {
$this->title = $title;
}

public function getTitle() {
return $this->title;
}

public function setDescription($description) {
$this->description = $description;
}

public function getDescription() {
return $this->description;
}

public function setStartDate($startDate) {
$this->startDate = $startDate;
}

public function getStartDate() {
return $this->startDate;
}

public function setEndDate($endDate) {
$this->endDate = $endDate;
}

public function getEndDate() {
return $this->endDate;
}

}

15 changes: 15 additions & 0 deletions Classes/Domain/Repository/TimelineEventRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace DominicJoas\Timeline\Domain\Repository;

use TYPO3\CMS\Extbase\Persistence\Repository;

class TimelineEventRepository extends Repository {

public function getContentElementEntries($uid) {
$query = $this->createQuery();
$query->statement("SELECT * FROM tx_timeline_domain_model_timelineevent WHERE timetable_id=$uid");
$result = $query->execute();
return $result;
}
}
68 changes: 68 additions & 0 deletions Configuration/FlexForms/flexform_timeline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<T3DataStructure>
<meta>
<langDisable>1</langDisable>
</meta>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.layout>
<TCEforms>
<label>LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.item_layout</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="2" type="array">
<numIndex index="0">Layout 1</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
<numIndex index="3" type="array">
<numIndex index="0">Layout 2</numIndex>
<numIndex index="1">2</numIndex>
</numIndex>
<numIndex index="4" type="array">
<numIndex index="0">Layout 3</numIndex>
<numIndex index="1">3</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</settings.layout>
<settings.color>
<TCEforms>
<label>LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timeline.item_color</label>
<config>
<type>input</type>
<size>6</size>
<wizards>
<color>
<type>colorbox</type>
<dim>212x18</dim>
<tableStyle>border:solid 1px black;</tableStyle>
<script>wizard_colorpicker.php</script>
<module type="array">
<name>wizard_colorpicker</name>
<urlParameters type="array"/>
</module>
<JSopenParams>height=340,width=360,status=0,menubar=0,scrollbars=1</JSopenParams>
</color>
</wizards>
<default></default>
<eval>#555555</eval>
</config>
</TCEforms>
</settings.color>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>

34 changes: 34 additions & 0 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'DominicJoas.Timeline',
'Pi1',
'Timeline',
'timeline-icon'
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', array(
'tx_timeline_timelineevents' => array(
'exclude' => 0,
'label' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_timeline_domain_model_timelineevent',
'foreign_field' => 'timetable_id',
'foreign_label' => 'title',
'maxitems' => '100',
'appearance' => array(
#'collapseAll' => 0,
'expandSingle' => true,
'newRecordLinkAddTitle' => 1,
'newRecordLinkPosition' => 'both',
'showAllLocalizationLink' => true,
'showPossibleLocalizationRecords' => true,
),
'behaviour' => array(
'localizationMode' => 'select',
'localizeChildrenAtParentLocalization' => true,
),
)
),
));
61 changes: 61 additions & 0 deletions Configuration/TCA/tx_timeline_domain_model_timelineevent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

return [
'ctrl' => [
'title' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent',
'label' => 'title',
'iconfile' => 'EXT:timeline/Resources/Public/Icons/TimelineEvent.svg',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'sortby' => 'uid',
'searchFields' => 'title',
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
)
],
'columns' => [
'title' => [
'label' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent.item_title',
'config' => [
'type' => 'input',
'size' => '20',
'eval' => 'trim,required'
]
],
'description' => [
'label' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent.item_description',
'config' => [
'type' => 'text',
'eval' => 'trim'
]
],
'start_date' => [
'label' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent.item_start',
'config' => [
'type' => 'input',
'size' => '20',
'eval' => 'date,required'
]
],
'end_date' => [
'label' => 'LLL:EXT:timeline/Resources/Private/Language/locallang_db.xlf:tx_timeline_domain_model_timelineevent.item_end',
'config' => [
'type' => 'input',
'size' => '20',
'eval' => 'date'
]
],
],
'types' => [
'0' => ['showitem' => 'title, description, start_date, end_date']
]
];

14 changes: 14 additions & 0 deletions Configuration/Typoscript/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugin.tx_timeline_pi1 {
settings {
# cat=tx_timeline_pi1/enable/a; type=boolean; label=Include JQuery: Include JQuery by extension
jquery = 1

# cat=tx_timeline_pi1/style/a; type=options[Layout 1, Layout 2, Layout 3]; label=Style: The style of the Timeline
layout = Layout 1
# cat=tx_timeline_pi1/color/a; type=color; label=Background-Color:The Background-Color of the Timeline
color = #000

# cat=tx_timeline_pi1/file/a; type=string; label=Custom css: Include custom Stylesheet for Timeline
customCSS =
}
}
25 changes: 25 additions & 0 deletions Configuration/Typoscript/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
lib.calc = TEXT
lib.calc {
current = 1
prioriCalc = 1
}

plugin.tx_timeline_pi1 {
settings {
jquery = {$plugin.tx_timeline_pi1.settings.jquery}
layout = {$plugin.tx_timeline_pi1.settings.layout}
color = {$plugin.tx_timeline_pi1.settings.color}
customCSS = {$plugin.tx_timeline_pi1.settings.customCSS}
}
}


[globalString = LIT:{$plugin.tx_timeline_pi1.settings.customCSS} = /.+/]
page.includeCSS.file = {$plugin.tx_timeline_pi1.settings.customCSS}
[else]
page.includeCSS.file = EXT:timeline/Resources/Public/Css/timeline.css
[global]
[globalVar = LIT:1 = {$plugin.tx_timeline_pi1.settings.jquery}]
page.includeJSFooter.file = EXT:timeline/Resources/Public/Js/jquery.js
[global]
page.includeJSFooter.file = EXT:timeline/Resources/Public/Js/timeline.js
Loading

0 comments on commit 9189403

Please sign in to comment.