<?php

/**
 * @name          : Joomla Social Pinboard
 * @version	  : 1.5.0
 * @package       : apptha
 * @since         : Joomla 1.5
 * @author        : Apptha - http://www.apptha.com
 * @copyright     : Copyright (C) 2011 Powered by Apptha
 * @license       : http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 * @abstract      : Social Pinboard Module related catalogues
 * @Creation Date : August 2013
 * @Modified Date : March 2014
 * */
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>

<div class='wwya-title'>
	<h2><?php echo JText::_('MOD_WISHLOGUE_RELATED_CATALOGUES'); ?></h2>
	<h3><i>*</i></h3>
</div>

<?php
$one = $other = '';
$rows = $Related_Wishes[0];

foreach ($rows as $key => $row)
{
    if ($row->link_type == 'youtube' || $row->link_type == 'vimeo') {
        $rowPinImage = $row->pin_image;
    } else {
		$rowPinImage = JURI::base() . "/images/wishlogue/wish_medium/" . rawurldecode($row->pin_image);
    }

	$pin_link = '';
	if ( $row->pin_id != -1 ) {
		$pin_link = JRoute::_('index.php?option=com_wishlogue&view=wish&pinid=' . $row->pin_id, true);
		$pin_link = " href='$pin_link' ";
	}

    if ($key == 0) {
		$img_Res = ModRelatedPinsHelper::getImageResolution($rowPinImage, 185, 127);
		$height = $img_Res['height'];
		$width = $img_Res['width'];
        $one = "<a class='OneImage' $pin_link ><img height='$height' width='$width' src='$rowPinImage'></a>";
    } else {
		$img_Res = ModRelatedPinsHelper::getImageResolution($rowPinImage, 60, 60);
		$height = $img_Res['height'];
		$width = $img_Res['width'];
        $other .= "<a class='OtherImage' $pin_link ><img height='$height' width='$width' src='$rowPinImage'></a>";
    }
}

?>

<div class="wwyaleft-board clearfix">

	<form action="<?php echo JRoute::_('index.php?option=com_wishlogue&amp;view=home', true); ?>" method="post" id='menu_cat_sub'>
	<input type='hidden' value='<?php echo $Related_Wishes[1]->category_id; ?>' name='cat_id' id='cat_id'>
	<p class="ttpins">
		<a href="javascript:void(0);" onclick="document.getElementById('menu_cat_sub').submit();">
			<?php echo strtoupper($Related_Wishes[1]->category_name) . '<font>*</font>' . strtoupper(JText::_('COM_WISHLOGUE_LOGUES')); ?>
		</a>
	</p>
	</form>

	<p class="ttpins">
		<?php
			echo $Related_Wishes[2];
			if ( $Related_Wishes[2] <= 1 ) {
				echo ' ' . JText::_('COM_WISHLOGUE_PIN');
			} else {
				echo ' ' . JText::_('COM_WISHLOGUE_PINS');
			}
		?>
	</p>
	<?php echo $one; ?>
	<div class="rightthree-wwya"><?php echo $other; ?></div>

</div>