You are here

function webfm_views_handler_file_all_files in Web File Manager 5

Same name and namespace in other branches
  1. 5.2 webfm_views.inc \webfm_views_handler_file_all_files()
1 string reference to 'webfm_views_handler_file_all_files'
webfm_views_tables in ./webfm_views.inc

File

./webfm_views.inc, line 151

Code

function webfm_views_handler_file_all_files($fieldinfo, $fielddata, $value, $data) {
  $links = array();
  $query = "SELECT wf.* FROM {webfm_file} wf INNER JOIN {webfm_attach} wa ON wf.fid = wa.fid WHERE wa.nid = %d ORDER BY %s";
  $result = db_query($query, $data->nid, 'wa.weight');
  while ($file = db_fetch_object($result)) {
    if (variable_get('webfm_display_title', '') && $file->ftitle) {
      $fname = urldecode($file->ftitle);
    }
    else {
      $fname = strrev(substr(strrev($file->fpath), 0, strpos(strrev($file->fpath), '/')));
    }
    if ($fielddata['options'] == 'nolink') {
      $links[] = check_plain($fname);
    }
    else {
      $links[] = l(check_plain($fname), 'webfm_send/' . $file->fid);
    }
  }
  return implode(' | ', $links);
}