You are here

function views_handler_comment_upload_all_files in Comment Upload 5

Display all files attached to a given node via comment_upload.

1 call to views_handler_comment_upload_all_files()
views_handler_comment_upload_listed_files in ./comment_upload_views.inc

File

./comment_upload_views.inc, line 156

Code

function views_handler_comment_upload_all_files($fieldinfo, $fielddata, $value, $data, $listed = FALSE) {
  $and = $listed ? ' AND list = 1' : '';
  $links = array();
  $result = db_query("SELECT * FROM {comment_upload_files} WHERE nid = %d {$and}", $data->nid);
  while ($file = db_fetch_object($result)) {

    // link/nolink use file filename; linkdesc/nolinkdesc use file description
    if ($fielddata['options'] == 'link' || $fielddata['options'] == 'nolink') {
      $display_string = $file->filename;
    }
    else {
      $display_string = $file->description;
    }
    if ($fielddata['options'] == 'nolink' || $fielddata['options'] == 'nolinkdesc') {
      $links[] = check_plain($display_string);
    }
    else {
      $links[] = l($display_string, check_url(file_create_url($file->filepath)));
    }
  }
  return implode(' | ', $links);
}