Commit 395d19ad authored by Tomas Norre Mikkelsen's avatar Tomas Norre Mikkelsen
Browse files

Merge branch 'update-v10' into 'master'

Update v10

Closes #23

See merge request t3o/typo3_roadmap!16
parents 8a89ccf9 028b62e9
<?php
declare(strict_types=1);
namespace T3o\Typo3Roadmap\Controller;
/**
......@@ -15,16 +15,19 @@ namespace T3o\Typo3Roadmap\Controller;
* The TYPO3 project - inspiring people to share!
*/
use T3o\Typo3Roadmap\Domain\Repository\FeatureAreaRepository;
use T3o\Typo3Roadmap\Domain\Repository\FeatureRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/**
* FeatureController
*/
class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
class FeatureController extends ActionController
{
/**
* featureRepository
*
* @var \T3o\Typo3Roadmap\Domain\Repository\FeatureRepository
* @inject
*/
protected $featureRepository = null;
......@@ -32,19 +35,28 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* featureAreaRepository
*
* @var \T3o\Typo3Roadmap\Domain\Repository\FeatureAreaRepository
* @inject
*/
protected $featureAreaRepository = null;
public function injectFeatureRepository(FeatureRepository $featureRepository): void
{
$this->featureRepository = $featureRepository;
}
public function injectFeatureAreaRepository(FeatureAreaRepository $featureAreaRepository): void
{
$this->featureAreaRepository = $featureAreaRepository;
}
/**
* action listFeatures
*
* @return void
*/
public function listFeaturesAction()
public function listFeaturesAction(): void
{
if ($this->settings['featurearea'] != '') {
if ($this->settings['featurearea'] !== '') {
$featureArea = $this->featureAreaRepository->findByUid((int)$this->settings['featurearea']);
$this->view->assign('featureArea', $featureArea);
}
......@@ -58,7 +70,7 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
*
* @return void
*/
public function showFeatureRecordsAction()
public function showFeatureRecordsAction(): void
{
$features = [];
$ids = explode(',', $this->settings['feature']);
......@@ -73,7 +85,7 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
*
* @return void
*/
public function showFeatureAreaRecordsAction()
public function showFeatureAreaRecordsAction(): void
{
$featureAreas = [];
$ids = explode(',', $this->settings['featureArea']);
......@@ -82,5 +94,4 @@ class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
}
$this->view->assign('featureAreas', $featureAreas);
}
}
<?php
declare(strict_types=1);
namespace T3o\Typo3Roadmap\Controller;
/**
......@@ -14,14 +15,17 @@ namespace T3o\Typo3Roadmap\Controller;
* The TYPO3 project - inspiring people to share!
*/
use \TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use \T3o\Typo3Roadmap\Domain\Model\MajorVersion;
use T3o\Typo3Roadmap\Domain\Repository\MajorVersionRepository;
use T3o\Typo3Roadmap\Domain\Repository\PhpVersionRepository;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/**
* Class \T3o\Typo3Roadmap\Controller\RoadmapController
* @author Sebastian Diez
*/
class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
class RoadmapController extends ActionController
{
/*
* Color Codes for the charts
......@@ -36,7 +40,6 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* majorVersionRepository
*
* @var \T3o\Typo3Roadmap\Domain\Repository\MajorVersionRepository
* @inject
*/
protected $majorVersionRepository = null;
......@@ -44,24 +47,25 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
* majorVersionRepository
*
* @var \T3o\Typo3Roadmap\Domain\Repository\PhpVersionRepository
* @inject
*/
protected $phpVersionRepository = null;
/**
* pageRenderer
*
* @var \TYPO3\CMS\Core\Page\PageRenderer
* @inject
*/
protected $pageRenderer = null;
public function injectMajorVersionRepository(MajorVersionRepository $majorVersionRepository): void
{
$this->majorVersionRepository = $majorVersionRepository;
}
public function injectPhpVersionRepository(PhpVersionRepository $phpVersionRepository): void
{
$this->phpVersionRepository = $phpVersionRepository;
}
/**
* action roadmap
*
* @return void
*/
public function roadmapAction()
public function roadmapAction(): void
{
$majorVersions = array_reverse($this->majorVersionRepository->findAll()->toArray());
$this->view->assign('majorVersions', $majorVersions);
......@@ -75,14 +79,16 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
*
* @param MajorVersion[] $majorVersions
*/
protected function renderCharts($majorVersions)
protected function renderCharts($majorVersions): void
{
$this->pageRenderer->addJsLibrary('amcharts', 'EXT:typo3_roadmap/Resources/Public/JavaScript/amcharts.min.js');
$this->pageRenderer->addJsLibrary('amcharts_serial', 'EXT:typo3_roadmap/Resources/Public/JavaScript/serial.min.js');
$this->pageRenderer->addJsLibrary('amcharts_gantt', 'EXT:typo3_roadmap/Resources/Public/JavaScript/gantt.min.js');
$this->pageRenderer->addJsLibrary('amcharts_lightheme', 'EXT:typo3_roadmap/Resources/Public/JavaScript/lighttheme.min.js');
$this->pageRenderer->addJsLibrary('amcharts_export', 'EXT:typo3_roadmap/Resources/Public/JavaScript/export.min.js');
$this->pageRenderer->addCssFile('EXT:typo3_roadmap/Resources/Public/Css/export.css');
/** @var PageRenderer $pageRenderer */
$pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addJsFooterLibrary('amcharts', 'EXT:typo3_roadmap/Resources/Public/JavaScript/amcharts.min.js');
$pageRenderer->addJsFooterLibrary('amcharts_serial', 'EXT:typo3_roadmap/Resources/Public/JavaScript/serial.min.js');
$pageRenderer->addJsFooterLibrary('amcharts_gantt', 'EXT:typo3_roadmap/Resources/Public/JavaScript/gantt.min.js');
$pageRenderer->addJsFooterLibrary('amcharts_lightheme', 'EXT:typo3_roadmap/Resources/Public/JavaScript/lighttheme.min.js');
$pageRenderer->addJsFooterLibrary('amcharts_export', 'EXT:typo3_roadmap/Resources/Public/JavaScript/export.min.js');
$pageRenderer->addCssFile('EXT:typo3_roadmap/Resources/Public/Css/export.css');
// @TODO comment css
$data = $this->generateChartArray($majorVersions);
$this->view->assign('data', $data);
......@@ -147,7 +153,7 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
}
});
';
$this->pageRenderer->addJsFooterInlineCode('ltsChart', $chartJs);
$pageRenderer->addJsFooterInlineCode('ltsChart', $chartJs);
}
/**
......@@ -157,9 +163,11 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
*
* @return bool|string
*/
protected function dateFromTimestamp($timeStamp = 0)
protected function dateFromTimestamp($timeStamp = 0): ?string
{
return date('Y-m-d', $timeStamp);
$date = date('Y-m-d', $timeStamp);
return $date ?: null;
}
/**
......@@ -170,7 +178,7 @@ class RoadmapController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControll
*
* @return array
*/
protected function generateChartArray($majorVersions)
protected function generateChartArray($majorVersions): array
{
$data = array();
foreach ($majorVersions as $index => $majorVersion) {
......
<?php
declare(strict_types=1);
namespace T3o\Typo3Roadmap\Domain\Model;
/**
......@@ -14,16 +15,19 @@ namespace T3o\Typo3Roadmap\Domain\Model;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* Feature
*/
class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
class Feature extends AbstractEntity
{
/**
* header
*
* @var string
* @validate NotEmpty
* @Extbase\Validate("NotEmpty")
*/
protected $header = '';
......@@ -31,7 +35,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* description
*
* @var string
* @validate NotEmpty
* @Extbase\Validate("NotEmpty")
*/
protected $description = '';
......@@ -39,7 +43,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* images
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @cascade remove
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected $images = null;
......@@ -54,7 +58,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* typo3releaseminorversion
*
* @var \T3o\Typo3Roadmap\Domain\Model\MinorVersion
* @lazy
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $typo3releaseminorversion = null;
......@@ -62,7 +66,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* typo3releasemajorversion
*
* @var \T3o\Typo3Roadmap\Domain\Model\MajorVersion
* @lazy
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $typo3releasemajorversion = null;
......@@ -70,16 +74,40 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* featureArea
*
* @var \T3o\Typo3Roadmap\Domain\Model\FeatureArea
* @lazy
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $featureArea = null;
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects(): void
{
$this->images = new ObjectStorage();
$this->typo3releasemajorversion = new ObjectStorage();
$this->typo3releaseminorversion = new ObjectStorage();
}
/**
* Returns the header
*
* @return string $header
*/
public function getHeader()
public function getHeader(): string
{
return $this->header;
}
......@@ -90,7 +118,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $header
* @return void
*/
public function setHeader($header)
public function setHeader(string $header): void
{
$this->header = $header;
}
......@@ -100,7 +128,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string $description
*/
public function getDescription()
public function getDescription(): string
{
return $this->description;
}
......@@ -111,7 +139,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $description
* @return void
*/
public function setDescription($description)
public function setDescription(string $description): void
{
$this->description = $description;
}
......@@ -121,7 +149,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string $link
*/
public function getLink()
public function getLink(): string
{
return $this->link;
}
......@@ -132,7 +160,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $link
* @return void
*/
public function setLink($link)
public function setLink(string $link): void
{
$this->link = $link;
}
......@@ -142,7 +170,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return \T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea
*/
public function getFeatureArea()
public function getFeatureArea(): FeatureArea
{
return $this->featureArea;
}
......@@ -153,7 +181,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param \T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea
* @return void
*/
public function setFeatureArea(\T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea)
public function setFeatureArea(FeatureArea $featureArea)
{
$this->featureArea = $featureArea;
}
......@@ -161,9 +189,9 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Returns the typo3releaseminorversion
*
* @return \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion
* @return \T3o\Typo3Roadmap\Domain\Model\MinorVersion
*/
public function getTypo3releaseminorversion()
public function getTypo3releaseminorversion(): MinorVersion
{
return $this->typo3releaseminorversion;
}
......@@ -174,7 +202,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion
* @return void
*/
public function setTypo3releaseminorversion(\T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion)
public function setTypo3releaseminorversion(MinorVersion $typo3releaseminorversion): void
{
$this->typo3releaseminorversion = $typo3releaseminorversion;
}
......@@ -182,9 +210,9 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Returns the typo3releasemajorversion
*
* @return \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion
* @return \T3o\Typo3Roadmap\Domain\Model\MajorVersion
*/
public function getTypo3releasemajorversion()
public function getTypo3releasemajorversion(): MajorVersion
{
return $this->typo3releasemajorversion;
}
......@@ -192,42 +220,20 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Sets the typo3releasemajorversion
*
* @param \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion
* @param \T3o\Typo3Roadmap\Domain\Model\MajorVersion $typo3releasemajorversion
* @return void
*/
public function setTypo3releasemajorversion(\T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion)
public function setTypo3releasemajorversion(MajorVersion $typo3releasemajorversion): void
{
$this->typo3releasemajorversion = $typo3releasemajorversion;
}
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects()
{
$this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Returns the images
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> images
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
public function getImages()
public function getImages(): ObjectStorage
{
return $this->images;
}
......@@ -238,7 +244,7 @@ class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
* @return void
*/
public function setImages(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $images)
public function setImages(ObjectStorage $images): void
{
$this->images = $images;
}
......
<?php
declare(strict_types=1);
namespace T3o\Typo3Roadmap\Domain\Model;
/**
......@@ -14,16 +15,20 @@ namespace T3o\Typo3Roadmap\Domain\Model;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* FeatureArea
*/
class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
class FeatureArea extends AbstractEntity
{
/**
* title
*
* @var string
* @validate NotEmpty
* @Extbase\Validate("NotEmpty")
*/
protected $title = '';
......@@ -31,7 +36,7 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* description
*
* @var string
* @validate NotEmpty
* @Extbase\Validate("NotEmpty")
*/
protected $description = '';
......@@ -39,7 +44,7 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* page
*
* @var string
* @validate NotEmpty
* @Extbase\Validate("NotEmpty")
*/
protected $page = '';
......@@ -47,16 +52,38 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* images
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @cascade remove
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected $images = null;
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects()
{
$this->images = new ObjectStorage();
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle()
public function getTitle(): string
{
return $this->title;
}
......@@ -67,7 +94,7 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $title
* @return void
*/
public function setTitle($title)
public function setTitle(string $title): void
{
$this->title = $title;
}
......@@ -77,7 +104,7 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string $description
*/
public function getDescription()
public function getDescription(): string
{
return $this->description;
}
......@@ -88,7 +115,7 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $description
* @return void
*/
public function setDescription($description)
public function setDescription(string $description): void
{
$this->description = $description;
}
......@@ -98,7 +125,7 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string $page
*/
public function getPage()
public function getPage(): string
{
return $this->page;
}
......@@ -109,51 +136,29 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $page
* @return void
*/
public function setPage($page)
public function setPage(string $page): void
{
$this->page = $page;
}
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects()
{
$this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Adds a FileReference
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
* @return void
*/
public function addImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image)
public function addImage(FileReference $image): void
{
$this->images->attach($images);
$this->images->attach($image);
}
/**
* Removes a FileReference
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove The FileReference to be removed
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove
* @return void
*/
public function removeImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove)
public function removeImage(FileReference $imageToRemove): void
{
$this->images->detach($imageToRemove);
}
......@@ -161,9 +166,9 @@ class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity