SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/components/multiple_file_select.php

  1. <?php
  2. /*
  3.  * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
  4.  * :tabSize=4:indentSize=4:noTabs=true:wrap=false:maxLineLen=120:mode=php:
  5.  *
  6.  * Copyright (C) 2015 Karmabunny Pty Ltd.
  7.  *
  8.  * This file is a part of SproutCMS.
  9.  *
  10.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  11.  * of the GNU General Public License as published by the Free Software Foundation, either
  12.  * version 3 of the License, or (at your option) any later version.
  13.  *
  14.  * For more information, visit <http://getsproutcms.com>.
  15.  */
  16.  
  17. use Sprout\Helpers\Enc;
  18. use Sprout\Helpers\File;
  19. use Sprout\Helpers\Needs;
  20.  
  21.  
  22. Needs::fileGroup('moment');
  23. Needs::fileGroup('daterangepicker');
  24. Needs::fileGroup('fb');
  25. Needs::fileGroup('drag_drop_upload');
  26. ?>
  27.  
  28.  
  29. <div class="fb-multiple-file-select"
  30. data-name="<?php echo Enc::html($name); ?>"
  31. data-opts="<?php echo Enc::html(json_encode($opts)); ?>">
  32.  
  33. <div class="drag-drop__upload file-upload__area textbox">
  34. <div class="file-upload__helptext">
  35. <p>Drag-and-Drop files here to upload them.</p>
  36. <p><span class="file-upload__helptext__line2">or <a href="javascript:;" data-filter="<?= Enc::html($filter); ?>" class="select-existing-file">select an existing file</a></span></p>
  37. </div>
  38.  
  39. <div class="file-upload__uploads">
  40. <?php
  41. foreach ($data as $id) {
  42. $filename = isset($filenames[$id]) ? $filenames[$id] : $id;
  43. echo '<div class="file-upload__item file-upload__item--existing">';
  44. echo '<input type="hidden" name="', Enc::html($name), '" value="', Enc::html($id), '">';
  45. echo '<img class="file-upload__item__feedback__existing-image" src="', Enc::html(File::resizeUrl($filename, 'm200x133')), '" alt="">';
  46. echo '<p class="file-upload__item__feedback__name">', Enc::html($filename), '</p>';
  47. echo '<p class="file-upload__item__feedback__size">', File::humanSize(File::size($filename)), '</p>';
  48. echo '</div>';
  49. }
  50. ?>
  51. </div>
  52. </div>
  53. </div>
  54.