Example #1
0
function scandirSorted($path)
{
    $sortedData = array();
    $dircont = scandir($path);
    if (count($dircont) > 0) {
        foreach ($dircont as $file) {
            if (is_file($path . $file)) {
                if (ValidFileExtension($file)) {
                    array_push($sortedData, array('is_file' => true, 'name' => $file, 'path' => PathToUrl($path) . $file, 'p' => $path . $file, 's' => filesize($path . $file)));
                }
            } elseif ($file !== '.' && $file !== '..') {
                $count = count(scandirSorted($path . $file . '/'));
                array_unshift($sortedData, array('is_file' => false, 'name' => $file, 'path' => $path . $file . '/', 'i' => $count));
            }
        }
    }
    return $sortedData;
}
Example #2
0
<?php

if (isset($_SESSION['tinymce_toggle_view'])) {
    $view = $_SESSION['tinymce_toggle_view'];
} else {
    $view = 'grid';
}
$current_folder_content = scandirSorted($current_folder);
if (count($current_folder_content) > 0 and CanAcessLibrary()) {
    $html = '';
    foreach ($current_folder_content as $c) {
        if ($view == 'list') {
            if ($c['is_file'] == false) {
                $html .= '<tr>
				<td>
				<i class="icon-folder-open"></i>&nbsp;
				<a class="lib-folder" href="" rel="' . urlencode($c['path']) . '" title="' . $c['name'] . '">
					' . TrimText($c['name'], 50) . '
				</a>
				</td>
				<td width="20%">
				' . $c['i'] . ' Items
				</td>
				<td width="10%">
					<a href="" class="transparent change-folder" title="Change Name" rel="' . $c['name'] . '"><i class="icon-pencil"></i></a>&nbsp;&nbsp;
					<a href="" class="transparent delete-folder" rel="' . urlencode($c['path']) . '" title="Delete"><i class="icon-trash"></i></a>
				</td>
				</tr>';
            } else {
                $html .= '<tr>
				<td>