Refactor and fix indentation a bit, add a <pre> section for email collection and string changes
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
68d5b64180
commit
abec2cb6a3
@ -80,7 +80,7 @@ $messagePollCreated = $sessionService->get("Framadate", "messagePollCreated", FA
|
||||
|
||||
if ($messagePollCreated) {
|
||||
$sessionService->remove("Framadate", "messagePollCreated");
|
||||
|
||||
|
||||
$message = new Message('success', __('adminstuds', 'The poll is created.'));
|
||||
}
|
||||
|
||||
@ -417,28 +417,21 @@ if (isset($_GET['collect_mail'])) {
|
||||
$column_str = strval(Utils::base64url_decode($column_str));
|
||||
$column = intval($column_str);
|
||||
$votes = $pollService->splitVotes($pollService->allVotesByPollId($poll_id));
|
||||
$mails_yes = [];
|
||||
$mails_ifneedbe = [];
|
||||
$mails_no = [];
|
||||
$size = count($votes);
|
||||
for ($i = 0; $i < $size; $i++)
|
||||
{
|
||||
if(intval($votes[$i]->choices[$column]) === 2 && $votes[$i]->mail !== NULL) {
|
||||
$mails_yes[]=$votes[$i]->mail;
|
||||
$mails_yes = $mails_ifneedbe = $mails_no = [];
|
||||
foreach ($votes as $vote) {
|
||||
if (intval($vote->choices[$column]) === 2 && $vote->mail !== NULL) {
|
||||
$mails_yes[] = $vote->mail;
|
||||
} elseif (intval($vote->choices[$column]) === 1 && $vote->mail !== NULL) {
|
||||
$mails_ifneedbe[] = $vote->mail;
|
||||
} elseif($vote->mail !== NULL) {
|
||||
$mails_no[] = $vote->mail;
|
||||
}
|
||||
else {
|
||||
if(intval($votes[$i]->choices[$column]) === 1 && $votes[$i]->mail !== NULL) {
|
||||
$mails_ifneedbe[]=$votes[$i]->mail;
|
||||
}
|
||||
elseif($votes[$i]->mail !== NULL) {
|
||||
$mails_no[]=$votes[$i]->mail;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign('poll_id', $poll_id);
|
||||
$smarty->assign('admin_poll_id', $admin_poll_id);
|
||||
$smarty->assign('admin', true);
|
||||
$smarty->assign('title', __('Generic', 'Poll') . ' - ' . $poll->title . ' - ' . __('adminstuds', 'Collect the emails of the polled users for this column'));
|
||||
$smarty->assign('title', __('Generic', 'Poll') . ' - ' . $poll->title . ' - ' . __('adminstuds', 'Collect the emails of the polled users for the choice'));
|
||||
$smarty->assign('mails_yes', $mails_yes);
|
||||
$smarty->assign('mails_ifneedbe', $mails_ifneedbe);
|
||||
$smarty->assign('mails_no', $mails_no);
|
||||
|
@ -458,11 +458,11 @@
|
||||
"Your vote has been registered successfully, but be careful: regarding this poll options, you need to keep this personal link to edit your own vote:": "Your vote has been saved, but please note: you need to keep this personalised link to be able to edit your vote."
|
||||
},
|
||||
"display_mails": {
|
||||
"People who have answered 'Yes' to this option have not left any email addresses." : "People who have answered 'Yes' to this option have not left any email addresses.",
|
||||
"People who have answered 'If need be' to this option have not left any email addresses." : "People who have answered 'If need be' to this option have not left any email addresses.",
|
||||
"People who have answered 'No' to this option have not left any email addresses." : "People who have answered 'No' to this option have not left any email addresses.",
|
||||
"People who have answered 'Yes' to this option have left those email addresses :" : "People who have answered 'Yes' to this option have left those email addresses :",
|
||||
"People who have answered 'If need be' to this option have left those email addresses :" : "People who have answered 'If need be' to this option have left those email addresses :",
|
||||
"People who have answered 'No' to this option have left those email addresses :" : "People who have answered 'No' to this option have left those email addresses :"
|
||||
"No one voted 'Yes' to this option." : "No one voted 'Yes' to this option.",
|
||||
"No one voted 'If need be' to this option." : "No one voted 'If need be' to this option.",
|
||||
"No one voted 'No' to this option." : "No one voted 'No' to this option.",
|
||||
"People who have answered 'Yes' to this option have left these email addresses:" : "People who have answered 'Yes' to this option have left these email addresses:",
|
||||
"People who have answered 'If need be' to this option have left these email addresses:" : "People who have answered 'If need be' to this option have left these email addresses:",
|
||||
"People who have answered 'No' to this option have left these email addresses:" : "People who have answered 'No' to this option have left these email addresses:"
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,45 @@
|
||||
{extends file='page.tpl'}
|
||||
|
||||
{block name=main}
|
||||
<body>
|
||||
<main>
|
||||
{if ($mails_yes|count) === 0}
|
||||
{__('display_mails', "People who have answered 'Yes' to this option have not left any email addresses.")}</br>
|
||||
{__('display_mails', "No one voted 'Yes' to this option.")}</br>
|
||||
{else}
|
||||
{__('display_mails', "People who have answered 'Yes' to this option have left those email addresses :")}</br>
|
||||
{foreach $mails_yes as $mail}
|
||||
<strong>{$mail|html}</strong> </br>
|
||||
{/foreach}
|
||||
{__('display_mails', "People who have answered 'Yes' to this option have left these email addresses:")}</br>
|
||||
{strip}
|
||||
<pre>
|
||||
{foreach $mails_yes as $mail}
|
||||
{$mail|html}<br />
|
||||
{/foreach}
|
||||
</pre>
|
||||
{/strip}
|
||||
{/if}
|
||||
</br>
|
||||
<br />
|
||||
{if ($mails_ifneedbe|count) === 0}
|
||||
{__('display_mails', "People who have answered 'If need be' to this option have not left any email addresses.")}</br>
|
||||
{__('display_mails', "No one voted 'If need be' to this option.")}</br>
|
||||
{else}
|
||||
{__('display_mails', "People who have answered 'If need be' to this option have left those email addresses :")}</br>
|
||||
{foreach $mails_ifneedbe as $mail}
|
||||
<strong>{$mail|html}</strong> </br>
|
||||
{/foreach}
|
||||
{__('display_mails', "People who have answered 'If need be' to this option have left these email addresses:")}</br>
|
||||
{strip}
|
||||
<pre>
|
||||
{foreach $mails_ifneedbe as $mail}
|
||||
{$mail|html}<br />
|
||||
{/foreach}
|
||||
</pre>
|
||||
{/strip}
|
||||
{/if}
|
||||
</br>
|
||||
<br />
|
||||
{if ($mails_no|count) === 0}
|
||||
{__('display_mails', "People who have answered 'No' to this option have not left any email addresses.")}</br>
|
||||
{__('display_mails', "No one voted 'No' to this option.")}</br>
|
||||
{else}
|
||||
{__('display_mails', "People who have answered 'No' to this option have left those email addresses :")}</br>
|
||||
{foreach $mails_no as $mail}
|
||||
<strong>{$mail|html}</strong> </br>
|
||||
{/foreach}
|
||||
{__('display_mails', "People who have answered 'No' to this option have left these email addresses:")}</br>
|
||||
{strip}
|
||||
<pre>
|
||||
{foreach $mails_no as $mail}
|
||||
{$mail|html}<br />
|
||||
{/foreach}
|
||||
</pre>
|
||||
{/strip}
|
||||
{/if}
|
||||
</br>
|
||||
<br />
|
||||
<a href="{poll_url id=$admin_poll_id admin=true}" class="btn btn-default" name="back">{__('adminstuds', 'Back to the poll')}</a>
|
||||
</body>
|
||||
{/block}
|
||||
|
Loading…
Reference in New Issue
Block a user