default_tree.php
1.55 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
<?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;
ksort($this->files, SORT_NATURAL);
?>
<ul class='nav nav-list directory-tree'>
<?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; ?>">
<a class='folder-url nowrap' href=''>
<span class='icon-folder'> <?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>
<a class="file nowrap" href='<?php echo JRoute::_('index.php?option=com_templates&view=template&id=' . $this->id . '&file=' . $value->id) ?>'>
<span class='icon-file'> <?php echo $this->escape($value->name); ?></span>
</a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>