File: D:/HostingSpaces/SBogers59/ferrumbv.nl/wwwroot/lib/ui/gallery.class.php
<?php
/**
* Created by PhpStorm.
* User: mike
* Date: 08/10/14
* Time: 11:55
*/
class UI_Gallery
{
public function __construct($pageName){}
/*
* Create image list for gallery
*/
public function create($data)
{
$smallViewer = '';
$largeViewer = '';
// Prepare Data
$images = $data['images'][key($data['images'])];
$firstKey = (string)key($images);
// In case of one item
if($firstKey == '@attributes')
{
$images = array($images);
}
// Create the small viewer
foreach($images as $image)
{
$image = $image['@attributes'];
$smallViewer .= '<div class="swiper-slide">';
$smallViewer .= '<img src="' . $image['src'] . '" alt="' . $image['alt'] . '" />';
$smallViewer .= '</div>';
}
// Create the large viewer
foreach($images as $image)
{
$image = $image['@attributes'];
$largeViewer .= '<div class="swiper-slide">';
$largeViewer .= '<img src="' . $image['src-large'] . '" alt="' . $image['alt'] . '" />';
$largeViewer .= '</div>';
}
return array($smallViewer, $largeViewer);
}
}