<?php
/**
 * @version 7.4
 */
?>
<form action="" method="post">
    <?php echo $this->formElement('hidden', 'option', '')->render(); ?>
    <div class="table-responsive">
        <table class="table table-striped table-hover">
            <caption>
                <strong><?php echo $this->paginator->getPages()->totalItemCount; ?></strong> <?php echo $this->_('results found.'); ?>

                <?php if ($this->paginator->getPages()->totalItemCount) { ?>
                    <?php echo $this->_('Showing results'); ?>
                    <strong><?php echo $this->paginator->getPages()->firstItemNumber; ?></strong>
                    <?php echo $this->_('to'); ?>
                    <strong><?php echo $this->paginator->getPages()->lastItemNumber; ?></strong>
                <?php } ?>
            </caption>
            <?php if ($this->paginator->getPages()->totalItemCount) { ?>
                <thead>
                <tr>
                    <th class="size-tiny">
                        <?php echo $this->formElement('checkbox', 'selectAll')
                            ->setMultiOptions(array(1 => null))
                            ->render();
                        ?>
                    </th>
                    <th><?php echo $this->_('Listing'); ?></th>
                    <th class="size-mini"><?php echo $this->_('Added'); ?></th>
                    <!--                <th class="size-mini">--><?php //echo $this->_('Options'); ?><!--</th>-->
                </tr>
                </thead>
            <?php } ?>
            <tbody>
            <?php
            /** @var \Cube\Db\Table\Row $listingWatch */
            foreach ($this->paginator as $listingWatch) {
                /** @var \Ppb\Db\Table\Row\Listing $listing */
                $listing = $listingWatch->findParentRow('\Ppb\Db\Table\Listings');
                ?>
                <tr>
                    <td>
                        <?php echo $this->formElement('checkbox', 'id')
                            ->setMultiOptions(array($listing['id'] => null))
                            ->setAttributes(array('class' => 'select-all'))
                            ->setMultiple()
                            ->render();
                        ?>
                    </td>
                    <td>
                        <?php echo $this->partial('partials/listing-box.phtml', array(
                                'listing' => $listing));
                        ?>
                    </td>
                    <td>
                        <small><?php echo $this->date($listingWatch['created_at']); ?></small>
                    </td>
                </tr>
            <?php } ?>

            <?php if ($this->paginator->getPages()->totalItemCount) { ?>
                <tr>
                    <td colspan="3">
                        <div class="btn-group">
                            <button class="btn btn-default confirm-form" value="delete"
                                    data-message="<?php echo $this->_('Are you sure you want to remove the selected listings from your wishlist?'); ?>">
                                <?php echo $this->_('Delete'); ?>
                            </button>
                        </div>
                    </td>
                </tr>
            <?php } ?>
            </tbody>
        </table>
    </div>
</form>

<?php echo $this->pagination($this->paginator, 'sliding', 'partials/pagination.phtml'); ?>