Your IP : 216.73.216.6


Current Path : /home/hsabaeej/public_html/modules/mod_zt_layerslider/
Upload File :
Current File : /home/hsabaeej/public_html/modules/mod_zt_layerslider/mod_zt_layerslider.php

<?php
/**
 * @package ZT Layerslider module
 * @author Hiepvu
 * @copyright(C) 2013 - ZooTemplate.com
 * @license PHP files are GNU/GPL
 **/

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

defined('DS') or define('DS', DIRECTORY_SEPARATOR);

// Require the base helper class only once
require_once dirname(__FILE__) . DS . 'helper.php';

$moduleclass_sfx = $params->get('moduleclass_sfx', '');
$sliderId        = (int)$params->get('slider_id', 0);

$helper       = new modZTLayersliderHelper($params);
$slider       = $helper->getSliderById($sliderId);
$sliderParams = new JRegistry($slider->attribs);
list($countSlides, $slides) = $helper->getSlides($sliderId);

//$cache_time    = (int)$params->get('cache_time', 900);
//$cache_enabled = $params->get('cache', 0) ? true : false;
//$cache         = & JFactory::getCache('mod_zt_layerslider');
//$cache->setCaching($cache_enabled);
//$cache->setLifeTime($cache_time);
//$rows = $cache->call(array($help, 'getData'));

/* -------------------- check for html ----------------------------- */


$bannerWidth  = $sliderParams->get("slider_width", 960);
$bannerHeight = $sliderParams->get("slider_height", 350);

$sliderType = $sliderParams->get("slider_type");

//set wrapper height
$wrapperHeigh = 0;
$wrapperHeigh += $sliderParams->get("slider_height");

//add thumb height
if ( $sliderParams->get("navigaion_type") == "thumb" ) {
    $wrapperHeigh += $sliderParams->get("thumb_height");
}

$sliderHtmlID         = "rev_slider_" . $sliderId . "_" . $module->id;
$sliderHtmlID_wrapper = $sliderHtmlID . "_wrapper";

$containerStyle = "";

//set position:
$sliderPosition = $sliderParams->get("position", "center");

switch ( $sliderPosition ) {
    case "center":
    default:
        $containerStyle .= "margin:0px auto;";
        break;
    case "left":
        $containerStyle .= "float:left;";
        break;
    case "right":
        $containerStyle .= "float:right;";
        break;
}

//add background color
$backgrondColor = trim($sliderParams->get("background_color"));
if ( !empty($backgrondColor) ) $containerStyle .= "background-color:$backgrondColor;";

//set padding
$containerStyle .= "padding:" . $sliderParams->get("padding", "0") . "px;";

//set margin:
if ( $sliderPosition != "center" ) {
    $containerStyle .= "margin-left:" . $sliderParams->get("margin_left", "0") . "px;";
    $containerStyle .= "margin-right:" . $sliderParams->get("margin_right", "0") . "px;";
}

$containerStyle .= "margin-top:" . $sliderParams->get("margin_top", "0") . "px;";
$containerStyle .= "margin-bottom:" . $sliderParams->get("margin_bottom", "0") . "px;";

//set height and width:
$bannerStyle = "display:none;";

//add background image (to banner style)
if ( (int)$sliderParams->get("show_background_image", 0) ) {

    $backgroundImage = $sliderParams->get("background_image");
    if ( !empty($backgroundImage) ) $bannerStyle .= "background-image:url($backgroundImage);background-repeat:no-repeat;";

}

//set wrapper and slider class:
$sliderWrapperClass = "rev_slider_wrapper";
$sliderClass        = "rev_slider";

$ResponsiveStyles = false;

switch ( $sliderType ) {
    default:
    case "fixed":
        $bannerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;";
        $containerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;";
        break;
    case "responsitive":
        $ResponsiveStyles = true;
        break;
    case "fullwidth":
        $sliderWrapperClass .= " fullwidthbanner-container";
        $sliderClass .= " fullwidthabanner";
        $bannerStyle .= "max-height:{$bannerHeight}px;height:{$bannerHeight};";
        $containerStyle .= "max-height:{$bannerHeight}px;";
        break;
}

$htmlTimerBar = "";

