<?php
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.mootools');
require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'h elpers'.DS.'route.php');
require_once('modules/mod_youstorage_slider/lib/slike.php');
class modYJYouStorageSliderhHelper
{
function getYouStorageSliderItems(&$params)
{
$who = strtolower($_SERVER['HTTP_USER_AGENT']);
$get_items = $params->get ('get_items',1);
$nitems = $params->get ('nitems',4);
$chars = $params->get ('chars',40);
$chars_nav = $params->get ('chars_nav',40);
$ordering = $params->get ('ordering',3);// 1 = ordering | 2 = popular | 3 = random
$getspecific = $params->get ('getspecific');
$slider_width = $params->get ('slider_width','980px');
$slider_height = $params->get ('slider_height','331px');
$slider_intro_width = $params->get ('slider_intro_width','415px');
$slider_image_width = $params->get ('slider_image_width','565px');
$slider_image_ptop = $params->get ('slider_image_ptop','110px');
$slider_image_pleft = $params->get ('slider_image_pleft','150px');
$txtDelay = $params->get ('txtDelay','10');
$imgOutDist = $params->get ('imgOutDist','500');
$txtOutDist = $params->get ('txtOutDist','300');
$txtFx = $params->get ('txtFx','Fx.Transitions.Pow.easeInOut');
$imgFx = $params->get ('imgFx','Fx.Transitions.Cubic.easeOut');
$txtFxDuration = $params->get ('txtFxDuration','800');
$imgFxDuration = $params->get ('imgFxDuration','800');
$autoslide = $params->get ('autoslide','0');
$document = &JFactory::getDocument();
if (JPluginHelper::getPlugin('system', 'mtupgrade')) :
$moo_v = '12';
else:
$moo_v = '';
endif;
$document->addStyleSheet(JURI::base() . 'modules/mod_youstorage_slider/css/stylesheet.css');
$document->addScript(JURI::base() . 'modules/mod_youstorage_slider/src/youstorage_slider'.$moo_v.'.js');
if (preg_match( "/msie/",$who)){
if (preg_match("/msie 7/",$who) || preg_match("/msie 8/",$who)) {
echo '';
}else{
$document->addStyleSheet(JURI::base() . 'modules/mod_youstorage_slider/css/ifie.php');
}
}
$document->addScriptDeclaration("
window.addEvent('domready', function(){
new YouStorageSlider({
container:'slides',
slides:{
selector:'.slide',
texts:'.texts',
images:'.img_container'
},
navs:{
prev:'left',
next:'right'
},
txtDelay:".$txtDelay.",
imgOutDist:".$imgOutDist.",
txtOutDist:".$txtOutDist.",
txtFx: ".$txtFx.",
imgFx: ".$imgFx.",
txtFxDuration:".$txtFxDuration.",
imgFxDuration:".$imgFxDuration.",
autoslide:".$autoslide."
});
})
");
/* prepare database */
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$userId = (int) $user->get('id');
$aid = $user->get('aid', 0);
$contentConfig = &JComponentHelper::getParams( 'com_content' );
$access = !$contentConfig->get('shownoauth');
$nullDate = $db->getNullDate();
$date = & JFactory::getDate();
$now = $date->toMySQL(); //date('Y-m-d H:i:s');
$where = 'a.state = 1'
. ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )'
. ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )'
;
// select specific items
if(!empty($getspecific)){
$countitems = count($getspecific);
}
if(!empty($getspecific) && $countitems > 1 ){
$specificitems = implode(",", $getspecific);
$specific_order= 'field(a.id,'.$specificitems.')';
$where .= ' AND a.id IN ('.$specificitems.')';
}elseif(!empty($getspecific) && $countitems == 1 ){
$specificitems = $getspecific;
$specific_order= 'field(a.id,'.$specificitems.')';
$where .= ' AND a.id IN ('.$specificitems.')';
}else{
$specificitems='';
$specific_order='NULL';
$where .= ' AND cc.id = '.$get_items.'';
}
/* set items order */
$ord = array(
1=>'ordering',
2=>'hits',
3=>'RAND()',
4=>'created ASC',
5=>'created DESC',
6=>$specific_order
);
$order = $ord[$ordering];
/* get items */
$sql = 'SELECT a.*, ' .
' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug,'.
'cc.title as cattitle,'.
's.title as sectitle'.
' FROM #__content AS a' .
' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
' INNER JOIN #__sections AS s ON s.id = a.sectionid' .
' WHERE '. $where .'' .
($access ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : '').
' AND s.published = 1' .
' AND cc.published = 1' .
' ORDER BY '.$order .' LIMIT 0,'.$nitems.'';
$db->setQuery( $sql );
$load_items = $db->loadObjectList();
$youstorage_slides = array();
foreach ( $load_items as $row ) {
$youstorage_slide = array(
'intro' => substr(strip_tags($row->introtext),0,$chars),
'link' => ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid),
'title' => $row->title,
'img_url' => $img_url = article_imageyoustor($row),
'img_out' => "<img src=\"".$img_url."\" title=\"".$row->title." \" alt=\"\"/>"
);
$youstorage_slides[] = $youstorage_slide;
}
return $youstorage_slides;
}
}
?>
علاقه مندی ها (Bookmarks)