Your IP : 10.10.0.253


Current Path : /var/www/modules/mod_yendifvideoshare_categories/
Upload File :
Current File : /var/www/modules/mod_yendifvideoshare_categories/helper.php

<?php
/**
 * @version    1.2.9
 * @package    Com_YendifVideoShare
 * @author     PluginsWare Interactive Pvt. Ltd <admin@yendifplayer.com>
 * @copyright  Copyright (c) 2012 - 2021 PluginsWare Interactive Pvt. Ltd. All Rights Reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
 
// Prevent direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

class YendifVideoShareCategoriesHelper {
	
	public static function getItems( $params, $limit ) {	
		$db = JFactory::getDbo();
		
		$query = 'SELECT * FROM #__yendifvideoshare_categories WHERE published=1 AND parent=' . (int) $params->get( 'catid' );
		
		switch ( $params->get( 'orderby' ) ) {		
			case 'latest':
				$query .= ' ORDER BY created_date DESC';
				break; 	
			case 'date_added':
				$query .= ' ORDER BY created_date ASC';
				break;
			case 'a_z':
				$query .= ' ORDER BY name ASC';
				break;
			case 'z_a':
				$query .= ' ORDER BY name DESC';
				break;
			case 'random':
				$query .= ' ORDER BY RAND()';
				break;
			case 'ordering':
				$query .= ' ORDER BY ordering';
				break;
			default:
				$query .= ' ORDER BY id DESC';
				
		}
		
		$query .= ' LIMIT ' . $limit;
		
		$db->setQuery( $query );
       	$items = $db->loadObjectList();
			
        return $items;		
    }
			
}