<?php
$this->css([
    $this->assetModule('script/block.css'),
]);
$this->jQuery();
?>

<div class="pi-article-module">
    <div class="clearfix pi-block-header">
        <span class="pi-block-title float-left"><?php echo $this->escape($title) . '"' . $keyword . '"'; ?></span>
        <span class="text-muted col-md-2" style="margin-top: 5px">
            (<?php echo $this->escape($count) . __(' articles'); ?>)
        </span>
        <div class="row" style="margin-right: -30px">
            <?php
            $form->setAttributes([
                'action' => $this->url('', ['action' => 'simple']),
                'method' => 'get',
                'class'  => 'form-inline navbar-right',
                'style'  => 'margin: 1px 10px 0 0; width: auto',
            ]);
            echo $this->form()->openTag($form);
            ?>
            <div class="form-group">
                <?php
                $element = $form->get('keyword');
                $element->setAttributes([
                    'class'       => 'form-control col-md-7',
                    'placeholder' => __('title'),
                ]);
                echo $this->formElement($element);
                ?>
            </div>
            <button type="submit" class="btn"><?php _e('Search'); ?></button>
            <?php echo $this->form()->closeTag(); ?>
        </div>
    </div>
    <div class="article-list-content">
        <ul class="list list14" id="jsList">
            <?php $index = 0 ?>
            <?php foreach ($articles as $article) {
                $index++ ?>
                <li class="text-muted">
                    <div class="list-hover">
                        <span class="float-right article-list-desc">
                            <?php echo _date($article['time_publish']); ?>
                        </span>
                        <a class="article-list-title" target="_blank" href="<?php echo $article['url'] ?>"
                           title="<?php echo $this->escape($article['subject']); ?>" style="color: #333333">
                            <?php echo $this->escape($article['subject']); ?>
                        </a>
                    </div>
                </li>
                <?php if ($index % 5 == 0) { ?>
                    <li class="dashed"></li>
                <?php } ?>
            <?php } ?>
        </ul>
        <div style="text-align: center">
            <?php echo $this->paginationControl($paginator, 'Sliding', 'paginator.phtml'); ?>
        </div>
    </div>
</div>
<script>
    $(".article-list-content").find(".dashed:last").css("height", "0");
</script>
