Removing PHP notices/warning slideshow is an ooold code

skala
Julio Montoya 14 years ago
parent b79f4eade7
commit c26edc40d8
  1. 4
      main/document/document.php
  2. 3
      main/document/document_slideshow.inc.php
  3. 16
      main/document/slideshow.inc.php
  4. 11
      main/document/slideshow.php
  5. 22
      main/document/slideshowoptions.php

@ -154,6 +154,9 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$group_member_with_upload_rights = false;
// If the group id is set, we show them group documents
$group_properties = array();
$group_properties['directory'] = null;
if (api_get_group_id()) {
// Needed for group related stuff
require_once $lib_path.'groupmanager.lib.php';
@ -848,7 +851,6 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights){
}
/* GO TO PARENT DIRECTORY */
if ($curdirpath!= '/' && $curdirpath != $group_properties['directory'] && !$is_certificate_mode) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'">';
echo Display::display_icon('folder_up.png', get_lang('Up'),'','32');

@ -79,7 +79,8 @@ function sort_files($table) {
$slideshow_extension = strrchr($file_array['path'], '.');
$slideshow_extension = strtolower($slideshow_extension);
if (in_array($slideshow_extension, $accepted_extensions)) {
$temp[] = array('file', basename($file_array['path']), $file_array['size'], $file_array['insert_date']);
$start_date = isset($file_array['insert_date']) ? $file_array['insert_date'] : null;
$temp[] = array('file', basename($file_array['path']), $file_array['size'], $start_date);
}
}
}

@ -2,13 +2,8 @@
/* For licensing terms, see /license.txt */
/**
* @author Patrick Cool
* @package chamilo.document
* @todo convert comments to be understandable to phpDocumentor
*/
/*
Description:
*
* Description:
This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
files (since these are the files that can be viewed in a browser) and creates
a slideshow with it by allowing to go to the next/previous image.
@ -20,9 +15,12 @@ Description:
This file has two large sections.
1. code that belongs in document.php, but to avoid clutter I put the code here
2. the function resize_image that handles the image resizing
*/
* @author Patrick Cool
* @package chamilo.document
* @todo convert comments to be understandable to phpDocumentor
*/
/**
* This function calculates the resized width and resized heigt according to the source and target widths
@ -38,7 +36,7 @@ Description:
function resize_image($image, $target_width, $target_height, $slideshow = 0) {
// Modifications by Ivan Tcholakov, 04-MAY-2009.
$result = array();
if ($_SESSION['image_resizing'] == 'resizing' or $slideshow == 1) {
if ( (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing']== 'resizing') or $slideshow == 1) {
$new_sizes = api_resize_image($image, $target_width, $target_height);
$result[] = $new_sizes['height'];
$result[] = $new_sizes['width'];

@ -162,14 +162,11 @@ if (isset($_POST['Submit'])) {
$_SESSION["image_resizing_height"] = null;
}
}
$target_width = $target_height = null;
// The target height and width depends if we choose resizing or no resizing
if ($_SESSION["image_resizing"] == "resizing") {
if (isset($_SESSION["image_resizing"]) && $_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 */
@ -229,8 +226,8 @@ if ($slide_id != 'all') {
$image_height = $image_height_width[0];
$image_width = $image_height_width[1];
if ($_SESSION['image_resizing'] == 'resizing') {
$height_width_tags = null;
if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
$height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
}

@ -49,20 +49,8 @@ $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname );
Display::display_header($originalToolName, 'Doc');
// can't remember why I put this here. This is probably obsolete code
// 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) {
$slide = $slide_id;
} else {
$slide = 0;
}
$previous_slide = $slide - 1;
$next_slide = $slide + 1;
$total_slides = count($image_files_only);
*/
$image_resizing = isset($_SESSION['image_resizing']) ? $_SESSION['image_resizing'] : null;
?>
<style type="text/css">
<!--
@ -91,7 +79,7 @@ function disableresizing() { //v2.0
document.options.height.className='disabled_input';
}
window.onload = <?php echo $_SESSION['image_resizing'] == 'resizing' ? 'enableresizing' : 'disableresizing'; ?>;
window.onload = <?php echo $image_resizing == 'resizing' ? 'enableresizing' : 'disableresizing'; ?>;
//-->
</script>
@ -101,6 +89,7 @@ echo '<div class="actions">';
echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'">'.Display::return_icon('back.png').get_lang('BackTo').' '.get_lang('DocumentsOverview').'</a>';
echo '<a href="slideshow.php?curdirpath='.$pathurl.'">'.Display::return_icon('images_gallery.gif').get_lang('BackTo').' '.get_lang('SlideShow').'</a>';
echo '</div>';
?>
<form action="slideshow.php?curdirpath=<?php echo $pathurl; ?>" method="post" name="options" id="options">
@ -110,7 +99,6 @@ echo '</div>';
<div class="row">
<div class="label">
<input class="checkbox" name="radio_resizing" type="radio" onClick="disableresizing()" value="noresizing" <?php
$image_resizing = $_SESSION['image_resizing'];
if ($image_resizing == 'noresizing' || $image_resizing == '') {
echo ' checked';
}
@ -123,7 +111,7 @@ echo '</div>';
<div class="row">
<div class="label">
<input class="checkbox" name="radio_resizing" type="radio" onClick="javascript: enableresizing();" value="resizing" <?php
$image_resizing = $_SESSION['image_resizing'];
if ($image_resizing == 'resizing') {
echo ' checked';
$width = $_SESSION['image_resizing_width'];

Loading…
Cancel
Save