Commit 16fd6d2e authored by Stefan Busemann's avatar Stefan Busemann

Merge branch '7-feature-list-view' into 'master'

Resolve "Feature list view"

Closes #7

See merge request t3o/typo3_roadmap!2
parents 782156e9 ad77be4c
<?php
namespace T3o\Typo3Roadmap\Controller;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* FeatureController
*/
class FeatureController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
/**
* featureRepository
*
* @var \T3o\Typo3Roadmap\Domain\Repository\FeatureRepository
* @inject
*/
protected $featureRepository = null;
/**
* featureAreaRepository
*
* @var \T3o\Typo3Roadmap\Domain\Repository\FeatureAreaRepository
* @inject
*/
protected $featureAreaRepository = null;
/**
* action listFeatures
*
* @return void
*/
public function listFeaturesAction()
{
if($this->settings[featurearea]!=""){
$featureArea=$this->featureAreaRepository->findByUid($this->settings[featurearea]);
$this->view->assign('featureArea', $featureArea);
}
$features = $this->featureRepository->findByFilter($this->settings);
$this->view->assign('features', $features);
}
/**
* action showRecord
*
* @return void
*/
public function showFeatureRecordsAction()
{
$features=[];
$ids = explode(',',$this->settings['feature']);
foreach($ids as $key => $id){
$features[$id] = $this->featureRepository->findByUid($id);
}
$this->view->assign('features', $features);
}
/**
* action showRecord
*
* @return void
*/
public function showFeatureAreaRecordsAction()
{
$featureAreas=[];
$ids = explode(',',$this->settings['featureArea']);
foreach($ids as $key => $id){
$featureAreas[$id] = $this->featureAreaRepository->findByUid($id);
}
$this->view->assign('featureAreas', $featureAreas);
}
}
<?php
namespace T3o\Typo3Roadmap\Domain\Model;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Feature
*/
class Feature extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* header
*
* @var string
* @validate NotEmpty
*/
protected $header = '';
/**
* description
*
* @var string
* @validate NotEmpty
*/
protected $description = '';
/**
* images
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @cascade remove
*/
protected $images = null;
/**
* link
*
* @var string
*/
protected $link = '';
/**
* typo3releaseminorversion
*
* @var \T3o\Typo3Roadmap\Domain\Model\MinorVersion
* @lazy
*/
protected $typo3releaseminorversion = null;
/**
* typo3releasemajorversion
*
* @var \T3o\Typo3Roadmap\Domain\Model\MajorVersion
* @lazy
*/
protected $typo3releasemajorversion = null;
/**
* featureArea
*
* @var \T3o\Typo3Roadmap\Domain\Model\FeatureArea
* @lazy
*/
protected $featureArea = null;
/**
* Returns the header
*
* @return string $header
*/
public function getHeader()
{
return $this->header;
}
/**
* Sets the header
*
* @param string $header
* @return void
*/
public function setHeader($header)
{
$this->header = $header;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription()
{
return $this->description;
}
/**
* Sets the description
*
* @param string $description
* @return void
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* Returns the link
*
* @return string $link
*/
public function getLink()
{
return $this->link;
}
/**
* Sets the link
*
* @param string $link
* @return void
*/
public function setLink($link)
{
$this->link = $link;
}
/**
* Returns the featureArea
*
* @return \T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea
*/
public function getFeatureArea()
{
return $this->featureArea;
}
/**
* Sets the featureArea
*
* @param \T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea
* @return void
*/
public function setFeatureArea(\T3o\Typo3Roadmap\Domain\Model\FeatureArea $featureArea)
{
$this->featureArea = $featureArea;
}
/**
* Returns the typo3releaseminorversion
*
* @return \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion
*/
public function getTypo3releaseminorversion()
{
return $this->typo3releaseminorversion;
}
/**
* Sets the typo3releaseminorversion
*
* @param \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion
* @return void
*/
public function setTypo3releaseminorversion(\T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releaseminorversion)
{
$this->typo3releaseminorversion = $typo3releaseminorversion;
}
/**
* Returns the typo3releasemajorversion
*
* @return \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion
*/
public function getTypo3releasemajorversion()
{
return $this->typo3releasemajorversion;
}
/**
* Sets the typo3releasemajorversion
*
* @param \T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion
* @return void
*/
public function setTypo3releasemajorversion(\T3o\Typo3Roadmap\Domain\Model\MinorVersion $typo3releasemajorversion)
{
$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
*/
public function getImages()
{
return $this->images;
}
/**
* Sets the images
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
* @return void
*/
public function setImages(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $images)
{
$this->images = $images;
}
}
<?php
namespace T3o\Typo3Roadmap\Domain\Model;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* FeatureArea
*/
class FeatureArea extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* title
*
* @var string
* @validate NotEmpty
*/
protected $title = '';
/**
* description
*
* @var string
* @validate NotEmpty
*/
protected $description = '';
/**
* page
*
* @var string
* @validate NotEmpty
*/
protected $page = '';
/**
* images
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @cascade remove
*/
protected $images = null;
/**
* Returns the title
*
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription()
{
return $this->description;
}
/**
* Sets the description
*
* @param string $description
* @return void
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* Returns the page
*
* @return string $page
*/
public function getPage()
{
return $this->page;
}
/**
* Sets the page
*
* @param string $page
* @return void
*/
public function setPage($page)
{
$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)
{
$this->images->attach($images);
}
/**
* Removes a FileReference
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove The FileReference to be removed
* @return void
*/
public function removeImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove)
{
$this->images->detach($imageToRemove);
}
/**
* Returns the images
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> images
*/
public function getImages()
{
return $this->images;
}
/**
* Sets the images
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
* @return void
*/
public function setImages(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $images)
{
$this->images = $images;
}
}
<?php
namespace T3o\Typo3Roadmap\Domain\Repository;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* The repository for FeatureAreas
*/
class FeatureAreaRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}
<?php
namespace T3o\Typo3Roadmap\Domain\Repository;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* The repository for Features
*/
class FeatureRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
/**
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findAll()
{
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(false);
$query->setOrderings(['typo3releaseminorversion.version' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING]);
return $query->execute();
}
/**
* @param $setting
* @param string $featureArea
* @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
*/
public function findByFilter($setting)
{
$query = $this->createQuery();
$query->getQuerySettings()->setRespectStoragePage(false);
$query->setOrderings(['typo3releaseminorversion.version' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING]);
//We need at least min 1 filterConstraint
$constraints[] = $query->greaterThan('uid', 0);
if ($setting['majorversion'] != '') {
$constraints[] = $query->equals('typo3releasemajorversion', (int)$setting['majorversion']);
}
if ($setting['minorversion'] != '') {
$constraints[] = $query->equals('typo3releaseminorversion', (int)$setting['minorversion']);
}
if ($setting['featurearea'] != '') {
$constraints[] = $query->equals('featureArea', (int)$setting['featurearea']);
}
$query->matching($query->logicalAnd($constraints));
return $query->execute();
}
}
......@@ -14,12 +14,17 @@ namespace T3o\Typo3Roadmap\Domain\Repository;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Persistence\QueryInterface;