2014-02-01 11:17:02 +01:00
|
|
|
<?php
|
|
|
|
LayoutHelper::setSubTitle('comments');
|
|
|
|
?>
|
|
|
|
|
2013-10-17 22:57:32 +02:00
|
|
|
<?php if (empty($this->context->transport->comments)): ?>
|
|
|
|
<p class="alert alert-warning">No comments to show.</p>
|
|
|
|
<?php else: ?>
|
2014-02-01 11:17:02 +01:00
|
|
|
<?php
|
|
|
|
LayoutHelper::addStylesheet('comment-list.css');
|
|
|
|
LayoutHelper::addStylesheet('comment-small.css');
|
|
|
|
LayoutHelper::addStylesheet('comment-edit.css');
|
|
|
|
LayoutHelper::addScript('comment-edit.js');
|
|
|
|
?>
|
|
|
|
|
2014-01-25 16:34:20 +01:00
|
|
|
<div class="comments-wrapper">
|
|
|
|
<div class="comments paginator-content">
|
|
|
|
<?php
|
|
|
|
$groups = [];
|
|
|
|
$posts = [];
|
|
|
|
$currentGroupPostId = null;
|
|
|
|
$currentGroup = null;
|
|
|
|
foreach ($this->context->transport->comments as $comment)
|
2013-10-17 22:57:32 +02:00
|
|
|
{
|
2014-01-25 16:34:20 +01:00
|
|
|
if ($comment->postId != $currentGroupPostId)
|
|
|
|
{
|
|
|
|
unset($currentGroup);
|
|
|
|
$currentGroup = [];
|
|
|
|
$currentGroupPostId = $comment->postId;
|
|
|
|
$posts[$comment->postId] = $comment->getPost();
|
|
|
|
$groups[] = &$currentGroup;
|
|
|
|
}
|
|
|
|
$currentGroup []= $comment;
|
2013-10-17 22:57:32 +02:00
|
|
|
}
|
2014-01-25 16:34:20 +01:00
|
|
|
?>
|
|
|
|
<?php foreach ($groups as $group): ?>
|
|
|
|
<div class="comment-group">
|
|
|
|
<div class="post-wrapper">
|
|
|
|
<?php $this->context->post = $posts[reset($group)->postId] ?>
|
|
|
|
<?php echo $this->renderFile('post-small') ?>
|
|
|
|
</div>
|
|
|
|
<div class="comments">
|
|
|
|
<?php foreach ($group as $comment): ?>
|
|
|
|
<?php $this->context->comment = $comment ?>
|
|
|
|
<?php echo $this->renderFile('comment-small') ?>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
2013-10-17 22:57:32 +02:00
|
|
|
</div>
|
2014-01-25 16:34:20 +01:00
|
|
|
<?php endforeach ?>
|
|
|
|
</div>
|
2013-10-17 22:57:32 +02:00
|
|
|
|
2014-01-25 16:34:20 +01:00
|
|
|
<?php $this->renderFile('paginator') ?>
|
|
|
|
</div>
|
2013-10-17 22:57:32 +02:00
|
|
|
<?php endif ?>
|