Commit 055058f1 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Sort my files listing

parent c23d6dc9
......@@ -46,8 +46,7 @@ $filedata = get_records_sql_array('SELECT a.id, a.artefacttype, a.mtime, f.size,
FROM ' . $prefix . 'artefact a
INNER JOIN ' . $prefix . 'artefact_file_files f ON f.artefact = a.id
WHERE a.owner = ' . $userid . '
AND a.parent' . $infolder . '
ORDER BY a.artefacttype DESC', '');
AND a.parent' . $infolder, '');
if (!$filedata) {
$filedata = array();
......@@ -58,6 +57,13 @@ else {
}
}
// Sort folders before files; then use nat sort order on title.
function fileobjcmp ($a, $b) {
return strnatcasecmp(($a->artefacttype == 'folder') . $a->title,
($b->artefacttype == 'folder') . $b->title);
}
usort($filedata, "fileobjcmp");
$result = array(
'count' => count($filedata),
'limit' => $limit,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment