Exemplo n.º 1
0
 public function actionView()
 {
     $path = Yii::getAlias('@backend') . '/views';
     $array = AppFile::recursiveDirectory($path, '');
     return $this->render('view', ['array' => $array]);
 }
Exemplo n.º 2
0
 /**
  * @param $path
  * @param $base_path
  *
  * @return array
  */
 public static function recursiveDirectory($path, $base_path)
 {
     $array = array();
     $items = scandir($path);
     foreach ($items as $item) {
         if ($item != "." && $item != "..") {
             if (is_file($path . "/" . $item)) {
                 $array[]['item'] = array('is_dir' => FALSE, 'path' => $path, 'relative' => str_replace($base_path, '', $path), 'file' => $item, 'extension' => AppFile::fileExtension($item));
             }
         }
     }
     foreach ($items as $item) {
         if ($item != "." && $item != "..") {
             if (is_dir($path . "/" . $item)) {
                 $array[]['item'] = array('is_dir' => TRUE, 'path' => $path, 'relative' => str_replace($base_path, '', $path), 'folder' => $item, 'depth' => AppFile::folderCountInPath(str_replace($base_path, '', $path . "/" . $item)), 'sub_folders' => AppFile::recursiveDirectory($path . "/" . $item, $base_path));
             }
         }
     }
     return $array;
 }
Exemplo n.º 3
0
    ?>
        <div><a href="/?r=<?php 
    echo $item['folder'];
    ?>
" target="_blank"><?php 
    echo $item['folder'];
    ?>
</a></div>
    <?php 
}
?>
</div>
<div class="boundary">
    <div class="title">Frontend</div>
    <?php 
$array = AppFile::recursiveDirectory(Yii::getAlias('@frontend') . '/views', '', '');
?>
    <?php 
foreach ($array as $item) {
    ?>
        <?php 
    $item = $item['item'];
    ?>
        <?php 
    if (!$item['is_dir']) {
        continue;
    }
    ?>
        <div><a href="/?r=<?php 
    echo $item['folder'];
    ?>