"")
{
$folder = $path."/";
}
else
{
$folder = "";
}
$sys_course_path = api_get_path(SYS_COURSE_PATH);
// including the functions for the slideshow
include ('slideshow.inc.php');
// breadcrumb navigation
$url = "document.php?curdirpath=".$pathurl;
$originaltoolname = get_lang('Documents');
$interbreadcrumb[] = array ("url" => $url, "name" => $originaltoolname);
// because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to
// bypass the $nametools thing and use tags in the $interbreadcrump array
$url = "slideshow.php?curdirpath=".$pathurl;
$originaltoolname = get_lang('SlideShow');
//$interbreadcrumb[]= array ("url"=>$url, "name"=>$originaltoolname );
Display :: display_header($originaltoolname, "Doc");
// loading the slides from the session
$image_files_only = $_SESSION["image_files_only"];
// calculating the current slide, next slide, previous slide and the number of slides
if ($slide_id <> "all")
{
if ($slide_id)
{
$slide = $slide_id;
}
else
{
$slide = 0;
}
$previous_slide = $slide -1;
$next_slide = $slide +1;
} // if ($slide_id<>"all")
$total_slides = count($image_files_only);
?>
';
// =======================================================================
// TREATING THE POST DATA FROM SLIDESHOW OPTIONS
// =======================================================================
// if we come from slideshowoptions.php we sessionize (new word !!! ;-) the options
if (isset ($_POST['Submit'])) // we come from slideshowoptions.php
{
$_SESSION["image_resizing"] = $_POST['radio_resizing'];
if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '')
{
//echo "resizing";
$_SESSION["image_resizing_width"] = $_POST['width'];
$_SESSION["image_resizing_height"] = $_POST['height'];
}
else
{
//echo "unsetting the session heighte and width";
$_SESSION["image_resizing_width"] = null;
$_SESSION["image_resizing_height"] = null;
}
} // if ($submit)
// The target height and width depends if we choose resizing or no resizing
if ($_SESSION["image_resizing"] == "resizing")
{
$target_width = $_SESSION["image_resizing_width"];
$target_height = $_SESSION["image_resizing_height"];
}
else
{
$image_width = $source_width;
$image_height = $source_height;
}
// =======================================================================
// THUMBNAIL VIEW
// =======================================================================
// this is for viewing all the images in the slideshow as thumbnails.
$image_tag = array ();
if ($slide_id == "all")
{
$thumbnail_width = 100;
$thumbnail_height = 100;
$row_items = 4;
foreach ($image_files_only as $one_image_file)
{
$image = $sys_course_path.$_course['path']."/document/".$folder.$one_image_file;
$image_height_width = resize_image($image, $thumbnail_width, $thumbnail_height, 1);
$image_height = $image_height_width[0];
$image_width = $image_height_width[1];
if ($path and $path !== "/")
{
$doc_url = $path."/".$one_image_file;
}
else
{
$doc_url = $path.$one_image_file;
}
$image_tag[] = "
";
} // foreach ($image_files_only as $one_image_file)
} // if ($slide_id=="all")
// creating the table
echo "\n";
$i = 0;
foreach ($image_tag as $image_tag_item)
{
// starting new table row
if ($i == 0)
{
echo "\n\n";
}
echo "\t| ".$image_tag_item." | \n";
if ($i % 6 == 0 and $i !== 0) // 6 cols +1
{
echo "
\n\n";
}
$i ++;
}
echo "
\n\n";
// =======================================================================
// ONE AT A TIME VIEW
// =======================================================================
// this is for viewing all the images in the slideshow one at a time.
if ($slide_id !== "all")
{
$image = $sys_course_path.$_course['path']."/document/".$folder.$image_files_only[$slide];
$image_height_width = resize_image($image, $target_width, $target_height);
$image_height = $image_height_width[0];
$image_width = $image_height_width[1];
if ($_SESSION["image_resizing"] == "resizing")
{
$height_width_tags = "width='$image_width' height='$image_height'";
}
// showing the comment of the image, Patrick Cool, 8 april 2005
// this is done really quickly and should be cleaned up a little bit using the API functions
$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
if ($path=='/')
{
$pathpart='/';
}
else
{
$pathpart=$path.'/';
}
$sql = "SELECT * FROM $tbl_documents WHERE path='".$pathpart.$image_files_only[$slide]."'";
$result = api_sql_query($sql,__FILE__,__LINE__);
$row = mysql_fetch_array($result);
echo '';
echo '';
echo '';
echo " ";
echo ' | ';
echo '
';
echo '';
echo '';
$aux= explode(".", htmlspecialchars($image_files_only[$slide]));
$ext= $aux[count($aux)-1];
echo ''.basename(htmlspecialchars($image_files_only[$slide]), '.'.$ext).'';
echo ' '.$row['comment'].' ';
list($width, $high) = getimagesize($image);
echo $width.' x '.$high.' '.round((filesize($image)/1024),2).' KB';
echo ' - '.$ext;
echo ' | ';
echo '
';
echo '';
echo '| ';
// previous slide
if ($slide > 0)
{
echo '';
}
echo '<<'.get_lang('_previous_slide');
if ($slide > 0)
{
echo " ";
}
// divider
if ($slide_id <> "all")
{
echo ' '.$next_slide.'/'.$total_slides.' ';
}
// next slide
if ($slide < $total_slides -1 and $slide_id <> "all")
{
echo "";
}
echo get_lang('_next_slide').'>>';
if ($slide > 0)
{
echo '';
}
echo ' | ';
echo '
';
echo '
';
} // if ($slide_id!=="all")
Display :: display_footer();
?>