From 410d2127ce3ec0412e8d4bd92429cc0afbe4098d Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Wed, 17 Dec 2014 23:43:06 +0100 Subject: [PATCH] admin: Add some work to poll information pane. --- adminstuds.php | 5 ++++- app/inc/i18n.php | 1 + css/frama.css | 2 +- studs.php | 6 ++++-- tpl/part/poll_info.tpl | 48 ++++++++++++++++++++++++++++++------------ 5 files changed, 45 insertions(+), 17 deletions(-) diff --git a/adminstuds.php b/adminstuds.php index ec82d51..11eb8eb 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -29,6 +29,7 @@ $admin_poll_id = null; $poll_id = null; $poll = null; $message = null; +$editingVoteId = 0; /* Services */ /*----------*/ @@ -58,7 +59,8 @@ $comments = $pollService->allCommentsByPollId($poll_id); // Assign data to template -$smarty->assign('poll_id', $admin_poll_id); +$smarty->assign('poll_id', $poll_id); +$smarty->assign('admin_poll_id', $admin_poll_id); $smarty->assign('poll', $poll); $smarty->assign('title', _('Poll') . ' - ' . $poll->title); $smarty->assign('slots', $pollService->splitSlots($slots)); @@ -67,5 +69,6 @@ $smarty->assign('best_moments', $pollService->computeBestMoments($votes)); $smarty->assign('comments', $comments); $smarty->assign('editingVoteId', $editingVoteId); $smarty->assign('message', $message); +$smarty->assign('admin', true); $smarty->display('studs.tpl'); \ No newline at end of file diff --git a/app/inc/i18n.php b/app/inc/i18n.php index 5040073..829206c 100644 --- a/app/inc/i18n.php +++ b/app/inc/i18n.php @@ -69,6 +69,7 @@ $lang = ($_SESSION['langue']!='') ? strtolower($_SESSION['langue']) : 'fr'; $date_format['txt_full'] = _("%A, den %e. %B %Y"); //summary in choix_date.php and removal date in choix_(date|autre).php $date_format['txt_short'] = "%A %e %B %Y"; // radio title $date_format['txt_day'] = "%a %e"; +$date_format['txt_date'] = _("%Y-%m-%d"); if (strtoupper(substr(PHP_OS,0,3))=='WIN'){ //%e can't be used on Windows platform, use %#d instead foreach($date_format as $k => $v) { $date_format[$k] = preg_replace('#(?updateVote($poll_id, $editedVote, $choices); if ($result) { $message = new Message('success', _('Update vote successfully.')); + // TODO Send mail to notify the poll admin } else { $message = new Message('danger', _('Update vote failed.')); } @@ -101,6 +101,7 @@ if (!empty($_POST['save'])) { // Save edition of an old vote $result = $pollService->addVote($poll_id, $name, $choices); if ($result) { $message = new Message('success', _('Update vote successfully.')); + // TODO Send mail to notify the poll admin } else { $message = new Message('danger', _('Update vote failed.')); } @@ -147,5 +148,6 @@ $smarty->assign('best_moments', $pollService->computeBestMoments($votes)); $smarty->assign('comments', $comments); $smarty->assign('editingVoteId', $editingVoteId); $smarty->assign('message', $message); +$smarty->assign('admin', false); $smarty->display('studs.tpl'); diff --git a/tpl/part/poll_info.tpl b/tpl/part/poll_info.tpl index d0108e1..997b42a 100644 --- a/tpl/part/poll_info.tpl +++ b/tpl/part/poll_info.tpl @@ -1,27 +1,32 @@ -
+{* TODO Add a form maybe *} +

{$poll->title}

- - {_('Export to CSV')} + + {_('Export to CSV')} + {if $admin|default:false} + + + {/if}
-
-
-

{_("Initiator of the poll")}

-

{$poll->admin_name}

-
- +
+

{_("Initiator of the poll")}

+

{$poll->admin_name}

- {if !empty($poll->comment)}

{_("Description")}


@@ -29,4 +34,21 @@
{/if}
+ +
+ + {if $admin} + +
+

{_("Expiration's date")}

+

{$poll->end_date|date_format:$date_format['txt_date']}

+
+ {/if} +
\ No newline at end of file