From ad5ea9c6ffbd7b3f712459ec5a1058c08c466bbe Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Mon, 15 Dec 2014 13:49:25 +0100 Subject: [PATCH] Display list of comments + Display form to add a comment --- studs.php | 2 ++ tpl/studs.tpl | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/studs.php b/studs.php index 87f8a46..27f3c86 100644 --- a/studs.php +++ b/studs.php @@ -84,6 +84,7 @@ if (!$poll) { // Retrieve data $slots = $connect->allSlotsByPollId($poll_id); $votes = $connect->allUserVotesByPollId($poll_id); +$comments = $connect->allCommentsByPollId($poll_id); // Assign data to template $smarty->assign('poll_id', $poll_id); @@ -92,6 +93,7 @@ $smarty->assign('title', _('Poll') . ' - ' . $poll->title); $smarty->assign('slots', split_slots($slots)); $smarty->assign('votes', split_votes($votes)); $smarty->assign('best_moments', computeBestMoments($votes)); +$smarty->assign('comments', $comments); $smarty->assign('editingVoteId', 0); // TODO Replace by the right ID //Utils::debug(computeBestMoments($votes));exit; diff --git a/tpl/studs.tpl b/tpl/studs.tpl index c4167e9..9df42d0 100644 --- a/tpl/studs.tpl +++ b/tpl/studs.tpl @@ -258,5 +258,39 @@ {/if} + {* Comments *} + + {if $poll->active} +
+ + {* Comment list *} + + {if $comments|count > 0} + {foreach $comments as $comment} +
+ {$comment->usercomment}  + {nl2br($comment->comment)} +
+ {/foreach} + {/if} + + {* Add comment form *} + +
+
+
{_("Add a comment in the poll")} +
+

+
+
+


+

+
+

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