PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/media/widgetkit/widgets/gallery/styles/showcase_box/template.php

https://bitbucket.org/organicdevelopment/joomla-2.5
PHP | 84 lines | 58 code | 17 blank | 9 comment | 7 complexity | 23188906d5dfb35c5fdbcf0c7e2ed82c MD5 | raw file
Possible License(s): LGPL-3.0, GPL-2.0, MIT, BSD-3-Clause, LGPL-2.1
  1. <?php
  2. /**
  3. * @package Widgetkit
  4. * @author YOOtheme http://www.yootheme.com
  5. * @copyright Copyright (C) YOOtheme GmbH
  6. * @license http://www.gnu.org/licenses/gpl.html GNU/GPL
  7. */
  8. $widget_id = $widget->id.'-'.uniqid();
  9. $settings = $widget->settings;
  10. $captions = array();
  11. $images = $this['gallery']->images($widget);
  12. $thumbs = $this['gallery']->images($widget, array('width' => $settings['thumb_width'], 'height' => $settings['thumb_height']));
  13. $sets = array_chunk($thumbs, $settings['items_per_set']);
  14. foreach (array_keys($sets) as $s) {
  15. $nav[] = '<li><span></span></li>';
  16. }
  17. $i = 0;
  18. ?>
  19. <?php if (count($images)) : ?>
  20. <div id="gallery-<?php echo $widget_id; ?>" class="wk-gallery-showcasebox" data-widgetkit="showcase" data-options='<?php echo json_encode($settings); ?>'>
  21. <div id="slideshow-<?php echo $widget_id; ?>" class="wk-slideshow">
  22. <div class="slides-container">
  23. <ul class="slides">
  24. <?php foreach ($images as $image) : ?>
  25. <?php
  26. $captions[] = '<li>'.(strlen($image['caption']) ? $image['caption']:"").'</li>';
  27. /* Prepare Image */
  28. $content = '<img src="'.$image['cache_url'].'" width="'.$image['width'].'" height="'.$image['height'].'" alt="'.$image['filename'].'" />';
  29. /* Lazy Loading */
  30. $content = ($i==$settings['index']) ? $content : $this['image']->prepareLazyload($content);
  31. ?>
  32. <?php if ($image['link']) : ?>
  33. <li><a class="" href="<?php echo $image['link'] ? $image['link'] : $image['url']; ?>"><?php echo $content; ?></a></li>
  34. <?php else : ?>
  35. <li><?php echo $content; ?></li>
  36. <?php endif; ?>
  37. <?php $i=$i+1;?>
  38. <?php endforeach; ?>
  39. </ul>
  40. <?php if ($settings['buttons']): ?><div class="next"></div><div class="prev"></div><?php endif; ?>
  41. <div class="caption"></div><ul class="captions"><?php echo implode('', $captions);?></ul>
  42. </div>
  43. </div>
  44. <div id="slideset-<?php echo $widget_id;?>" class="wk-slideset <?php if (!$settings['slideset_buttons']) echo 'no-buttons'; ?>">
  45. <div>
  46. <div class="sets">
  47. <?php foreach ($sets as $set => $items) : ?>
  48. <ul class="set">
  49. <?php foreach ($items as $thumb) : ?>
  50. <?php
  51. /* Prepare Image */
  52. $content = '<img src="'.$thumb['cache_url'].'" width="'.$thumb['width'].'" height="'.$thumb['height'].'" alt="'.$thumb['filename'].'" />';
  53. ?>
  54. <li>
  55. <div><div><?php echo $content; ?></div></div>
  56. </li>
  57. <?php endforeach; ?>
  58. </ul>
  59. <?php endforeach; ?>
  60. </div>
  61. <?php if ($settings['slideset_buttons']): ?><div class="next"></div><div class="prev"></div><?php endif; ?>
  62. </div>
  63. </div>
  64. </div>
  65. <?php else : ?>
  66. <?php echo "No images found."; ?>
  67. <?php endif;