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
extensions.typo3.org
extensions.typo3.org
Commits
4c5df323
Commit
4c5df323
authored
Dec 08, 2021
by
Thomas Löffler
Browse files
[FEATURE] Add voting results page
parent
fac5a29f
Pipeline
#20763
passed with stages
in 5 minutes and 58 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extensions/ter_fe2/Classes/Controller/NominationController.php
View file @
4c5df323
...
...
@@ -175,6 +175,22 @@ class NominationController extends ActionController
$this
->
redirect
(
'listAllNominations'
);
}
public
function
listResultsAction
()
{
$queryBuilder
=
GeneralUtility
::
makeInstance
(
ConnectionPool
::
class
)
->
getQueryBuilderForTable
(
'tx_terfe2_domain_model_documentationvoting'
);
$results
=
$queryBuilder
->
select
(
'e.ext_key'
)
->
from
(
'tx_terfe2_domain_model_documentationvoting'
,
'd'
)
->
join
(
'd'
,
'tx_terfe2_domain_model_extension'
,
'e'
,
'e.uid = d.extension'
)
->
groupBy
(
'd.extension'
)
->
orderBy
(
'result'
,
'desc'
)
->
add
(
'select'
,
'SUM(d.voting) AS result'
,
true
)
->
execute
()
->
fetchAll
();
$this
->
view
->
assign
(
'results'
,
$results
);
}
private
function
vote
(
Extension
$extension
,
FrontendUser
$user
,
int
$voting
):
bool
{
return
(
bool
)
GeneralUtility
::
makeInstance
(
ConnectionPool
::
class
)
...
...
extensions/ter_fe2/Configuration/TCA/Overrides/tt_content.php
View file @
4c5df323
...
...
@@ -92,6 +92,12 @@
'Nomination voting list'
,
);
\
TYPO3\CMS\Extbase\Utility\ExtensionUtility
::
registerPlugin
(
'ter_fe2'
,
'Results'
,
'Voting results'
,
);
\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility
::
addTcaSelectItem
(
'tt_content'
,
'CType'
,
...
...
extensions/ter_fe2/Resources/Private/Templates/Nomination/ListResults.html
0 → 100644
View file @
4c5df323
<html
xmlns:f=
"http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid=
"true"
>
<f:layout
name=
"Default"
/>
<f:section
name=
"main"
>
<h1>
Voting result
</h1>
<table
class=
"table table-striped"
>
<thead>
<tr>
<th>
Position
</th>
<th>
Extension
</th>
<th>
Voting
</th>
</tr>
</thead>
<tbody>
<f:for
each=
"{results}"
as=
"result"
iteration=
"it"
>
<tr>
<td>
{it.cycle}.
</td>
<td>
{result.ext_key}
</td>
<td>
{result.result}
</td>
</tr>
</f:for>
</tbody>
</table>
</f:section>
</html>
extensions/ter_fe2/ext_localconf.php
View file @
4c5df323
...
...
@@ -56,6 +56,14 @@ if (!defined('TYPO3_MODE')) {
]
);
\
TYPO3\CMS\Extbase\Utility\ExtensionUtility
::
configurePlugin
(
'ter_fe2'
,
'Results'
,
[
\
T3o\TerFe2\Controller\NominationController
::
class
=>
'listResults'
]
);
\
TYPO3\CMS\Extbase\Utility\ExtensionUtility
::
configurePlugin
(
'ter_fe2'
,
'AccessToken'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment