<?php

/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  Script: Maian Gallery v2.0
  Written by: David Ian Bennett
  E-Mail: support@maianscriptworld.co.uk
  Website: http://www.maianscriptworld.co.uk

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  
  This File: class_slideshow.inc.php
  Description: Gets category images for slideshow

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

class mga_Slideshow extends genericOptions {

var $prefix;

// Gets image data..
function getImagesForSlideshow($path,$theme,$cat,$data)
{
  $img = '';
  
  // Get images..
  $q_image = mysql_query("SELECT *,".$this->prefix."images.id AS i_id
                          FROM ".$this->prefix."images
                          LEFT JOIN ".$this->prefix."categories
                          ON ".$this->prefix."images.cat    = ".$this->prefix."categories.id 
                          WHERE ".$this->prefix."images.cat = '{$cat}' 
                          ") or die(mysql_error());
  
  while ($IMAGES = mysql_fetch_object($q_image)) {
    $find     = array('{title}','{desc}','{path_full}','{path_thumb}');
    $replace  = array($this->strip_slashes($IMAGES->name),'&nbsp;',
                      ($data->watermarks && $IMAGES->en_watermarks ? $data->folder.'/index.php?cmd=watermark&amp;picture='.$IMAGES->i_id : 'galleries/'.$data->folder_name.'/'.$IMAGES->folder.'/'.$IMAGES->imagepath),
                      'galleries/'.$data->folder_name.'/'.$IMAGES->folder.'/'.$IMAGES->thumbpath
                      );
  
    $img .= str_replace($find,$replace,
                        file_get_contents($path.'themes/'.$theme.'/tpl_files/slideshow_element.tpl')
    );
  }
  
  return $img;
}

// Get speed for slideshow..
function getSlideshowSpeed($data,$speed)
{
  $run = explode(",",$data->slidespeeds);
  
  return (isset($run[$speed]) ? $run[$speed] : '9000'); 
}

}

?>
