You are here

function theme_filedepot_files in filedepot 6

Same name and namespace in other branches
  1. 7 filedepot.module \theme_filedepot_files()

Theme function that is used when displaying the files via the native Drupal node view.

1 theme call to theme_filedepot_files()
filedepot_view in ./filedepot.module
Implementation of hook_view().

File

./filedepot.module, line 1154
filedepot.module Filedepot: File Management Module developed by Nextide www.nextide.ca Full featured document managment module with a desktop application feel. Integrated role and user permissions to secure folders, automated notifications, Tag Cloud…

Code

function theme_filedepot_files($node) {
  $filedepot = filedepot_filedepot();
  $layout_url = base_path() . drupal_get_path('module', 'filedepot');
  $retval = '';
  $cid = db_result(db_query("SELECT cid FROM {filedepot_categories} WHERE nid=%d", $node->nid));
  if ($cid > 0) {
    $retval = theme('filedepot_native_filelisting_header');
    $query = db_query("SELECT fid,fname,extension as ext FROM {filedepot_files} WHERE cid=%d", $cid);
    while ($A = db_fetch_array($query)) {
      if (array_key_exists($A['ext'], $filedepot->iconmap)) {
        $icon = $filedepot->iconmap[$A['ext']];
      }
      else {
        $ext = end(explode(".", $A['fname']));
        if (array_key_exists($ext, $filedepot->iconmap)) {
          $icon = $filedepot->iconmap[$ext];
        }
        else {
          $icon = $filedepot->iconmap['default'];
        }
      }
      $icon = "{$layout_url}/css/images/{$icon}";
      $filelink = l($A['fname'], "filedepot_download/{$node->nid}/{$A['fid']}", array(
        'attributes' => array(
          'title' => t('Download File'),
        ),
      ));
      $retval .= theme('filedepot_native_filerecord', $icon, $filelink);
    }
  }
  return $retval;
}