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.php64
1 files changed, 23 insertions, 41 deletions
diff --git a/app/view/templates/media.php b/app/view/templates/media.php
index 6b62cbb..12d4a2f 100644
--- a/app/view/templates/media.php
+++ b/app/view/templates/media.php
@@ -7,7 +7,7 @@
<?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'media', 'pagelist' => $pagelist]) ?>
- <?php $this->insert('mediamenu', ['dir' => $dir, 'user' => $user, 'pathlist' => $pathlist, 'opt' => $opt]) ?>
+ <?php $this->insert('mediamenu', ['user' => $user, 'pathlist' => $pathlist, 'mediaopt' => $mediaopt]) ?>
<main class="media">
@@ -21,80 +21,67 @@
<?php
- function treecount(array $dir, string $dirname, int $deepness, string $path, string $currentdir, array $opt)
- {
- if ($path === $currentdir) {
- $folder = '├─📂<strong>' . $dirname . '<strong>';
- } else {
- $folder = '├─📁' . $dirname;
- }
- echo '<tr>';
- echo '<td><a href="?path=' . $path . '&sortby=' . $opt['sortby'] . '&order=' . $opt['order'] . '">' . str_repeat('&nbsp;&nbsp;', $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, $opt);
- }
- }
- }
-
- treecount($dirlist, 'media', 0, 'media', $dir, $opt);
+
+ treecount($dirlist, 'media', 0, 'media', $mediaopt->dir(), $mediaopt);
?>
</table>
</div>
+ </div>
+</nav>
+
+<div id="fildter">
+ <div class="block">
<h2>filter</h2>
<div class="scroll">
<form action="" method="get">
<fieldset>
<legend>Type</legend>
<ul>
- <li><input type="checkbox" name="type[]" id="image" value="image" <?= in_array('image', $opt['type']) ? 'checked' : '' ?>><label for="image">image</label></li>
- <li><input type="checkbox" name="type[]" id="sound" value="sound" <?= in_array('sound', $opt['type']) ? 'checked' : '' ?>><label for="sound">sound</label></li>
- <li><input type="checkbox" name="type[]" id="video" value="video" <?= in_array('video', $opt['type']) ? 'checked' : '' ?>><label for="video">video</label></li>
- <li><input type="checkbox" name="type[]" id="other" value="other" <?= in_array('other', $opt['type']) ? 'checked' : '' ?>><label for="other">other</label></li>
+ <li><input type="checkbox" name="type[]" id="image" value="image" <?= in_array('image', $mediaopt->type()) ? 'checked' : '' ?>><label for="image">image</label></li>
+ <li><input type="checkbox" name="type[]" id="sound" value="sound" <?= in_array('sound', $mediaopt->type()) ? 'checked' : '' ?>><label for="sound">sound</label></li>
+ <li><input type="checkbox" name="type[]" id="video" value="video" <?= in_array('video', $mediaopt->type()) ? 'checked' : '' ?>><label for="video">video</label></li>
+ <li><input type="checkbox" name="type[]" id="other" value="other" <?= in_array('other', $mediaopt->type()) ? 'checked' : '' ?>><label for="other">other</label></li>
</ul>
</fieldset>
<fieldset>
<legend>Sort</legend>
<select name="sortby" id="sortby">
- <option value="id" <?= $opt['sortby'] === 'id' ? 'selected' : '' ?>>id</option>
- <option value="type" <?= $opt['sortby'] === 'type' ? 'selected' : '' ?>>type</option>
- <option value="size" <?= $opt['sortby'] === 'size' ? 'selected' : '' ?>>size</option>
+ <option value="id" <?= $mediaopt->sortby() === 'id' ? 'selected' : '' ?>>id</option>
+ <option value="type" <?= $mediaopt->sortby() === 'type' ? 'selected' : '' ?>>type</option>
+ <option value="size" <?= $mediaopt->sortby() === 'size' ? 'selected' : '' ?>>size</option>
</select>
</br>
- <input type="radio" name="order" id="asc" value="1" <?= $opt['order'] == 1 ? 'checked' : '' ?>><label for="asc">ascending</label>
+ <input type="radio" name="order" id="asc" value="1" <?= $mediaopt->order() == 1 ? 'checked' : '' ?>><label for="asc">ascending</label>
</br>
- <input type="radio" name="order" id="desc" value="-1" <?= $opt['order'] == -1 ? 'checked' : '' ?>><label for="desc">descending</label>
+ <input type="radio" name="order" id="desc" value="-1" <?= $mediaopt->order() == -1 ? 'checked' : '' ?>><label for="desc">descending</label>
</br>
</fieldset>
- <input type="hidden" name="path" value="<?= $dir ?>">
+ <input type="hidden" name="path" value="<?= $mediaopt->path() ?>">
<input type="submit" value="filter">
</form>
</div>
</div>
-</nav>
-
+ </div>
<section>
<div class="block">
-<h2><?= $dir ?></h2>
+<h2>/<?= $mediaopt->dir() ?></h2>
<table id="medialist">
<tr>
<th>x</th>
- <th><a href="?path=<?= $dir ?>&sortby=id&order=<?php echo ($opt['order'] * -1); ?>">id</a></th>
+ <th><a href="<?= $mediaopt->getsortbyadress('id') ?>">id</a></th>
<th>ext</th>
- <th><a href="?path=<?= $dir ?>&sortby=type&order=<?php echo ($opt['order'] * -1); ?>">type</a></th>
- <th><a href="?path=<?= $dir ?>&sortby=size&order=<?php echo ($opt['order'] * -1); ?>">size</a></th>
+ <th><a href="<?= $mediaopt->getsortbyadress('type') ?>">type</a></th>
+ <th><a href="<?= $mediaopt->getsortbyadress('size') ?>">size</a></th>
<th>width</th>
<th>height</th>
<th>lengh</th>
@@ -103,7 +90,6 @@
<?php
foreach ($medialist as $media) {
- if(in_array($media->type(), $opt['type'])) {
?>
<tr>
<td><input type="checkbox" name="id[]" value="<?= $media->getfulldir() ?>" form="mediaedit" id="media_<?= $media->id() ?>"></td>
@@ -117,11 +103,7 @@ foreach ($medialist as $media) {
<td class="code"><code><?= $media->getcode() ?></code></td>
</tr>
<?php
- }
-
}
-
-
?>
</table>