| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/new-saint-martin/plugins/slideshowck/joomgallery/helper/ |
Upload File : |
<?php
/**
* @name Slideshow CK
* @package com_slideshow
* @copyright Copyright (C) 2016. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr
*/
// No direct access
defined('_JEXEC') or die;
/**
* Helper Class.
*/
class SlideshowckHelpersourceJoomgallery {
private static $params;
/*
* Get the items from the source
*/
public static function getItems(&$params) {
// needed to route the url
if (!class_exists( 'JoomInterface' )) require_once(JPATH_SITE.'/components/com_joomgallery/interface.php');
$jginterface = new JoomInterface();
// load the items
$items = self::loadItems($params);
if (!$items) return false;
foreach ($items as $i => $item) {
if (!empty($item->imgfilename)) {
$item->image = \Joomla\CMS\Uri\Uri::base(true) . '/images/joomgallery/originals/' . $item->catpath . '/' . $item->imgfilename;
} else {
unset($items[$i]);
continue;
}
$item->link = null;
$item->title = null;
$item->text = null;
$item->more = array();
$item->alignment = null;
$item->time = null;
$item->target = 'default';
$item->video = null;
$item->texttype = null;
$item->articleid = null;
if ($params->get('slideshowckjoomgallery_linktoimage', 'image') == 'image') {
$item->link = $item->image; // link to image
} else if ($params->get('slideshowckjoomgallery_linktoimage', 'image') == 'image_detail') {
$item->link = $jginterface->route('index.php?view=detail&id='.$item->id); // link to image detail page
} else if ($params->get('slideshowckjoomgallery_linktoimage', 'image') == 'image_category') {
$item->link = $jginterface->route('index.php?view=category&catid='.$item->catid); // link to category page
} else {
$item->link = null;
}
$item->text = SlideshowckHelper::substring($item->imgtext, '150');
}
return $items;
}
private static function loadItems($params) {
// Setting
$max_items = $params->get( 'limitslides', 0 ); //maximum number of items to display
$category_id = $params->get( 'slideshowckjoomgallery_category', null ); // Display items from this category only
$filter_category = (bool)$params->get( 'slideshowckjoomgallery_filtercategory', 0 ); // Filter the category
$product_group = $params->get( 'slideshowckjoomgallery_product_group', 'order'); // Choose which items to display
$db = \Joomla\CMS\Factory::getDBO();
$authorisedViewLevels = implode(',', \Joomla\CMS\Factory::getUser()->getAuthorisedViewLevels());
$query = $db->getQuery(true)
->select('*, a.owner AS owner');
$query->from('#__joomgallery AS a')
->leftJoin('#__joomgallery_catg AS c ON c.cid = a.catid')
->where('a.published = 1')
->where('c.published = 1')
->where('a.approved = 1')
->where('a.hidden = 0')
->where('a.access IN ('.$authorisedViewLevels.')')
->where('c.access IN ('.$authorisedViewLevels.')');
if ($filter_category) {
$query->where('a.catid = '.$category_id);
}
// if($this->_config->get('jg_firstorder'))
// {
// $query->order('a.'.$this->_config->get('jg_firstorder'));
// }
// if($this->_config->get('jg_secondorder'))
// {
// $query->order('a.'.$this->_config->get('jg_secondorder'));
// }
// if($this->_config->get('jg_thirdorder'))
// {
// $query->order('a.'.$this->_config->get('jg_thirdorder'));
// }
// if($this->_config->get('jg_usercatorder'))
// {
// $user_orderby = $this->_mainframe->getUserStateFromRequest('joom.category.images.orderby', 'orderby');
// $user_orderdir = $this->_mainframe->getUserStateFromRequest('joom.category.images.orderdir', 'orderdir');
$orderby = 'a.imgtitle DESC';
switch($product_group)
{
case 'order':
default:
$orderby = 'a.ordering ASC';
break;
case 'latest':
$orderby = 'a.imgdate DESC';
break;
case 'topten':
$orderby = 'a.imgvotes DESC';
break;
case 'mostviewed':
$orderby = 'a.hits DESC';
break;
case 'random':
$orderby = "RAND()";
break;
}
$query->order($orderby);
if ($max_items > 0) {
$db->setQuery($query, 0, $max_items);
} else {
$db->setQuery($query);
}
if ($db->execute()) {
$products = $db->loadObjectList();
} else {
echo '<p style="color:red;font-weight:bold;">Error loading SQL data : loading the joomgallery products in Slideshow CK</p>';
return false;
}
if(empty($products)) return false;
return $products;
}
}