Created
September 5, 2016 11:28
-
-
Save uzielweb/6593ac2a8edf12e380832cac6d5b40d7 to your computer and use it in GitHub Desktop.
Gallery from any article based on custom category (can be used in any other categories for Joomla) --- put this override in /html/com_content/article in your template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*Gallery from any article based on custom category | |
(can be used in any other categories for Joomla) --- put this override in /html/com_content/article in your template*/ | |
/** | |
* @package Joomla.Site | |
* @subpackage com_content | |
* | |
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. | |
* @license GNU General Public License version 2 or later; see LICENSE.txt | |
*/ | |
defined('_JEXEC') or die; | |
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers'); | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true); | |
//seleciona as colunas da tabela | |
$query->select($db->quoteName(array('id', 'title','alias' ,'fulltext' , 'catid'))); | |
//seleciona a tabela | |
$query->from($db->quoteName('#__content')) ; | |
//organiza os resultados obtidos em ordem ascendente usando como parâmetro a coluna data_atracao | |
$db->setQuery($query); | |
$results = $db->loadObjectList(); | |
$app = JFactory::getApplication(); | |
//obtem o caminho atual EM CASO DE USAR OVERRIDE | |
//$path = JURI::base(true).'/templates/'.$app->getTemplate().'/html/mod_agendafabrik/'; | |
// Create shortcuts to some parameters. | |
$params = $this->item->params; | |
$images = json_decode($this->item->images); | |
$urls = json_decode($this->item->urls); | |
$canEdit = $params->get('access-edit'); | |
$user = JFactory::getUser(); | |
$info = $params->get('info_block_position', 0); | |
JHtml::_('behavior.caption'); | |
JHtml::script(JUri::base() . 'templates/eximium/src/jquery.scrolling-tabs.min.js', true); | |
JHtml::stylesheet(JUri::base() . 'templates/eximium/css/jquery.scrolling-tabs.min.css', true); | |
$doc = JFactory::getDocument(); | |
$doc->addStyleDeclaration ( ' | |
.wrapper { | |
position:relative; | |
margin:0 auto; | |
overflow:hidden; | |
padding:5px; | |
height:50px; | |
} | |
.list { | |
position:absolute; | |
left:0px; | |
top:0px; | |
min-width:3000px; | |
margin-left:12px; | |
margin-top:0px; | |
} | |
.list li{ | |
display:table-cell; | |
position:relative; | |
text-align:center; | |
cursor:grab; | |
cursor:-webkit-grab; | |
color:#efefef; | |
vertical-align:middle; | |
} | |
.scroller { | |
text-align:center; | |
cursor:pointer; | |
display:none; | |
white-space:no-wrap; | |
vertical-align:middle; | |
} | |
.scroller-right{ | |
float:right; | |
} | |
.scroller-left { | |
float:left; | |
} | |
' ); | |
?> | |
<!-- JavaScript jQuery code from Bootply.com editor --> | |
<script type='text/javascript'> | |
jQuery(document).ready(function($) { | |
var hidWidth; | |
var scrollBarWidths = 40; | |
var widthOfList = function(){ | |
var itemsWidth = 0; | |
$('.list li').each(function(){ | |
var itemWidth = $(this).outerWidth(); | |
itemsWidth+=itemWidth; | |
}); | |
return itemsWidth; | |
}; | |
var widthOfHidden = function(){ | |
return (($('.wrapper').outerWidth())-widthOfList()-getLeftPosi())-scrollBarWidths; | |
}; | |
var getLeftPosi = function(){ | |
return $('.list').position().left; | |
}; | |
var reAdjust = function(){ | |
if (($('.wrapper').outerWidth()) < widthOfList()) { | |
$('.scroller-right').show(); | |
} | |
else { | |
$('.scroller-right').hide(); | |
} | |
if (getLeftPosi()<0) { | |
$('.scroller-left').show(); | |
} | |
else { | |
$('.item').animate({left:"-="+getLeftPosi()+"px"},'slow'); | |
$('.scroller-left').hide(); | |
} | |
} | |
reAdjust(); | |
$(window).on('resize',function(e){ | |
reAdjust(); | |
}); | |
$('.scroller-right').click(function() { | |
$('.scroller-left').fadeIn('slow'); | |
$('.scroller-right').fadeOut('slow'); | |
$('.list').animate({left:"+="+widthOfHidden()+"px"},'slow',function(){ | |
}); | |
}); | |
$('.scroller-left').click(function() { | |
$('.scroller-right').fadeIn('slow'); | |
$('.scroller-left').fadeOut('slow'); | |
$('.list').animate({left:"-="+getLeftPosi()+"px"},'slow',function(){ | |
}); | |
}); | |
}); | |
</script> | |
<div class="outter-container"> <div class="before-container"> <div class="container"> | |
<div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div> | |
<div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div> | |
<div class="wrapper"> | |
<ul id="tabs" class="nav nav-tabs list" data-tabs="tabs"> | |
<?php | |
$i = "0"; | |
foreach($results as $key => $result){ | |
if ($result->catid == 42) { | |
$i = $i+1; | |
} | |
if ($result->catid == 42 && $i == 1) { | |
?> | |
<li><a class="active" href="#<?php echo $result->alias;?>" data-toggle="tab"><?php echo $result->title;?></a></li> | |
<?php | |
} | |
if ($result->catid == 42 && $i > 1) { | |
?> | |
<li><a href="#<?php echo $result->alias;?>" data-toggle="tab"><?php echo $result->title;?></a></li> | |
<?php | |
} | |
} | |
?> | |
</ul> | |
</div> | |
</div> | |
</div> | |
<!-- TAB PANES --> <div class="container"> | |
<div id="my-tab-content" class="tab-content"> | |
<?php | |
$i = "0"; | |
foreach($results as $key => $result){ | |
?> | |
<?php if ($result->catid == 42) { | |
$i = $i+1; | |
} | |
?> | |
<?php if ($result->catid == 42 && $i == 1) { | |
?> | |
<div class="tab-pane active" id="<?php echo $result->alias;?>"> | |
<?php $text = JHtml::_('content.prepare', $result->fulltext); ?> | |
<?php echo $text;?> | |
</div> | |
<?php } ?> | |
<?php if ($result->catid == 42 && $i > 1) { | |
?> | |
<div class="tab-pane" id="<?php echo $result->alias;?>"> | |
<?php $text = JHtml::_('content.prepare', $result->fulltext); ?> | |
<?php echo $text;?> | |
</div> | |
<?php } ?> | |
<?php } ?> | |
</div> | |
</div> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment