document_slideshow.inc.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php // $Id: document_slideshow.inc.php 9246 2006-09-25 13:24:53Z bmol $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. For a full list of contributors, see "credits.txt".
  9. The full license can be read in "license.txt".
  10. This program is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU General Public License
  12. as published by the Free Software Foundation; either version 2
  13. of the License, or (at your option) any later version.
  14. See the GNU General Public License for more details.
  15. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  16. ==============================================================================
  17. */
  18. /**
  19. ==============================================================================
  20. Developped by Patrick Cool
  21. patrick.cool@UGent.be
  22. Ghent University
  23. Mai 2004
  24. http://icto.UGent.be
  25. Please bear in mind that this is only an alpha release.
  26. I wrote this quite quick and didn't think too much about it in advance.
  27. It is not perfect at all but it is workable and usefull (I think)
  28. Do not consider this as a powerpoint replacement, although it has
  29. the same starting point.
  30. * This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
  31. * files (since these are the files that can be viewed in a browser) and creates
  32. * a slideshow with it by allowing to go to the next/previous image.
  33. * You can also have a quick overview (thumbnail view) of all the images in
  34. * that particular folder.
  35. *
  36. * Each slideshow is folder based. Only
  37. * the images of the chosen folder are shown.
  38. *
  39. * This file has two large sections.
  40. * 1. code that belongs in document.php, but to avoid clutter I put the code here
  41. * (not present) 2. the function resize_image that handles the image resizing
  42. *
  43. * @author Patrick Cool, responsible author
  44. * @author Roan Embrechts, minor cleanup
  45. * @package dokeos.document
  46. ==============================================================================
  47. */
  48. /*
  49. ==============================================================================
  50. general code that belongs in document.php
  51. this code should indeed go in documents.php but since document.php is already a really ugly file with
  52. too much things in one file , I decided to put the code for document.php here and to include this
  53. file into document.php
  54. ==============================================================================
  55. */
  56. // resetting the images of the slideshow = destroying the slideshow
  57. if ($_GET['action']=="exit_slideshow")
  58. {
  59. $_SESSION["image_files_only"]=null;
  60. unset($image_files_only);
  61. }
  62. // We check if there are images in this folder by searching the extensions for .jpg, .gif, .png
  63. // grabbing the list of all the documents of this folder
  64. //$all_files=$fileList['name'];
  65. $array_to_search = (is_array($docs_and_folders))?$docs_and_folders:array();
  66. if(count($array_to_search) > 0) {
  67. while(list ($key) = each ($array_to_search))
  68. {
  69. $all_files[] = basename($array_to_search[$key]['path']);
  70. //echo basename($array_to_search[$key]['path']).'<br>';
  71. }
  72. }
  73. // storing the extension of all the documents in an array
  74. // and checking if there is a .jpg, .jpeg, .gif or .png file
  75. // if this is the case a slideshow can be made.
  76. $all_extensions=array();
  77. $image_present=0;
  78. if ( count($all_files) > 0 )
  79. {
  80. foreach ($all_files as $file)
  81. {
  82. $slideshow_extension=strrchr($file,".");
  83. $slideshow_extension=strtolower($slideshow_extension);
  84. $all_extensions[]=$slideshow_extension;
  85. if ($slideshow_extension==".jpg" OR $slideshow_extension==".jpeg" OR $slideshow_extension==".gif" or $slideshow_extension==".png")
  86. {
  87. $image_present=1;
  88. $image_files_only[]=$file;
  89. }
  90. }
  91. }
  92. $_SESSION["image_files_only"]=$image_files_only;
  93. ?>