<?php
$dirs = $GLOBALS['dir']->getSubDirs();
echo "<table border=\"0\" class=\"dirs\">\n";
echo "<tr>\n";
$cnt = 0;
$width = 100 / _NUMCOLUMNS;
$nrows = count($dirs);
foreach ($dirs as $dir) {
$cnt++;
echo "<td class=\"cell\" valign=\"top\" width=\"{$width}%\">\n";
echo "<a href=\"?dir="._encodeuri($dir->path)."\" title=\"".stripslashes($dir->title)."\">";
// directory images
if (!empty($dir->thumbimage)) {
echo "<img class=\"fade\" src=\""._DIRTHUMBURL."/{$dir->thumbimage}\" alt=\"{$dir->image}\" align=\"left\" border=\"0\" />\n";
} else {
echo "<img class=\"fade\" src=\""._ICONSURL."/dir.gif\" border=\"0\" alt=\"*\" /> ";
}
echo _truncate(stripslashes($dir->title),30)."</a>\n";
// show directory summary
if (_DIRSUMMARIES) {
$nfiles = count($dir->getFiles());
$ndirs = count($dir->getSubDirs());
if ($nfiles > 0 && $ndirs > 0) {
$cstring = "{$nfiles} files, {$ndirs} dirs";
} elseif ($nfiles > 0 && $ndirs == 0) {
$cstring = "{$nfiles} files";
} elseif ($nfiles == 0 && $ndirs > 0) {
$cstring = "{$ndirs} dirs";
} elseif ($nfiles == 0 && $ndirs ==0) {
$cstring = "empty";
}
echo "<small>($cstring)</small><br />";
}
if (!empty($dir->desc)) {
echo "<div class=\"description\">"._parseText($dir->desc)."</div>\n";
}
echo "</td>\n";
if ($cnt / _NUMCOLUMNS == floor($cnt / _NUMCOLUMNS) && $cnt < $nrows) {
echo "</tr>\n<tr>\n";
}
}
echo "</table>\n";
?>