<?php

/**
* GK Image Show - view file
* @package Joomla!
* @Copyright (C) 2009-2012 Gavick.com
* @ All rights reserved
* @ Joomla! is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @ version $Revision: GK4 1.0 $
**/

// no direct access
defined('_JEXEC') or die;

jimport('joomla.utilities.string');

?>

<div id="gkIs-<?php echo $this->config['module_id'];?>" class="gkIsWrapper-gk_storebox">
	<div class="gkIsPreloader"></div>
	<div class="gkIsOverlay"></div>
	
	<?php for($i = 0; $i < count($this->config['image_show_data']); $i++) : ?>
	<?php if($this->config['image_show_data'][$i]->published) : ?>
		<?php 
			
			unset($path, $title, $link, $content);
			// creating slide path
			$path = $uri->root().'modules/mod_image_show_gk4/cache/'.GKIS_Storebox_Image::translateName($this->config['image_show_data'][$i]->image, $this->config['module_id']);
			$content = '';
			
            if($this->config['image_show_data'][$i]->type == "k2"){
              	if(isset($this->articlesK2[$this->config['image_show_data'][$i]->artK2_id])) {
              		$title = htmlspecialchars($this->articlesK2[$this->config['image_show_data'][$i]->artK2_id]["title"]);
              		$content = $title;
                	$link =  $this->articlesK2[$this->config['image_show_data'][$i]->artK2_id]["link"];
                } else {
                	$title = 'Selected article doesn\'t exist!';
                	$content = $title;
                	$link = '#';
                }
            } else {
                // creating slide title
				$title = htmlspecialchars(($this->config['image_show_data'][$i]->type == "text") ? $this->config['image_show_data'][$i]->name : $this->articles[$this->config['image_show_data'][$i]->art_id]["title"]);
				// creating slie content
				$content = ($this->config['image_show_data'][$i]->type == "text") ? $this->config['image_show_data'][$i]->content : $title;
				// creating slide link
				$link = ($this->config['image_show_data'][$i]->type == "text") ? $this->config['image_show_data'][$i]->url : $this->articles[$this->config['image_show_data'][$i]->art_id]["link"];	
			}
		?>
		<figure>
			<div class="gkIsSlide" style="z-index: <?php echo $i+1; ?>;" title="<?php echo $title; ?>"><?php echo $path; ?><a href="<?php echo $link; ?>">link</a></div>
			
			<?php if($this->config['config']->gk_storebox->gk_storebox_show_title_block && $content != '') : ?>	
			<figcaption<?php echo ' style="top: '.$this->config['config']->gk_storebox->gk_storebox_title_block_position_y.'%; left: '.$this->config['config']->gk_storebox->gk_storebox_title_block_position_x.'%; background: '.$this->config['config']->gk_storebox->gk_storebox_title_block_bg.'; color: '.$this->config['config']->gk_storebox->gk_storebox_title_block_color.';"'; ?>>
				<?php echo str_replace(array('[leftbracket]', '[rightbracket]'), array('<', '>'), $content); ?>
			</figcaption>
			<?php endif; ?>
		</figure>
	<?php endif; ?>
	<?php endfor; ?>
	
	<?php if($this->config['config']->gk_storebox->gk_storebox_pagination) : ?>
	<a href="#" class="gkIsPrev"><span>&laquo;</span></a>
	<a href="#" class="gkIsNext"><span>&raquo;</span></a>
	<?php endif; ?>
</div>