function imce_tree_html in IMCE 7
Same name and namespace in other branches
- 6.2 inc/imce.page.inc \imce_tree_html()
- 6 inc/page.inc \imce_tree_html()
Return tree html. This is not themable because it is complex and needs to be in a proper format for js processing.
1 call to imce_tree_html()
- imce_create_tree in inc/
imce.page.inc - Create directory tree.
File
- inc/
imce.page.inc, line 1206 - Implements the file browser.
Code
function imce_tree_html(&$imce, $paths, $q = '?', $prefix = '', $eprefix = '') {
unset($paths[':access:'], $paths[':active:']);
$html = '';
foreach ($paths as $arg => $children) {
$path = $prefix . $arg;
$earg = rawurlencode($arg);
$epath = $eprefix . $earg;
if (isset($children[':access:']) || imce_directory_info($path, $imce)) {
$a = '<a href="' . $imce['url'] . $q . 'dir=' . $epath . '" title="' . $epath . '" class="folder' . (isset($children[':active:']) ? ' active' : '') . '">' . $earg . '</a>';
}
else {
$a = '<a title="' . $epath . '" class="folder disabled">' . $earg . '</a>';
}
$ul = imce_tree_html($imce, $children, $q, $path . '/', $epath . '/');
$class = $ul ? ' class="expanded"' : (isset($children[':active:']) ? ' class="leaf"' : '');
$html .= '<li' . $class . '>' . $a . $ul . '</li>';
}
if ($html) {
$html = '<ul>' . $html . '</ul>';
}
return $html;
}