SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/admin/file_contents_thumbs.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. use Sprout\Helpers\Csrf;
  17. use Sprout\Helpers\Enc;
  18. use Sprout\Helpers\File;
  19. use Sprout\Helpers\FileConstants;
  20. use Sprout\Helpers\Needs;
  21.  
  22.  
  23. Needs::fileGroup('sprout/admin_contents_thumbs');
  24. Needs::fileGroup('sprout/admin_multiselect_tools');
  25. $category_ctlr = $controller_name . '_category';
  26. ?>
  27.  
  28.  
  29. <form action="" method="get" class="selection-action">
  30. <?= Csrf::token(); ?>
  31.  
  32. <div class="file-thumbs -clearfix">
  33.  
  34. <?php
  35. foreach ($items as $row) {
  36. echo '<div class="thumb">';
  37.  
  38. echo '<a class="image-link" href="SITE/admin/edit/file/', $row['id'], '" title="', Enc::html($row['name']), '">';
  39. if ($row['type'] == FileConstants::TYPE_IMAGE) {
  40. echo '<img src="', File::resizeUrl($row['filename'], 'c180x180'), '" class="img">';
  41. } else {
  42.  
  43. if($row['type'] == FileConstants::TYPE_DOCUMENT) {
  44. $placeholderIcon = 'icon-insert_drive_file';
  45. } elseif($row['type'] == FileConstants::TYPE_SOUND) {
  46. $placeholderIcon = 'icon-volume_up';
  47. } elseif($row['type'] == FileConstants::TYPE_VIDEO) {
  48. $placeholderIcon = 'icon-videocam';
  49. } elseif($row['type'] == FileConstants::TYPE_OTHER) {
  50. $placeholderIcon = 'icon-help';
  51. } else {
  52. $placeholderIcon = '';
  53. }
  54. echo '<div class="image-link__placeholder"><div class="image-link__placeholder__content"><div class="image-link__placeholder__icon icon-before ' . $placeholderIcon . '"></div>', FileConstants::$type_names[$row['type']], '</div></div>';
  55. }
  56. echo '</a>';
  57.  
  58. echo '<div class="file-info">';
  59. echo '<div class="name">';
  60. echo '<a href="SITE/admin/edit/file/', $row['id'], '" title="', Enc::html($row['name']), '">', Enc::html($row['name']), '</a>';
  61. echo '</div>';
  62. echo '<div class="selection">';
  63. echo '<div class="field-element field-element--white field-element--checkbox">';
  64. echo '<div class="field-element__input-set">';
  65. echo '<div class="fieldset-input">';
  66. echo '<input type="checkbox" id="file-list-', $row['id'], '" name="ids[]" value="', $row['id'], '">';
  67. echo '<label for="file-list-', $row['id'], '"><span class="-vis-hidden">Select file</span></label>';
  68. echo '</div>';
  69. echo '</div>';
  70. echo '</div>';
  71. echo '</div>';
  72.  
  73. echo '<div class="delete"><a title="Delete" class="icon-before icon-close" href="SITE/admin/delete/file/', $row['id'], '"><span class="-vis-hidden">Delete</span></a></div>';
  74. echo '</div>';
  75.  
  76. echo '</div>';
  77. }
  78. ?>
  79.  
  80. </div>
  81.  
  82. <script type="text/javascript">
  83.  
  84. $(document).ready(function(){
  85. $(".file-thumbs .thumb").matchHeight();
  86. });
  87.  
  88. </script>
  89.  
  90.  
  91. <div class="selected-tools">
  92. <strong>Selected <?php echo strtolower($friendly_name); ?>:</strong>
  93.  
  94. <ul class="inline-list inline-list-broken">
  95. <li>
  96. <a href="SITE/admin/extra/<?php echo $controller_name; ?>/multi_categorise" class="selection-action">Categorise</a>
  97. </li>
  98. <li>
  99. <a href="SITE/admin/call/<?php echo $controller_name; ?>/postJsonMultiTag" class="selection-action multiple-add-tag">Add tag</a>
  100. </li>
  101. <li>
  102. <a href="SITE/admin/extra/<?php echo $controller_name; ?>/multi_delete" class="selection-action">Delete</a>
  103. </li>
  104. </ul>
  105. </div>
  106.  
  107. <?php if (isset($category)): ?>
  108. <p>
  109. <b><i><?php echo Enc::html($category['name']); ?></i> category:</b>
  110. <a href="SITE/admin/extra/<?php echo $category_ctlr; ?>/reorder/<?php echo $category['id']; ?>">Reorder items</a>
  111. &bull;
  112. <a href="SITE/admin/edit/<?php echo $category_ctlr; ?>/<?php echo $category['id']; ?>">Edit</a>
  113. &bull;
  114. <a href="SITE/admin/delete/<?php echo $category_ctlr; ?>/<?php echo $category['id']; ?>">Delete</a>
  115. </p>
  116. <?php endif; ?>
  117. </form>
  118.  
  119.