slideshowoptions.php 6.1 KB

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