slideshowoptions.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use ChamiloSession as Session;
  4. /**
  5. * @author Patrick Cool
  6. *
  7. * @package chamilo.document
  8. *
  9. * @author Patrick Cool, patrick.cool@UGent.be, Ghent University, May 2004, http://icto.UGent.be
  10. * Please bear in mind that this is only an beta release.
  11. * I wrote this quite quick and didn't think too much about it in advance.
  12. * It is not perfect at all but it is workable and usefull (I think)
  13. * Do not consider this as a powerpoint replacement, although it has
  14. * the same starting point.
  15. * This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
  16. * files (since these are the files that can be viewed in a browser) and creates
  17. * a slideshow with it by allowing to go to the next/previous image.
  18. * You can also have a quick overview (thumbnail view) of all the images in
  19. * that particular folder.
  20. * Maybe it is important to notice that each slideshow is folder based. Only
  21. * the images of the chosen folder are shown.
  22. * On this page the options of the slideshow can be set: maintain the original file
  23. * or resize the file to a given width.
  24. */
  25. require_once __DIR__.'/../inc/global.inc.php';
  26. api_protect_course_script();
  27. $path = Security::remove_XSS($_GET['curdirpath']);
  28. $pathurl = urlencode($path);
  29. // Breadcrumb navigation
  30. $url = 'document.php?curdirpath='.$pathurl;
  31. $originaltoolname = get_lang('Documents');
  32. $interbreadcrumb[] = ['url' => $url, 'name' => $originaltoolname];
  33. $url = 'slideshow.php?curdirpath='.$pathurl;
  34. $originaltoolname = get_lang('SlideShow');
  35. $interbreadcrumb[] = ['url' => $url, 'name' => $originaltoolname];
  36. // Because $nametools uses $_SERVER['PHP_SELF'] for the breadcrumbs instead of $_SERVER['REQUEST_URI'], I had to
  37. // bypass the $nametools thing and use <b></b> tags in the $interbreadcrump array
  38. $url = 'slideshowoptions.php?curdirpath='.$pathurl;
  39. $originaltoolname = '<b>'.get_lang('SlideshowOptions').'</b>';
  40. $interbreadcrumb[] = ['url' => $url, 'name' => $originaltoolname];
  41. Display::display_header($originaltoolname, 'Doc');
  42. $image_resizing = Session::read('image_resizing');
  43. ?>
  44. <script>
  45. function enableresizing() { //v2.0
  46. document.options.width.disabled=false;
  47. //document.options.width.className='enabled_input';
  48. document.options.height.disabled=false;
  49. //document.options.height.className='enabled_input';
  50. }
  51. function disableresizing() { //v2.0
  52. document.options.width.disabled=true;
  53. //document.options.width.className='disabled_input';
  54. document.options.height.disabled=true;
  55. //document.options.height.className='disabled_input';
  56. }
  57. window.onload = <?php echo $image_resizing == 'resizing' ? 'enableresizing' : 'disableresizing'; ?>;
  58. </script>
  59. <?php
  60. $actions = '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
  61. $actions .= '<a href="slideshow.php?curdirpath='.$pathurl.'">'.Display::return_icon('slideshow.png', get_lang('BackTo').' '.get_lang('SlideShow'), '', ICON_SIZE_MEDIUM).'</a>';
  62. echo Display::toolbarAction('toolbar-slideshow', [$actions]);
  63. ?>
  64. <div class="panel panel-default">
  65. <div class="panel-body">
  66. <form action="slideshow.php?curdirpath=<?php echo $pathurl; ?>" method="post" name="options" id="options" class="form-horizontal">
  67. <legend><?php echo get_lang('SlideshowOptions'); ?></legend>
  68. <div class="radio">
  69. <label>
  70. <input name="radio_resizing" type="radio" onClick="disableresizing()" value="noresizing" <?php
  71. if ($image_resizing == 'noresizing' || $image_resizing == '') {
  72. echo ' checked';
  73. }
  74. ?>>
  75. </label>
  76. <?php echo '<b>'.get_lang('NoResizing').'</b>, '.get_lang('NoResizingComment'); ?>
  77. </div>
  78. <div class="radio">
  79. <label>
  80. <input name="radio_resizing" type="radio" onClick="disableresizing()" value="autoresizing" <?php
  81. if ($image_resizing == 'resizing_auto' || $image_resizing == '') {
  82. echo ' checked';
  83. }
  84. ?>>
  85. </label>
  86. <?php echo '<b>'.get_lang('ResizingAuto').'</b>, '.get_lang('ResizingAutoComment'); ?>
  87. </div>
  88. <div class="radio">
  89. <label>
  90. <input class="checkbox" name="radio_resizing" type="radio" onClick="javascript: enableresizing();" value="resizing" <?php
  91. if ($image_resizing == 'resizing') {
  92. echo ' checked';
  93. $width = Session::read('image_resizing_width');
  94. $height = Session::read('image_resizing_height');
  95. }
  96. ?>>
  97. </label>
  98. <?php echo '<b>'.get_lang('Resizing').'</b>, '.get_lang('ResizingComment'); ?>
  99. </div>
  100. <div class="form-group">
  101. <label class="col-sm-1 control-label"><?php echo get_lang('Width'); ?></label>
  102. <div class="col-sm-3">
  103. <input class="form-control" name="width" type="text" id="width" <?php
  104. if ($image_resizing == 'resizing') {
  105. echo ' value="'.$width.'"';
  106. echo ' class="enabled_input"';
  107. } else {
  108. echo ' class="disabled_input"';
  109. }
  110. ?> >
  111. </div>
  112. <div class="col-sm-8"></div>
  113. </div>
  114. <div class="form-group">
  115. <label class="col-sm-1 control-label"><?php echo get_lang('Height'); ?></label>
  116. <div class="col-sm-3">
  117. <input class="form-control" name="height" type="text" id="height" <?php
  118. if ($image_resizing == 'resizing') {
  119. echo ' value="'.$height.'"';
  120. echo ' class="enabled_input"';
  121. } else {
  122. echo ' class="disabled_input"';
  123. }
  124. ?> >
  125. </div>
  126. <div class="col-sm-8"></div>
  127. </div>
  128. <div class="form-group">
  129. <div class="col-sm-12">
  130. <button type="submit" class="btn btn-default" name="Submit" value="Save" ><?php echo get_lang('Save'); ?></button>
  131. </div>
  132. </div>
  133. </form>
  134. </div>
  135. </div>
  136. <?php
  137. Display::display_footer();