<?php
/**
* Icons Module
* Version		: 1.0
* Created by	: joomla2you
* Email			: info@joomla2you.com
* URL			: www.joomla2you.com
* License GPLv2.0 - http://www.gnu.org/licenses/gpl-2.0.html
*/

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

$doc = JFactory::getDocument();
$bg_img 	= $params->get('bg_img', '' );
$main_text 	= $params->get('main_text', '' );
$se_style 	= $params->get('se_style', '' );
$se_padd 	= $params->get('se_padd', '' );
$bg_color 	= $params->get('bg_color', '' );
// Load CSS/JS
$doc->addStyleSheet (JURI::base() . 'modules/mod_ju_coolicons/media/css/style.css' );
$doc->addStyleSheet (JURI::base() . 'modules/mod_ju_coolicons/media/flaticon/flaticon.css' );
$doc->addStyleDeclaration('#juiconsol'.$ju_moduleid.' .sector-side-image {background-color:'. $bg_color .';}');

// Styling from module parameters
$ju_css = '
#juiconsol' . $ju_moduleid . ' { margin-top:' . $ju_marg_top . 'px; position:relative;}
#juiconsol' . $ju_moduleid . ' #service {display: inline-block; width:' . $ju_image_width . ';padding:' . ($ju_image_margin_x / 2) . 'px ;box-sizing: border-box;}
#juiconsol' . $ju_moduleid . ' .ju-coolicons.type1, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type2, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type3, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type4, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type5, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type6, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type7, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type8, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type9, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type10 {color:' . $ju_text_color . '; background-color: ' . $ju_overlay_color . ';  }
#juiconsol' . $ju_moduleid . ' .ju-coolicons.type1:hover .icon, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type2:hover .icon, #juiconsol' . $ju_moduleid . ' .ju-coolicons.type2:hover .link,#juiconsol' . $ju_moduleid . ' .ju-coolicons.type3 .icon span,#juiconsol' . $ju_moduleid . ' .ju-coolicons.type4:hover .icon,#juiconsol' . $ju_moduleid . ' .ju-coolicons.type4:hover .dt-sc-button:after,#juiconsol' . $ju_moduleid . ' .ju-coolicons.type4:hover .dt-sc-button,#juiconsol' . $ju_moduleid . ' .ju-coolicons.type7:hover .icon,#juiconsol' . $ju_moduleid . ' .ju-coolicons.type8 .icon,#juiconsol' . $ju_moduleid . ' .ju-coolicons.type9 .icon:before,#juiconsol' . $ju_moduleid . ' .ju-coolicons.type10 .icon{background:' . $ju_custom_color . ';}
@media only screen and (min-width: 960px) and (max-width: 1280px) {#juiconsol' . $ju_moduleid . ' #service {width:' . $ju_image_width_tabl . ';}}
@media only screen and (min-width: 768px) and (max-width: 959px) {#juiconsol' . $ju_moduleid . ' #service {width:' . $ju_image_width_tabp . ';}}
@media only screen and ( max-width: 767px ) {#juiconsol' . $ju_moduleid . ' #service {width:' . $ju_image_width_mobl . ';}}
@media only screen and (max-width: 440px) {#juiconsol' . $ju_moduleid . ' #service {width:' . $ju_image_width_mobp . ';}}
';
// Put styling in header
$doc->addStyleDeclaration($ju_css);
?>
<div id="juiconsol<?php echo $ju_moduleid; ?>">
<?php if ($params->get('se_style') != ''): ?>
<div class="sector-side-image clearfix">
        <div class="col-md-8 col-md-offset-0 col-sm-8 col-sm-offset-0 text-inner-3 clearfix align-left">
          <div class="text-box padding-2">
          <?php echo $main_text; ?> 
<?php foreach ($imagehover_images as $item) : ?>
<div id="service">
<div class="ju-coolicons <?php echo $item->ju_type; ?>">
<div class="icon"><span <?php if (!empty($item->ju_styles)) : ?> class="fa flaticon-<?php echo $item->ju_image; ?>" <?php endif;?> ><?php if (empty($item->ju_styles)) : ?><img src="<?php echo $item->ju_img; ?>"> <?php endif;?></span> </div>
<h5><?php if (!empty($item->ju_target_url)) : ?><a href="<?php echo $item->ju_target_url; ?>" target="<?php echo $ju_target; ?>"><?php endif; ?> <?php echo $item->ju_title; ?> <?php if (!empty($item->ju_target_url)) : ?></a><?php endif; ?></h5>
<?php if ($item->ju_text != '') : ?><p><?php echo $item->ju_text; ?></p><?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
  </div>
    <div class="img-holder col-md-4 col-sm-4 pull-left">
      <div class="background-imgholder" style="background:url(<?php echo $bg_img; ?>);"> <img class="nodisplay-image" src="<?php echo $bg_img; ?>" alt=""> </div>
    </div>
</div>
<?php else: ?>
<div class="sector-side-image clearfix">
             <?php echo $main_text; ?><?php foreach ($imagehover_images as $item) : ?>
<div id="service">
<div class="ju-coolicons <?php echo $item->ju_type; ?>">
<div class="icon"><span <?php if (!empty($item->ju_styles)) : ?> class="fa flaticon-<?php echo $item->ju_image; ?>" <?php endif;?> ><?php if (empty($item->ju_styles)) : ?><img src="<?php echo $item->ju_img; ?>"> <?php endif;?></span> </div>
<h5><?php if (!empty($item->ju_target_url)) : ?><a href="<?php echo $item->ju_target_url; ?>" target="<?php echo $ju_target; ?>"><?php endif; ?> <?php echo $item->ju_title; ?> <?php if (!empty($item->ju_target_url)) : ?></a><?php endif; ?></h5>
<?php if ($item->ju_text != '') : ?><p><?php echo $item->ju_text; ?></p><?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
