HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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);
    }
}