"MDL-23295, added navigation"

This commit is contained in:
Dongsheng Cai
2010-07-20 04:54:57 +00:00
parent d23ae9277d
commit eed6f2e784
+17
View File
@@ -131,6 +131,23 @@ class repository_local extends repository {
$list[] = $node;
}
}
} else {
// if file doesn't exist, build path nodes root of current context
$pathnodes = array();
$fileinfo = $browser->get_file_info($context, null, null, null, null, null);
$encodedpath = base64_encode(serialize($fileinfo->get_params()));
$pathnodes[] = array('name'=>$fileinfo->get_visible_name(), 'path'=>$encodedpath);
$level = $fileinfo->get_parent();
while ($level) {
$encodedpath = base64_encode(serialize($level->get_params()));
$pathnodes[] = array('name'=>$level->get_visible_name(), 'path'=>$encodedpath);
$level = $level->get_parent();
}
if (!empty($pathnodes) && is_array($pathnodes)) {
$pathnodes = array_reverse($pathnodes);
$ret['path'] = $pathnodes;
}
$list = array();
}
$ret['list'] = array_filter($list, array($this, 'filter'));
return $ret;