Your IP : 216.73.216.240


Current Path : /home/juvelize/www/modules/mod_lofresponsivecarousel/
Upload File :
Current File : /home/juvelize/www/modules/mod_lofresponsivecarousel/helper.php

<?php 
/*------------------------------------------------------------------------
 # Lof Articles Srcoller Module for Jooml 3.0
 # ------------------------------------------------------------------------
 # author    LandOfCoder
 # copyright Copyright (C) 2013 landofcoder.com. All Rights Reserved.
 # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 # Websites: http://www.landofcoder.com
 # Technical Support:  Forum - http://www.landofcoder.com/support/forum.html
-------------------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die;
require_once JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_content'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'route.php';
if( !defined('PhpThumbFactoryLoaded') ) {
	require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'libs'.DIRECTORY_SEPARATOR.'phpthumb'.DIRECTORY_SEPARATOR.'ThumbLib.inc.php';
	define('PhpThumbFactoryLoaded',1);
}

if( !class_exists("LofDataSourceBase") ){
	require_once dirname(__FILE__).DS."libs".DS."source".DS."source_base.php";
}
jimport('joomla.filesystem.folder');

abstract class modRespCarouselHelper {
	
	
	/**
	 * get list articles
	 */
	public static function getList( $params, $moduleName ){
			return self::getListBySourceName( $params, $moduleName );
	///	}	
	}
		/**
  	 * Get list of articles follow conditions user selected
     * 
     * @param JParameter $params
     * @return array containing list of article
     */ 
	public static function getListBySourceName( &$params, $moduleName ) {
	 	// create thumbnail folder 	

	 	$tmppath = JPATH_SITE.DIRECTORY_SEPARATOR.'cache';//.'lofthumbs';
		$moduleName = 'thumbs' ;
	 	$thumbPath = $tmppath.DIRECTORY_SEPARATOR. $moduleName.DIRECTORY_SEPARATOR;
		if( !file_exists($tmppath) ) {
			JFolder::create( $tmppath, 0777 );
		}; 
		if( !file_exists($thumbPath) ) {
			JFolder::create( $thumbPath, 0777 );
		}; 
		$source = $params->get("data_source",'content' ); 
		// get call object to process getting source
		$path = dirname(__FILE__).DIRECTORY_SEPARATOR."libs".DIRECTORY_SEPARATOR."source".DIRECTORY_SEPARATOR.$source.DIRECTORY_SEPARATOR."source.php";
	
		if( !file_exists($path) ){
			return array();	
		}
		require_once $path;
		$objectName = "Lof".ucfirst($source)."DataSource";
	 	$object = new $objectName();
	 	$items= $object->setThumbPathInfo($thumbPath, JURI::base()."cache/".$moduleName."/" )
			->setImagesRendered( array( 'thumbnail' => array( (int)$params->get( 'thumbnail_width', 60 ), (int)$params->get( 'thumbnail_height', 60 ))) )
			->getList( $params );
  		return $items;
	}
	
	/**
	 * Get Layout of the item, if found the overriding layout in the current template, the module will use this file
	 * 
	 * @param string $moduleName is the module's name;
	 * @params string $theme is name of theme choosed
	 * @params string $itemLayoutName is name of item layout.
	 * @return string is full path of the layout
	 */
	public static function getItemLayoutPath($moduleName, $theme ='', $itemLayoutName='_item' ){

		$layout = trim($theme)?trim($theme).DS.'_item'.DS.$itemLayoutName:'_item'.DS.$itemLayoutName;	
		$path = JModuleHelper::getLayoutPath($moduleName, $layout);	
		if( trim($theme) && !file_exists($path) ){
			// if could not found any item layout in the theme folder, so the module will use the default layout.
			return JModuleHelper::getLayoutPath( $moduleName, '_item'.DS.$itemLayoutName );
		}
		return $path;
	}
	
	/**
	 * load css - javascript file.
	 * 
	 * @param JParameter $params;
	 * @param JModule $module
	 * @return void.
	 */
	public static function loadMediaFiles( $params, $module, $theme='' ){
 	 	
		$template = JFactory::getApplication()->getTemplate();
		//load style of module
		if(file_exists(JPATH_BASE.DS.'templates/'.$template.'/css/'.$module->module.'.css')){
			JHTML::stylesheet(  'templates/'.$template.'/css/'.$module->module.'.css' );		
		}else {
			JHTML::stylesheet('modules/'.$module->module.'/tmpl/'.$theme.'/assets/'.'style.css');	
		}		
		
		// JHTML::script( 'modules/'.$module->module.'/assets/'.'script.js');
	}
	 
}	 
?>