Security::remove_XSS($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
if (isset($_SESSION['image_files_only'])) {
$image_files_only = $_SESSION['image_files_only'];
}
// Calculating the current slide, next slide, previous slide and the number of slides
if ($slide_id != 'all') {
$slide = $slide_id ? $slide_id : 0;
$previous_slide = $slide - 1;
$next_slide = $slide + 1;
}
$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"] = Security::remove_XSS($_POST['radio_resizing']);
if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
//echo "resizing";
$_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
$_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
} else {
//echo "unsetting the session heighte and width";
$_SESSION["image_resizing_width"] = null;
$_SESSION["image_resizing_height"] = null;
}
}
// 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;
if (is_array($image_files_only)) {
foreach ($image_files_only as $one_image_file) {
$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
if (file_exists($image)) {
$image_height_width = resize_image($image, $thumbnail_width, $thumbnail_height, 1);
$image_height = $image_height_width[0];
$image_width = $image_height_width[1];
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
$image_tag[] = '';
}
}
}
}
// Creating the table
$html_table = '';
echo '';
$i = 0;
$count_image = count($image_tag);
$number_image = 6;
$number_iteration = ceil($count_image/$number_image);
$p = 0;
for ($k = 0; $k < $number_iteration; $k++) {
echo '';
for ($i = 0; $i < $number_image; $i++) {
if (!is_null($image_tag[$p])) {
echo '';
echo ' | ';
}
$p++;
}
echo '
';
}
echo '
';
/* 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];
if (file_exists($image)) {
$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='".Database::escape_string($pathpart.$image_files_only[$slide])."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
echo '';
echo '';
echo '';
echo $row['title'];
echo ' | ';
echo '
';
echo '';
echo '';
if ($slide < $total_slides - 1 && $slide_id != 'all') {
echo "";
} else {
echo "";
}
echo "";
echo '';
echo ' | ';
echo '
';
echo '';
echo '';
echo $row['comment'];
echo ' | ';
echo '
';
echo '
';
echo '';
if (api_is_allowed_to_edit(null, true)) {
echo '';
echo '';
echo ' ';
$aux = explode('.', htmlspecialchars($image_files_only[$slide]));
$ext = $aux[count($aux) - 1];
echo $image_files_only[$slide].' ';
list($width, $high) = getimagesize($image);
echo $width.' x '.$high.' ';
echo round((filesize($image)/1024), 2).' KB';
echo ' - '.$ext;
echo ' | ';
echo '
';
echo '';
echo '';
if ($_SESSION['image_resizing'] == 'resizing') {
$resize_info = get_lang('_resizing').' ';
$resize_widht = $_SESSION["image_resizing_width"].' x ';
$resize_height = $_SESSION['image_resizing_height'];
} else {
$resize_info = get_lang('_no_resizing').' ';
}
echo $resize_info;
echo $resize_widht;
echo $resize_height;
echo ' | ';
echo '
';
}
echo '
';
echo '
';
// Back forward buttons
echo '';
} else {
Display::display_warning_message(get_lang('FileNotFound'));
}
}
Display :: display_footer();