-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arbol de ficheros completo via helper
- Loading branch information
Showing
5 changed files
with
99 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
function _tree( $a ) | ||
{ | ||
#_::stop($a); | ||
if ( empty( $a ) ) return; | ||
|
||
$s = ''; | ||
foreach ( $a as $k => $v ) | ||
{ | ||
if ( is_array( $v ) or ! $v ) | ||
{ | ||
$s .= "<li>" . basename( $k ) . "/</li>"; | ||
$s .= _tree( $v ); | ||
|
||
} | ||
else | ||
{ | ||
$s .= "<li>$v</li>"; | ||
} | ||
} | ||
return "<ul id=\"$k\">$s</ul>"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
class Ficheros | ||
{ | ||
public function ver( $get ) | ||
{ | ||
// CONTENIDO DEL DIRECTORIO | ||
return _fs::readDirs( APP_PATH . "views/pages/" ); | ||
} | ||
|
||
|
||
/*public function ver( $get ) | ||
{ | ||
// DIRECTORIO POR DEFECTO | ||
$a['directorio'] = empty( $get['d'] ) ? '' : $get['d']; | ||
// NO SE PERMITE INTRODUCIR .. | ||
$a['directorio'] = str_replace( '..', '', $a['directorio'] ); | ||
// DIRECTORIO PADRE REAL | ||
$a['padre'] = realpath( APP_PATH . "views/pages/{$a['directorio']}/.." ) . '/'; | ||
// DIRECTORIO PADRE RELATIVO | ||
$a['padre'] = str_replace( APP_PATH . 'views/pages/', '', $a['padre'] ); | ||
// CONTENIDO DEL DIRECTORIO | ||
$a['ficheros'] = _fs::readDir( APP_PATH . "views/pages/{$a['directorio']}" ); | ||
// ARCHIVO POR DEFECTO | ||
$a['fichero'] = empty( $get['f'] ) ? '' : $get['f']; | ||
return $a; | ||
}*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
View::helpers( 'tree' ); | ||
|
||
echo _tree( $ficheros ); | ||
|
||
|
||
/*if ( $a['directorio'] and $a['directorio'] <> '/' ) echo "<li class=\"directory up\"><a href=\"?d={$a['padre']}\">..</a></li>"; | ||
if ( $a['ficheros'] ) | ||
{ | ||
foreach ( $a['ficheros'] as $k => $v ) | ||
{ | ||
if ( is_array( $v ) ) | ||
{ | ||
$k = basename( $k ); | ||
echo "<li class=\"directory collapsed\"><a href=\"?d={$a['directorio']}$k/\">$k/</a></li>"; | ||
} | ||
else | ||
{ | ||
$pathinfo = pathinfo( $v ); | ||
$ext = ! empty( $pathinfo['extension'] ) ? $pathinfo['extension'] : 'txt'; | ||
echo "<li class=\"file ext_$ext\"><a href=\"?d={$a['directorio']}/&f=$v\">$v</a></li>"; | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
echo 'Vacio'; | ||
}*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters