-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
66 lines (53 loc) · 1.55 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
require_once 'treeFiles.php';
try {
$treeFiles = $getTreeFiles('./', 2);
$message = "A lista de pasta foi carregada com sucesso!";
} catch (Exception $e) {
$treeFiles = [];
$message = $e->getMessage();
}
$processView = function($tree, $id = 'noCollapse') use(&$processView){
echo "<ul class='collapse in' id='{$id}'>";
foreach ($tree as $file){
echo "<li class='parent_li'>";
echo "<a title='Verkleinern' data-toggle='collapse' href='#".md5($file['path'])."'>";
if($file['type'] == 'file')
echo "<i class='glyphicon glyphicon-file'></i>";
else
echo "<i class='glyphicon glyphicon-folder-open'></i>";
echo $file['name'];
echo "</a>";
if($file['type'] == 'dir')
echo $processView($file['tree'], md5($file['path']));
else
echo "<ul></ul>";
echo "</li>";
}
echo "</ul>";
};
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tree Files</title>
<!-- Bootstrap -->
<link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h5><?= $message;?></h5>
<main>
<div id="test" class="tree">
<ul>
<?php $processView($treeFiles);?>
</ul>
</div>
</main>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
</html>