[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_templates/tmpl/template/ -> default_tree_media.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_templates
   6   *
   7   * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Router\Route;
  14  
  15  // Legacy is the default
  16  if (!count($this->mediaFiles)) {
  17      return;
  18  }
  19  
  20  ksort($this->mediaFiles, SORT_STRING);
  21  ?>
  22  
  23  <ul class="directory-tree treeselect">
  24      <?php foreach ($this->mediaFiles as $key => $value) : ?>
  25          <?php if (is_array($value)) : ?>
  26              <?php
  27              $keyArray  = explode('/', rtrim($key, '\\'));
  28              $fileArray = explode('/', $this->fileName);
  29              $count     = 0;
  30  
  31              $keyArrayCount = count($keyArray);
  32  
  33              if (count($fileArray) >= $keyArrayCount) {
  34                  for ($i = 0; $i < $keyArrayCount; $i++) {
  35                      if ($keyArray[$i] === $fileArray[$i]) {
  36                          $count++;
  37                      }
  38                  }
  39  
  40                  if ($count === $keyArrayCount) {
  41                      $class = 'folder show';
  42                  } else {
  43                      $class = 'folder';
  44                  }
  45              } else {
  46                  $class = 'folder';
  47              }
  48  
  49              ?>
  50              <li class="<?php echo $class; ?>">
  51                  <a class="folder-url" href="">
  52                      <span class="icon-folder icon-fw" aria-hidden="true"></span>&nbsp;<?php $explodeArray = explode('/', $key);
  53                      echo $this->escape(end($explodeArray)); ?>
  54                  </a>
  55                  <?php echo $this->mediaTree($value); ?>
  56              </li>
  57          <?php endif; ?>
  58          <?php if (is_object($value)) : ?>
  59              <li>
  60                  <a class="file" href="<?php echo Route::_('index.php?option=com_templates&view=template&id=' . $this->id . '&file=' . $value->id . '&isMedia=1'); ?>">
  61                      <span class="icon-file-alt" aria-hidden="true"></span>&nbsp;<?php echo $this->escape($value->name); ?>
  62                  </a>
  63              </li>
  64          <?php endif; ?>
  65      <?php endforeach; ?>
  66  </ul>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer