aboutsummaryrefslogtreecommitdiff
path: root/app/fn
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-01-18 16:35:20 +0100
committervincent-peugnet <v.peugnet@free.fr>2020-01-18 16:35:20 +0100
commit227a2a35d64db87d889f7a44101f11a117b8e06a (patch)
tree9854f830e728c66d165006ac1eaeae7958baf785 /app/fn
parent57ef3a9a12738081b3ab26559076bfb2b43e75db (diff)
downloadwcms-227a2a35d64db87d889f7a44101f11a117b8e06a.tar.gz
wcms-227a2a35d64db87d889f7a44101f11a117b8e06a.zip
refactoring medialist
Diffstat (limited to 'app/fn')
-rw-r--r--app/fn/fn.php24
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('&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, $mediaopt);
+ }
+ }
+}
+
+