You are here

function template_preprocess_filedepot_fileversion in filedepot 6

Same name and namespace in other branches
  1. 7 lib-theme.php \template_preprocess_filedepot_fileversion()

File

./lib-theme.php, line 570
lib-theme.php Theme support functions for the module

Code

function template_preprocess_filedepot_fileversion(&$variables) {
  global $user;
  $filedepot = filedepot_filedepot();
  $variables['site_url'] = base_path();
  list($fid, $fname, $file_version, $ver_note, $ver_size, $ver_date, $submitter, $nid) = array_values($variables['versionRec']);
  $variables['LANG_version_note'] = t('Version Note');
  $variables['LANG_size'] = t('Size');
  $variables['LANG_download_message'] = t('Download Message');
  $variables['LANG_author'] = t('Author');
  $variables['LANG_download'] = t('Download File');
  $variables['LANG_edit'] = t('Edit File');
  $variables['LANG_delete'] = t('Delete File');
  $ver_shortdate = strftime($filedepot->shortdate, $ver_date);
  $ver_author = db_result(db_query("SELECT name from {users} WHERE uid=%d", $submitter));
  $cid = db_result(db_query("SELECT cid from {filedepot_files} WHERE fid=%d", $fid));
  $icon = $filedepot
    ->getFileIcon($fname);
  $variables['fileicon'] = "{$variables['layout_url']}/css/images/{$icon}";
  $variables['fid'] = $fid;
  $variables['nid'] = $nid;
  $variables['vname'] = filter_xss($fname);
  $variables['ver_shortdate'] = $ver_shortdate;
  $variables['ver_author'] = $ver_author;
  $variables['ver_size'] = filedepot_formatFileSize($ver_size);
  $variables['ver_fileicon'] = $icon;
  $variables['file_versionnum'] = '(V' . $file_version . ')';
  $variables['file_version'] = $file_version;
  $variables['edit_version_note'] = filter_xss($ver_note);
  $variables['version_note'] = nl2br(filter_xss($ver_note));
  $variables['show_edit_version'] = 'none';
  $variables['show_delete_version'] = 'none';
  if ($user->uid == $submitter or $filedepot
    ->checkPermission($cid, 'admin')) {
    $variables['show_edit_version'] = '';
    $variables['show_delete_version'] = '';
  }
  $variables['cssid'] = $variables['zebra'] == 'odd' ? 1 : 2;
}