diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-01-18 16:35:20 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-01-18 16:35:20 +0100 |
commit | 227a2a35d64db87d889f7a44101f11a117b8e06a (patch) | |
tree | 9854f830e728c66d165006ac1eaeae7958baf785 /app/fn/fn.php | |
parent | 57ef3a9a12738081b3ab26559076bfb2b43e75db (diff) | |
download | wcms-227a2a35d64db87d889f7a44101f11a117b8e06a.tar.gz wcms-227a2a35d64db87d889f7a44101f11a117b8e06a.zip |
refactoring medialist
Diffstat (limited to 'app/fn/fn.php')
-rw-r--r-- | app/fn/fn.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/fn/fn.php b/app/fn/fn.php index ccccfb9..af02202 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -1,5 +1,7 @@ <?php +use Wcms\Medialist; + function readablesize($bytes) { $format = ' %d %s'; @@ -207,6 +209,28 @@ function array_diff_assoc_recursive($array1, $array2) { } +/** + * Generate a folder tree based on reccurive array + */ +function treecount(array $dir, string $dirname, int $deepness, string $path, string $currentdir, Medialist $mediaopt) +{ + if ($path === $currentdir) { + $folder = '├─📂<strong>' . $dirname . '<strong>'; + } else { + $folder = '├─📁' . $dirname; + } + echo '<tr>'; + echo '<td><a href="' . $mediaopt->getpathadress($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, $mediaopt); + } + } +} + + |