diff options
Diffstat (limited to 'app/view/templates')
-rw-r--r-- | app/view/templates/media.php | 64 | ||||
-rw-r--r-- | app/view/templates/mediamenu.php | 10 |
2 files changed, 28 insertions, 46 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(' ', $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> diff --git a/app/view/templates/mediamenu.php b/app/view/templates/mediamenu.php index 9044194..560025a 100644 --- a/app/view/templates/mediamenu.php +++ b/app/view/templates/mediamenu.php @@ -7,14 +7,14 @@ <form id=addmedia action="<?= $this->url('mediaupload') ?>" method="post" enctype="multipart/form-data"> <label for="file">🚀 Upload file(s)</label> <input type='file' id="file" name='file[]' multiple required> - <input type="hidden" name="dir" value="<?= $dir ?>"> + <input type="hidden" name="dir" value="<?= $mediaopt->dir() ?>"> <input type="submit" value="upload"> </form> <h2>Folder</h2> <form id="folderadd" action="<?= $this->url('mediafolderadd') ?>" method="post"> <label for="foldername">📂 New folder</label> <input type="text" name="foldername" id="foldername" placeholder="folder name" required> - <input type="hidden" name="dir" value="<?= $dir ?>"> + <input type="hidden" name="dir" value="<?= $mediaopt->dir() ?>"> <input type="submit" value="create folder"> </form> </div> @@ -29,7 +29,7 @@ <h2>Folder</h2> <form action="<?= $this->url('mediafolderdelete') ?>" id="deletefolder" method="post" class="hidephone"> - <input type="hidden" name="dir" value="<?= $dir ?>/"> + <input type="hidden" name="dir" value="<?= $mediaopt->dir() ?>/"> <input type="checkbox" name="deletefolder" id="confirmdeletefolder" value="1"> <label for="confirmdeletefolder">Delete actual folder and all it's content</label> </br> @@ -39,7 +39,7 @@ <h2>Move</h2> <form action="<?= $this->url('mediaedit') ?>" method="post" id="mediaedit"> - <input type="hidden" name="path" value="<?= $dir ?>"> + <input type="hidden" name="path" value="<?= $mediaopt->dir() ?>"> <label for="moveto">Move selected medias to a new directory</label> </br> <select name="dir" id="moveto" > @@ -73,7 +73,7 @@ <p>Use this code to print the content of the actual folder in a page</p> - <code>%MEDIA?path=<?= substr($dir, 6) ?>&sortby=<?= $opt['sortby'] ?>&order=<?= $opt['order'] ?>%</code> + <code><?= $mediaopt->getquery() ?></code> </div> </details> |