server/apps/files/ajax/list.php

45 lines
1 KiB
PHP
Raw Normal View History

<?php
// only need filesystem apps
$RUNTIME_APPTYPES=array('filesystem');
// Init owncloud
2012-05-03 10:23:29 +00:00
OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false;
$data = array();
// Make breadcrumb
2012-08-28 22:50:12 +00:00
if($doBreadcrumb) {
$breadcrumb = array();
$pathtohere = "/";
foreach( explode( "/", $dir ) as $i ){
2012-08-28 22:50:12 +00:00
if( $i != "" ) {
$pathtohere .= "$i/";
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
}
}
2012-05-06 21:00:36 +00:00
$breadcrumbNav = new OCP\Template( "files", "part.breadcrumb", "" );
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
}
// make filelist
$files = array();
2011-07-29 19:36:03 +00:00
foreach( OC_Files::getdirectorycontent( $dir ) as $i ){
2012-05-01 19:07:08 +00:00
$i["date"] = OCP\Util::formatDate($i["mtime"] );
$files[] = $i;
}
2012-05-06 21:00:36 +00:00
$list = new OCP\Template( "files", "part.list", "" );
2012-06-11 17:07:51 +00:00
$list->assign( "files", $files, false );
$data = array('files' => $list->fetchPage());
2012-05-03 10:23:29 +00:00
OCP\JSON::success(array('data' => $data));