Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
typo3.org
typo3_roadmap
Commits
296d6bd2
Commit
296d6bd2
authored
Apr 09, 2018
by
Christian Knauf
Browse files
[TASK] Feature list view
parent
6f19bb85
Changes
31
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/FeatureController.php
0 → 100644
View file @
296d6bd2
<?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
()
{
$featureArray
=
[];
if
(
$this
->
request
->
hasArgument
(
'featureArea'
))
{
$featureArea
=
$this
->
request
->
getArgument
(
'featureArea'
);
}
$features
=
$this
->
featureRepository
->
findByFilter
(
$this
->
settings
,
$featureArea
);
/* @var \T3o\Typo3Roadmap\Domain\Model\Feature $feature */
foreach
(
$features
as
$feature
)
{
$featureArray
[
$feature
->
getTypo3releasemajorversion
()
->
getTitle
()][
$feature
->
getTypo3releaseminorversion
()
->
getVersion
()][]
=
$feature
;
}
$this
->
view
->
assign
(
'features'
,
$featureArray
);
}
/**
* action showFeature
*
* @param \T3o\Typo3Roadmap\Domain\Model\Feature $feature
* @return void
*/
public
function
showFeatureAction
(
\
T3o\Typo3Roadmap\Domain\Model\Feature
$feature
)
{
$this
->
view
->
assign
(
'feature'
,
$feature
);
}
/**
* 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
);
}
/**
* action listFeatures
*
* @return void
*/
public
function
listFeatureAreasAction
()
{
$featureAreas
=
$this
->
featureAreaRepository
->
findAll
();
$this
->
view
->
assign
(
'featureAreas'
,
$featureAreas
);
}
}
Classes/Domain/Model/Feature.php
0 → 100644
View file @
296d6bd2
<?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
;
}
}
Classes/Domain/Model/FeatureArea.php
0 → 100644
View file @
296d6bd2
<?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
;
}
}
Classes/Domain/Repository/FeatureAreaRepository.php
0 → 100644
View file @
296d6bd2
<?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
{
}
Classes/Domain/Repository/FeatureRepository.php
0 → 100644
View file @
296d6bd2
<?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
,
$featureArea
=
''
)
{
$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'
]);
}