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
voting.typo3.org
extensions
election
Commits
55977a28
Commit
55977a28
authored
Dec 24, 2015
by
Oliver Eglseder
Browse files
[TASK] Add submit vote action
parent
de837511
Changes
4
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/FeElectionController.php
View file @
55977a28
...
...
@@ -81,12 +81,35 @@ class FeElectionController extends ActionController
}
}
/**
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
*/
public
function
initializeSubmitVoteAction
()
{
if
(
$this
->
request
->
hasArgument
(
'electionVoting'
))
{
$electionVoting
=
$this
->
request
->
getArgument
(
'electionVoting'
);
if
(
isset
(
$electionVoting
[
'nominees'
])
&&
is_array
(
$electionVoting
[
'nominees'
]))
{
$electionVoting
[
'nominees'
]
=
array_filter
(
$electionVoting
[
'nominees'
]);
$this
->
request
->
setArgument
(
'electionVoting'
,
$electionVoting
);
}
}
}
/**
* @param ElectionVoting $electionVoting
*/
public
function
submitVoteAction
(
ElectionVoting
$electionVoting
)
{
\
TYPO3\CMS\Extbase\Utility\DebuggerUtility
::
var_dump
(
$electionVoting
,
__CLASS__
.
'@'
.
__LINE__
,
20
);
if
(
count
(
$electionVoting
->
getNominees
())
>
$electionVoting
->
getElectionInvitation
()
->
getElectionCircular
()
->
getElection
()
->
getNumberOfVotes
()
)
{
\
TYPO3\CMS\Extbase\Utility\DebuggerUtility
::
var_dump
(
'too many votes'
,
__CLASS__
.
'@'
.
__LINE__
,
20
);
}
else
{
\
TYPO3\CMS\Extbase\Utility\DebuggerUtility
::
var_dump
(
'accepted'
,
__CLASS__
.
'@'
.
__LINE__
,
20
);
}
die
;
}
...
...
Classes/Domain/Model/Dto/ElectionVoting.php
View file @
55977a28
<?php
namespace
TYPO3\Election\Domain\Model\Dto
;
/*
* 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!
*/
use
TYPO3\Election\Domain\Model\AbstractEntity
;
/**
* Class ElectionVoting
*/
class
ElectionVoting
class
ElectionVoting
extends
AbstractEntity
{
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\Election\Domain\Model\Nominee>
*/
protected
$nominees
=
null
;
protected
$nominees
;
/**
* @var \TYPO3\Election\Domain\Model\ElectionInvitation
*/
protected
$electionInvitation
;
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
...
...
@@ -26,4 +46,20 @@ class ElectionVoting
{
$this
->
nominees
=
$nominees
;
}
/**
* @return \TYPO3\Election\Domain\Model\ElectionInvitation
*/
public
function
getElectionInvitation
()
{
return
$this
->
electionInvitation
;
}
/**
* @param \TYPO3\Election\Domain\Model\ElectionInvitation $electionInvitation
*/
public
function
setElectionInvitation
(
$electionInvitation
)
{
$this
->
electionInvitation
=
$electionInvitation
;
}
}
Resources/Private/Partials/Model/Nominee/VoteList.html
View file @
55977a28
...
...
@@ -31,7 +31,7 @@
<f:link.page
pageUid=
"{nominee.url}"
>
{nominee.url}
</f:link.page>
</td>
<td>
<f:form.checkbox
property=
"nominees.
{nominee.uid}
"
value=
"{nominee.uid}"
/>
<f:form.checkbox
property=
"nominees."
value=
"{nominee.uid}"
/>
</td>
</tr>
</f:if>
...
...
Resources/Private/Templates/FeElection/Vote.html
View file @
55977a28
...
...
@@ -15,6 +15,7 @@
</f:translate>
</p>
<f:form
action=
"submitVote"
object=
"{electionVoting}"
objectName=
"electionVoting"
>
<f:form.hidden
property=
"electionInvitation"
value=
"{electionInvitation}"
/>
<f:render
partial=
"Model/Nominee/VoteList"
arguments=
"{nominees:electionInvitation.electionCircular.election.nominees}"
/>
<f:form.submit
value=
"vote"
/>
...
...
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