if ( (int)$sliderParams->get("show_timerbar", 1) ) {
    $timerPosition = $sliderParams->get("timebar_position", "top");

    if ( $timerPosition == "top" ) $htmlTimerBar = '<div class="tp-bannertimer"></div>'; else
        $htmlTimerBar = '<div class="tp-bannertimer tp-bottom"></div>';
}

//check inner / outer border
$paddingType = $sliderParams->get("padding_type", "outter");
if ( $paddingType == "inner" ) $sliderWrapperClass .= " tp_inner_padding";

/* ---------------------- end check for html -------------------------- */

/*-------------------------------------------------------------------*/
// check for js

$optFullWidth = ($sliderType == "fullwidth") ? "on" : "off";

//set thumb amount

$thumbAmount = (int)$sliderParams->get("thumb_amount", "5");
if ( $thumbAmount > $countSlides ) $thumbAmount = $countSlides;


//get stop slider options
$stopSlider     = $sliderParams->get("stop_slider", "off");
$stopAfterLoops = $sliderParams->get("stop_after_loops", "0");
$stopAtSlide    = $sliderParams->get("stop_at_slide", "2");

if ( $stopSlider == "off" ) {
    $stopAfterLoops = "-1";
    $stopAtSlide    = "-1";
}

// set hide navigation after
$hideThumbs = $sliderParams->get("hide_thumbs", "200");
if ( is_numeric($hideThumbs) == false ) $hideThumbs = "0"; else {
    $hideThumbs = (int)$hideThumbs;
    if ( $hideThumbs < 10 ) $hideThumbs = 10;
}

$alwaysOn = (int)$sliderParams->get("navigaion_always_on", 0);

if ( $alwaysOn ) $hideThumbs = "0";

//treat hide slider at limit
$hideSliderAtLimit = (int)$sliderParams->get("hide_slider_under", 0);
if ( $hideSliderAtLimit ) $hideSliderAtLimit++;

//this option is disabled in full width slider
if ( $sliderType == "fullwidth" ) $hideSliderAtLimit = "0";

$hideCaptionAtLimit = $sliderParams->get("hide_defined_layers_under", "0");
;
if ( !empty($hideCaptionAtLimit) ) $hideCaptionAtLimit++;

$hideAllCaptionAtLimit = $sliderParams->get("hide_all_layers_under", "0");
;
if ( !empty($hideAllCaptionAtLimit) ) $hideAllCaptionAtLimit++;


$startWithSlide = $helper->getStartSlide($sliderParams, $countSlides);


$arrowsType = $sliderParams->get("navigation_arrows", "nexttobullets");
switch ( $arrowsType ) {
    case "verticalcentered":
        $arrowsType = "solo";
        break;
}

/*-------------------------------------------------------------------*/
$version = new JVersion();
JHtml::addIncludePath(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_zt_layerslider' . DS . 'helpers' . DS . 'html');

static $bool = false;
if ( !$bool ) {
    // load css
    $document = JFactory::getDocument();
    $document->addStyleSheet(JURI::base() . 'modules/mod_zt_layerslider/assets/css/zt_layerslider.css');
    $document->addStyleSheet(JURI::base() . 'components/com_zt_layerslider/assets/css/captions.css');
    $document->addStyleSheet(JURI::base() . 'components/com_zt_layerslider/assets/css/settings.css');

    if ( (int)$sliderParams->get("load_googlefont", 0) ) {
        $googleFont = $sliderParams->get("google_font");
        $document->addStyleSheet('http://fonts.googleapis.com/css?family=' . $googleFont .'&subset=all');
    }
    //load js
    if ( version_compare($version->getShortVersion(), '3.0.0', '<') ) {
        // for joomla 2.5
        JHtml::_('zt_layerslider.jquery');
    } else {
        // for joomla 3.0
        JHtml::_('jquery.framework');
    }
    $document->addScript(JURI::base() . 'components/com_zt_layerslider/assets/js/jquery.themepunch.plugins.min.js');
    $document->addScript(JURI::base() . 'components/com_zt_layerslider/assets/js/jquery.themepunch.revolution.js');
    $bool = true;

}

require JModuleHelper::getLayoutPath('mod_zt_layerslider', 'default');