listings.phtml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * @version 7.10 [rev.7.10.01]
  4. */
  5. /** @var \Ppb\Db\Table\Rowset\Listings $listings */
  6. /** @var string $class */
  7. /** @var bool $carousel */
  8. if (count($listings) > 0) {
  9. $carouselId = 'carousel' . ucfirst($params['type']);
  10. $nbListings = count($listings);
  11. $counter = 0;
  12. $active = 'active';
  13. ?>
  14. <div id="<?php echo $carouselId; ?>" class="carousel slide">
  15. <div class="carousel-inner">
  16. <?php foreach ($listings as $listing) { ?>
  17. <?php if ($carousel && (($counter % 4) == 0)) { ?>
  18. <div class="item <?php echo $active; ?>">
  19. <?php $active = null; ?>
  20. <?php } ?>
  21. <?php
  22. echo $this->partial('partials/listing-box.phtml', array(
  23. 'listing' => $listing,
  24. 'class' => $class,
  25. )); ?>
  26. <?php if ($carousel && ((++$counter % 4) == 0 || $counter >= $nbListings)) { ?>
  27. </div>
  28. <?php } ?>
  29. <?php } ?>
  30. </div>
  31. <?php if ($carousel) { ?>
  32. <a class="left carousel-control" href="#<?php echo $carouselId; ?>" data-slide="prev">
  33. <span class="glyphicon glyphicon-chevron-left"></span>
  34. </a>
  35. <a class="right carousel-control" href="#<?php echo $carouselId; ?>" data-slide="next">
  36. <span class="glyphicon glyphicon-chevron-right"></span>
  37. </a>
  38. <?php } ?>
  39. </div>
  40. <?php } ?>