<?php
/*------------------------------------------------------------------------
# mod_ol_sidepanel Extension
# ------------------------------------------------------------------------
# author    olwebdesign
# copyright Copyright (C) 2019 olwebdesign.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.olwebdesign.com
-------------------------------------------------------------------------*/

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

$document 				= JFactory::getDocument();
$cacheFolder = JURI::base(true).'/cache/';
$modID = $module->id;
$modPath = JURI::base(true).'/modules/mod_ol_sidepanel/';
$load_render			= $document->loadRenderer('modules');
$moduleclass_sfx		= $params->get('moduleclass_sfx');
$img_panel				= $params->get('img_panel');
$alt_img_panel			= $params->get('alt_img_panel');
$width_panel			= (int)$params->get('width_panel', 250);
$position				= (int)$params->get('position', 0);
$ju_id					= $params->get('ju_id', 'id');
$bgt_color = $params->get('bgt_color');
$txt_color = $params->get('txt_color');
$bgm_color = $params->get('bgm_color');
$txm_color = $params->get('txm_color');
$btn_size = $params->get('btn_size');
$btn_position = $params->get('btn_position');
$btn_raf = $params->get('btn_raf');
$btn_top = $params->get('btn_top');
$butt_ics = $params->get('butt_ics');
$icon_size = $params->get('icon_size');
$btn_style = $params->get('btn_style');
$side_open = $params->get('side_open');
$position_module		= $params->get('position_module');
$position_module1		= $params->get('position_module1');
$position_module2		= $params->get('position_module2');
$position_module3		= $params->get('position_module3');
$position_module4		= $params->get('position_module4');
$jqueryload = $params->get('jqueryload');
$document->addStyleSheet($modPath.'assets/css/style.css');

if ($butt_ics == 'fa'){
  $document->addStyleDeclaration('.side_panel .side_panel-toggle-inner { margin-left:-10px;}'); 
}
if ($butt_ics == 'ps7'){
  $document->addStyleSheet ($modPath.'assets/css/pe-icon-7-stroke.css' ); 
  $document->addStyleDeclaration('.side_panel .side_panel-toggle-inner { width: ' . $icon_size . 'px; height: ' . $icon_size . 'px;}'); 
}
if ($butt_ics == 'typcn'){
  $document->addStyleSheet ($modPath.'assets/css/typicons.css' ); 
  $document->addStyleDeclaration('.side_panel .side_panel-toggle-inner { margin-top: 20%;  width: ' . $icon_size . 'px; height: ' . $icon_size . 'px;}'); 
}
if ($butt_ics == 'bicon'){
  $document->addStyleSheet ($modPath.'assets/css/bicon.min.css' ); 
  $document->addStyleDeclaration('.side_panel .side_panel-toggle-inner { width: ' . $icon_size . 'px; height: ' . $icon_size . 'px;}'); 
}
$document->addStyleDeclaration('.side_panel { position: ' . $btn_position . '; ' . $btn_raf . ': 0px; float:' . $btn_raf . '; } .side_panel_inner i {font-size: ' . $icon_size . 'px !important;}'); 
if($btn_position=='absolute') $document->addStyleDeclaration('.side_panel {  top: ' . $btn_top . ';}'); 
if($btn_position=='fixed') $document->addStyleDeclaration('.side_panel {  top: ' . $btn_top . ';}'); 
if ($btn_style == 'circle') { $document->addStyleDeclaration('.side_panel_inner {border-radius: 50%;}');
}
if($jqueryload) $document->addScript($modPath.'assets/js/jquery.js');

?>

<div class="side_panel <?php if($params->get('side_open')=='1') : ?>side-panel_open<?php endif; ?>" style="height:<?php echo $params->get('btn_size')?>; width:<?php echo $params->get('btn_size')?>;">
<div class="side_panel_inner" style="background-color: <?php echo $params->get('bgt_color')?>;color: <?php echo $params->get('txt_color')?>;"><a href="#" class="side_panel-toggle"><div class="side_panel-toggle-inner"><?php if($params->get('butt_ics')) : ?><i class="<?php if ($params->get('butt_ics') == 'typcn') {echo 'typcn typcn-';} ?><?php if ($params->get('butt_ics') == 'bicon') {echo 'bi ';} ?><?php echo $params->get ('ol_icon') ;?>" ></i><?php else: ?><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><?php endif; ?></div></a>
</div>
</div>
<div class="side-panel_overlay"></div>
<section id="side-panel" class="side-panel_position_<?php echo $params->get('pn_position')?> ps ps--active-y <?php if($params->get('side_open')=='1') : ?>side-panel_open<?php endif; ?>" style="background-color: <?php echo $params->get('bgm_color')?>;color: <?php echo $params->get('txm_color')?>;width: <?php echo $params->get('side_width')?>;text-align: left; "><a href="#" class="side-panel_close"><span class="side-panel_close_icon"></span></a>
<div class="side-panel_sidebar" style=" padding:<?php echo $params->get('side_padd')?>;">		
<?php echo $load_render->render($position_module); ?>
<?php echo $load_render->render($position_module1); ?>
<?php echo $load_render->render($position_module2); ?>
<?php echo $load_render->render($position_module3); ?>
<?php echo $load_render->render($position_module4); ?>
</div>
</section>
<?php if($params->get('autoclose')=='1') : ?>
<script type="text/javascript" src="modules/mod_ol_sidepanel/assets/js/close.js"></script>
<?php else: ?>
<!--<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.perfect-scrollbar/0.6.7/js/min/perfect-scrollbar.jquery.min.js"></script>-->
<script type="text/javascript" src="modules/mod_ol_sidepanel/assets/js/open.js"></script>
<?php endif; ?>
