You are here

function asset_directory_view in Asset 5.2

Same name and namespace in other branches
  1. 6 asset.types.inc \asset_directory_view()

Implementation of hook_asset_type('view') for directory asset type

Related topics

File

./asset.types.inc, line 242
This file is included by asset_asset_type() and includes all the file and directory specific functions

Code

function asset_directory_view($asset) {
  $items = array();
  if ($asset->aid) {
    $parent = asset_load($asset->pid);
    $parent->link_title = '..';
    $items[] = $parent;
  }
  $result = db_query('SELECT a.*, (a.type = "directory") as directory FROM {asset} a WHERE a.pid=%d ORDER BY directory DESC, a.title', $asset->aid);
  while ($row = db_fetch_object($result)) {
    $a = asset_load($row->aid);
    $items[] = $a;
  }
  return theme('asset_directory_browse', $items);
}