aboutsummaryrefslogtreecommitdiff
path: root/app/view/templates/media.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/view/templates/media.php')
-rw-r--r--app/view/templates/media.php77
1 files changed, 51 insertions, 26 deletions
diff --git a/app/view/templates/media.php b/app/view/templates/media.php
index 043000d..6bcba5d 100644
--- a/app/view/templates/media.php
+++ b/app/view/templates/media.php
@@ -10,47 +10,72 @@
<section class="media">
-<h1>Media</h1>
+<h1>Explorer</h1>
-<table id="medialist">
-<tr><th>id</th><th>extension</th><th>path</th><th>type</th><th>size</th><th>width</th><th>height</th><th>lengh</th></tr>
+
+<table id="dirlsit">
+<tr><th>folder</th><th>files</th></tr>
<?php
-foreach ($medialist as $media) {
- ?>
- <tr>
- <td><?= $media->id() ?></td>
- <td><?= $media->extension() ?></td>
- <td><?= $media->path() ?></td>
- <td><?= $media->type() ?></td>
- <td><?= readablesize($media->size()) ?></td>
- <td><?= $media->width() ?></td>
- <td><?= $media->height() ?></td>
- <td><?= $media->length() ?></td>
- </tr>
- <?php
+
+function treecount(array $dir, string $dirname, int $deepness, string $path, string $currentdir) {
+ if($path === $currentdir) {
+ $folder = '├─📂<strong>'. $dirname.'<strong>';
+ } else {
+ $folder = '├─📁'. $dirname;
+ }
+ echo '<tr>';
+ echo '<td><a href="?path='.$path.'">'. str_repeat(' ‎ ‎', $deepness) .$folder.'</a></td>';
+ echo '<td>'.$dir['dirfilecount'].'</td>';
+ echo '</tr>';
+ foreach ($dir as $key => $value) {
+ if(is_array($value)) {
+ treecount($value, $key, $deepness + 1, $path . DIRECTORY_SEPARATOR . $key, $currentdir);
+ }
+ }
}
+treecount($dirlist, 'media', 0, 'media', $dir);
?>
+
+
</table>
-<h1>Favicon</h1>
+<h2><?= $dir ?></h2>
+
+<form id="addfolder" action="<?= $this->url('mediafolder') ?>" method="post">
+ <label for="foldername">📂 New folder</label>
+ <input type="text" name="foldername" id="foldername" placeholder="folder name" >
+ <input type="hidden" name="dir" value="<?= $dir ?>">
+ <input type="submit" value="create folder">
+</form>
+
+<form id=addmedia action="<?= $this->url('mediaupload') ?>" method="post" enctype="multipart/form-data">
+ <label for="file">🚀 Upload files</label>
+ <input type='file' id="file" name='file[]' multiple>
+ <input type="hidden" name="dir" value="<?= $dir ?>">
+ <input type="submit" value="upload">
+</form>
+
-<table id="faviconlist">
-<tr><th>id</th><th>extension</th><th>path</th><th>size</th><th>width</th><th>height</th></tr>
+
+<table id="medialist">
+<tr><th>id</th><th>ext</th><th>type</th><th>size</th><th>width</th><th>height</th><th>lengh</th></tr>
<?php
-foreach ($faviconlist as $favicon) {
+foreach ($medialist as $media) {
?>
<tr>
- <td><?= $favicon->id() ?></td>
- <td><?= $favicon->extension() ?></td>
- <td><?= $favicon->path() ?></td>
- <td><?= readablesize($favicon->size()) ?></td>
- <td><?= $favicon->width() ?></td>
- <td><?= $favicon->height() ?></td>
+ <td><a href="<?= $media->getfullpath() ?>" target="_blank"><?= $media->id() ?></a></td>
+ <td><?= $media->extension() ?></td>
+
+ <td><?= $media->type() == 'image' ? 'image <span class="thumbnail">👁<img src="'.$media->getfullpath().'"></span>' : $media->type() ?></td>
+ <td><?= readablesize($media->size()) ?></td>
+ <td><?= $media->width() ?></td>
+ <td><?= $media->height() ?></td>
+ <td><?= $media->length() ?></td>
</tr>
<?php
}