joomla_test/modules/mod_yahoostylenewsslider/tmpl/default.php

188 lines
8.6 KiB
PHP
Raw Normal View History

2020-01-02 22:20:31 +07:00
<?php
/**
* default.php Yahoo Style News Slider Module
*
* @version 1.0
* @package mod_yahoostylenewsslilder
* @author Sabuj kundu ( http://codeboxr.com )
* @copyright Copyright (C) 2011-2013 http://codeboxr.com. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @ help: http://codeboxr.com/product/yahoostylenewsslilder
*/
//var_dump('test is here');
// no direct access
defined('_JEXEC') or die('Restricted access');
$doc = JFactory::getDocument();
if(version_compare(JVERSION,'3.0.0','ge')){
JHtml::_('jquery.framework'); //jquery for joomla 3.0
}else{
$doc->addScript(JURI::root().'modules/mod_yahoostylenewsslider/yahoostylenewsslider/js/jquery.js?v=2');
$doc->addScriptDeclaration('jQuery.noConflict();');
}
//adding css files
$doc->addStyleSheet(JURI::root().'modules/mod_yahoostylenewsslider/yahoostylenewsslider/css/yahoostylenewsslider.css?v=5');
$doc->addStyleSheet(JURI::root().'modules/mod_yahoostylenewsslider/yahoostylenewsslider/css/base.css?v=4');
$doc->addStyleSheet(JURI::root().'modules/mod_yahoostylenewsslider/yahoostylenewsslider/css/theme.css?v=9');
//$doc->addStyleSheet($stylepath);
//adding javascript files
$doc->addScript(JURI::root().'modules/mod_yahoostylenewsslider/yahoostylenewsslider/js/jquery.accessible-news-slider.js?v=20');
//params
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
$moduleclass = $moduleclass_sfx ? 'cbystylenslider'.$moduleclass_sfx:'';
//slideshow params
$headertxt = $params->get('headertxt','');// title for the display
$headersubtxt = $params->get('headersubtxt','');// subtitle for the display
$overlaycontentbx = $params->get('overlaycontentbx','true');// Overlay content box over images
//var_dump($overlaycontentbx);
$showcontenttitle = $params->get('showcontenttitle','true');// Show/hide Content title
$showcontentdesc = $params->get('showcontentdesc','true');// Show/hide Content Description
//var_dump($showcontenttitle );
$slideBy = intval($params->get('slideBy',4));// number of slides to advance when paginating
$speed = $params->get('speed','slow');// the speed for the pagination
$slideShowInterval = intval($params->get('slideShowInterval',5000));// slideshow interval
$slideShowDelay = intval($params->get('slideShowDelay',5000));// delay before slide show begins
$continuousPaging = $params->get('continuousPaging','true');// allow the pagination to wrap continuously instead of stopping when the beginning or end is reached
$contentTitle = $params->get('contentTitle','h3');// selector for the story title
$contentSubTitle = $params->get('contentSubTitle','abbr');// selector for the story subtitle
$contentDescription = $params->get('contentDescription','p');// selector for the story description
$contentopacity = $params->get('contentopacity','0.5');// content opacity
$contentbgcolor = $params->get('contentbgcolor','#FFF');// Bg color of content
$contenttitlecolor = $params->get('contenttitlecolor','#0000FF');// Bg color of content
$contentfontsize = intval($params->get('contentfontsize',16));// font size of content title
//thumb params
$showthumbTitle = $params->get('showthumbTitle',1);// Title under Thumb
$thumbwidth = intval($params->get('thumbwidth',82));// width of Thumb
$thumbheight = intval($params->get('thumbheight',50));// width of Thumb
//$carouselnpheight = intval($params->get('carouselnpheight',137));// Carousel Next Prev height
$imgheight = intval($params->get('imgheight',400));// Height of Image
$jscode = '';
$jscode .= " jQuery(document).ready(function() {
jQuery('#cbysnewslider').accessNews({
moduleclass: '$moduleclass',
title : '$headertxt',
subtitle:'".($headersubtxt?": ".$headersubtxt:'')."',
overlaycontentbx: $overlaycontentbx,
showcontenttitle: $showcontenttitle,
showcontentdesc : $showcontentdesc,
speed : '$speed',
//slideBy : factorofThumbBxWdthPx,
slideShowInterval: $slideShowInterval,
slideShowDelay: $slideShowDelay,
continuousPaging : $continuousPaging,
contentTitle: '$contentTitle',
contentSubTitle: '$contentSubTitle',
contentDescription: '$contentDescription',
thumbbxwidth : ".intval($thumbwidth+1).",
imgheight : ".$imgheight.",
contentopacity : ".$contentopacity.",
outerwrapperwclass: 'cbystylenewssldroutrwrpr'
});
});";
$doc->addScriptDeclaration($jscode);
?>
<?php
$output = '';
//echo '<pre>';var_dump($articles);echo '</pre>';
$imagepath = JURI::root().'modules/mod_yahoostylenewsslider/yahoostylenewsslider/images';
$style = $showthumbTitle ? '' : 'style="display:none;"';
//$height = $carouselnpheight;//$showthumbTitle ? (105+$carouselnpheight):(55+$carouselnpheight);
///var_dump($height);
$doc->addStyleDeclaration('
.cbystylesscntnt{
bottom:0px !important;
}
.jqans-pagination-count{
top:'.($imgheight-30).'px !important;
}
.cbystylessplay{
position:absolute;
right:5px;
top:'.($imgheight-30).'px !important;
}
div.jqans-wrapper.default li{
width:'.($thumbwidth).'px !important;
}
div.jqans-content{
height:'.$imgheight.'px;
position:relative;
}
.cbystylesscntnt,
.jqans-pagination-count{
opacity:'.$contentopacity.';
}
.cbystylesscntnt{
background-color:'.$contentbgcolor.';
}
div.cbystylesscntnt h1, div.cbystylesscntnt h1 a{
font-size:'.$contentfontsize.'px !important;
color:'.$contenttitlecolor.' !important;
background:none !important;
}
/*ul#cbysnewslider{height:113px;overflow:hidden;}*/
');
//echo '<pre>';var_dump($articles); echo '</pre>';
$laststyle = '';
if(!$articles->error){
$output .= '<ul id="cbysnewslider">';
$laststyle = '';
$i = 1;
foreach($articles->content as $article){
//$laststyle = (count($articles->content) == $i) ? 'clear-right:both;':'';
//var_dump($article->permalink);
$article->articletext = preg_replace('/[{]+[^}]*[}]+/', '', $article->articletext);
$output .= '<li style="'.$laststyle.'">';
$output .= '<a href="'.$article->permalink.'"><img src="'.$article->image.'" style="width:'.$thumbwidth.'px; height:'.$thumbheight.'px;" width="'.$thumbwidth.'" height="'.$thumbwidth.'" alt="Thumb" /></a>';
$output .= '<span class="thumbfooter"></span>';
$output .= '<h3 '.$style.'><a href="'.$article->permalink.'" target="_blank">'.mb_substr($article->title,0,42).'</a></h3>';
$output .= '<p>'. mb_substr(strip_tags($article->articletext),0,200).'...<br /><a href="'.$article->permalink.'"> &raquo; read more</a></p>';
$output .= '</li>';
$i++;
}
//$output .= '<div style="clear:both;"></div>';
$output .= '</ul>';
}else{
//var_dump($feeds->error);
$application = JFactory::getApplication();
if(count($articles->error) > 0){
//var_dump('assad');
//echo '<div class="modmysocialtimelineerr">';
//echo '<p>Please fix the following errors</p>';
foreach($articles->error as $error){
$application->enqueueMessage('Front Page Reloaded Module-> '.$error, 'error');
}
}
}
//$output .= '<a href="#" id="cbystylessplay" style="margin:10px;">play</a>';
//$output .= '<a href="#" id="cbystylesspause" style="margin:10px;">pause</a>';
echo $output;
?>