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
4704237c
Commit
4704237c
authored
Mar 14, 2020
by
Marco Huber
Browse files
List election invitations in elector profile and resend them
parent
9ba0081b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/BeElectorController.php
View file @
4704237c
...
...
@@ -13,6 +13,10 @@ namespace T3o\Election\Controller;
*
* The TYPO3 project - inspiring people to share!
*/
use
T3o\Election\Domain\Model\ElectionInvitation
;
use
T3o\Election\Service\ElectionInvitationService
;
use
TYPO3\CMS\Core\Messaging\AbstractMessage
;
use
TYPO3\CMS\Extbase\Persistence\ObjectStorage
;
use
T3o\Election\Domain\Model\Dto\ElectorImport
as
ElectorImportDto
;
use
T3o\Election\Domain\Model\Election
;
...
...
@@ -20,6 +24,7 @@ use T3o\Election\Domain\Model\Elector;
use
T3o\Election\Domain\Model\ElectorImport
;
use
T3o\Election\Utility\CsvUtility
;
use
T3o\Election\Utility\FileUtility
;
use
TYPO3\CMS\Extbase\Utility\LocalizationUtility
;
/**
* Class BeConfigurationController
...
...
@@ -38,6 +43,7 @@ class BeElectorController extends AbstractProtectedBeController
const
ACTION_UPLOAD
=
'upload'
;
const
ACTION_PROCESS_IMPORT
=
'processImport'
;
const
ACTION_OVERWRITE_ALL
=
'overwriteAll'
;
const
ACTION_RESEND_ELECTION_INVITATION
=
'resendElectionInvitation'
;
/**
* @var \T3o\Election\Domain\Repository\ElectorateRepository
...
...
@@ -179,6 +185,26 @@ class BeElectorController extends AbstractProtectedBeController
$this
->
redirect
(
self
::
ACTION_LIST
);
}
/**
* @param Elector $elector
* @param ElectionInvitation $electionInvitation
*/
public
function
resendElectionInvitationAction
(
Elector
$elector
,
ElectionInvitation
$electionInvitation
){
/** @var ElectionInvitationService $electionInvitationService */
$electionInvitationService
=
$this
->
objectManager
->
get
(
ElectionInvitationService
::
class
);
$electionInvitationService
->
resendElectionInvitation
(
$this
->
configuration
,
$electionInvitation
);
$labelKey
=
$electionInvitation
->
isSuccess
()
?
'view.be.elector.edit.election_invitaion_resend_body_success'
:
'view.be.elector.edit.election_invitaion_resend_body_failure'
;
$severity
=
$electionInvitation
->
isSuccess
()
?
AbstractMessage
::
OK
:
AbstractMessage
::
ERROR
;
$this
->
addFlashMessage
(
LocalizationUtility
::
translate
(
$labelKey
,
$this
->
extensionName
),
LocalizationUtility
::
translate
(
'view.be.elector.edit.election_invitaion_resend_title'
,
$this
->
extensionName
),
$severity
);
$this
->
redirect
(
self
::
ACTION_EDIT
,
self
::
CONTROLLER_NAME
,
'election'
,
[
'elector'
=>
$elector
]);
}
/**
* @return string
*/
...
...
@@ -198,6 +224,7 @@ class BeElectorController extends AbstractProtectedBeController
self
::
ACTION_UPLOAD
,
self
::
ACTION_PROCESS_IMPORT
,
self
::
ACTION_OVERWRITE_ALL
,
self
::
ACTION_RESEND_ELECTION_INVITATION
,
]
);
}
...
...
Classes/Service/ElectionInvitationService.php
View file @
4704237c
...
...
@@ -59,6 +59,17 @@ class ElectionInvitationService
}
}
/**
* @param Configuration $configuration
* @param ElectionInvitation $electionInvitation
*/
public
function
resendElectionInvitation
(
Configuration
$configuration
,
ElectionInvitation
$electionInvitation
)
{
$electionInvitation
->
setSuccess
(
$this
->
sendElectionInvitation
(
$configuration
,
$electionInvitation
));
$this
->
electionInvitationRepository
->
update
(
$electionInvitation
);
$this
->
electionInvitationRepository
->
persistAll
();
}
/**
* @param Configuration $configuration
* @param ElectionInvitation $electionInvitation
...
...
Resources/Private/Language/locallang.xlf
View file @
4704237c
...
...
@@ -117,6 +117,15 @@
<trans-unit
id=
"view.be.dashboard.index.no_electionmanagergroup_msg_body"
>
<source>
Please add an election group in your configuration.
</source>
</trans-unit>
<trans-unit
id=
"view.be.elector.edit.election_invitaion_resend_title"
>
<source>
Resend election invitation
</source>
</trans-unit>
<trans-unit
id=
"view.be.elector.edit.election_invitaion_resend_body_success"
>
<source>
Election invitation has been resent!
</source>
</trans-unit>
<trans-unit
id=
"view.be.elector.edit.election_invitaion_resend_body_failure"
>
<source>
ERROR: Election invitation has NOT been resent!
</source>
</trans-unit>
...
...
Resources/Private/Partials/Model/Elector/FormFields/ElectionInvitation.html
0 → 100644
View file @
4704237c
<fieldset
class=
"form-section"
>
<div
class=
"form-group"
>
<label>
<f:translate
key=
"model.elector.field.electionInvitations"
>
Election Invitations
</f:translate>
</label>
<div
class=
"form-control-wrap"
style=
"max-width: 480px"
>
<f:if
condition=
"{elector.electionInvitations}"
>
<f:then>
<table
class=
"table"
>
<thead>
<th>
Election Circular
</th>
<th>
Sent
</th>
<th>
Voted
</th>
<th></th>
</thead>
<tbody>
<f:for
each=
"{elector.electionInvitations}"
as=
"electionInvitation"
>
<tr>
<td>
{electionInvitation.electionCircular.subject}
</td>
<td>
{f:if(condition:'{electionInvitation.success}',then:'yes',else:'no')}
</td>
<td>
{f:if(condition:'{electionInvitation.voted}',then:'yes',else:'no')}
</td>
<td>
<f:if
condition=
"{electionInvitation.voted}"
>
<f:then></f:then>
<f:else>
<f:link.action
action=
"resendElectionInvitation"
arguments=
"{elector:elector, electionInvitation:electionInvitation}"
class=
"btn btn-default"
>
<core:icon
identifier=
"actions-move-right"
/>
resend election invitation
</f:link.action>
</f:else>
</f:if>
</td>
</tr>
</f:for>
</tbody>
</table>
</f:then>
<f:else>
<f:translate
key=
"model.elector.field.electionInvitations_empty"
>
There are no election invitations
</f:translate>
</f:else>
</f:if>
</div>
</div>
</fieldset>
\ No newline at end of file
Resources/Private/Partials/Model/Elector/Forms/EditForm.html
View file @
4704237c
...
...
@@ -4,3 +4,4 @@
<f:render
partial=
"Model/AbsctractPerson/FormFields/Gender"
arguments=
"{object:elector}"
/>
<f:render
partial=
"Model/AbsctractPerson/FormFields/Email"
/>
<f:render
partial=
"Model/Elector/FormFields/Electorates"
arguments=
"{elector:elector,electorates:electorates}"
/>
<f:render
partial=
"Model/Elector/FormFields/ElectionInvitation"
arguments=
"{elector:elector}"
/>
\ No newline at end of file
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