This repository was archived by the owner on Jul 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdefault_tree.php
More file actions
68 lines (60 loc) · 1.69 KB
/
default_tree.php
File metadata and controls
68 lines (60 loc) · 1.69 KB
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
67
68
<?php
/**
* @package Joomla.Administrator
* @subpackage com_templates
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Router\Route;
ksort($this->files, SORT_NATURAL);
?>
<ul class="directory-tree treeselect">
<?php foreach ($this->files as $key => $value) : ?>
<?php if (is_array($value)) : ?>
<?php
$keyArray = explode('/', $key);
$fileArray = explode('/', $this->fileName);
$count = 0;
$keyArrayCount = count($keyArray);
if (count($fileArray) >= $keyArrayCount)
{
for ($i = 0; $i < $keyArrayCount; $i++)
{
if ($keyArray[$i] === $fileArray[$i])
{
$count++;
}
}
if ($count === $keyArrayCount)
{
$class = 'folder show';
}
else
{
$class = 'folder';
}
}
else
{
$class = 'folder';
}
?>
<li class="<?php echo $class; ?> has-subtree">
<a class="folder-url" href="javascript:void(0);">
<span class="icon-folder-2" aria-hidden="true"></span>
<span class="folder-name"> <?php $explodeArray = explode('/', $key); echo $this->escape(end($explodeArray)); ?></span>
</a>
<?php echo $this->directoryTree($value); ?>
</li>
<?php endif; ?>
<?php if (is_object($value)) : ?>
<li class="has-subtree">
<a class="file" href='<?php echo Route::_('index.php?option=com_templates&view=template&id=' . $this->id . '&file=' . $value->id); ?>'>
<span class="icon-file" aria-hidden="true"></span> <?php echo $this->escape($value->name); ?>
</a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>