You are here

function theme_uc_file_admin_files_form_show in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_file/uc_file.admin.inc \theme_uc_file_admin_files_form_show()

Returns HTML for uc_file_admin_files_form_show().

See also

uc_file_admin_files_form_show_files()

1 theme call to theme_uc_file_admin_files_form_show()
uc_file_admin_files_form in uc_file/uc_file.admin.inc
Form builder for file products admin.

File

uc_file/uc_file.admin.inc, line 186
File administration menu items.

Code

function theme_uc_file_admin_files_form_show($form) {
  $output = '';
  $header = $form['#header'];

  // Format the file table.
  $rows = array();
  foreach ($form['file_select'] as $fid => $value) {

    // We only want numeric fid's
    if (!is_numeric($fid)) {
      continue;
    }
    $filename = drupal_render($form['file_select'][$fid]['filename']);

    // Make directories bold + italic (or whatever's in the CSS).
    $class = is_dir(uc_file_qualify_file($filename)) ? 'uc-file-directory-view' : '';
    $rows[] = array(
      array(
        'data' => drupal_render($form['file_select'][$fid]['check']),
      ),
      array(
        'data' => $filename,
        'class' => $class,
      ),
      array(
        'data' => l(drupal_render($form['file_select'][$fid]['title']), 'node/' . drupal_render($form['file_select'][$fid]['nid'])),
      ),
      array(
        'data' => drupal_render($form['file_select'][$fid]['model']),
      ),
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No file downloads available.'),
        'colspan' => 4,
      ),
    );
  }

  // Render everything.
  $output .= '<p>' . t('File downloads can be attached to any Ubercart product as a product feature. For security reasons the <a href="!download_url">file downloads directory</a> is separated from the Drupal <a href="!file_url">file system</a>. Here are the list of files (and their associated Ubercart products) that can be used for file downloads.', array(
    '!download_url' => url('admin/store/settings/products/edit/features', array(
      'query' => 'destination=admin/store/products/files',
    )),
    '!file_url' => url('admin/settings/file-system'),
  )) . '</p>';
  $output .= drupal_render($form['uc_file_action']);
  $output .= drupal_render($form['uc_file_select']);
  $output .= theme('table', $header, $rows);
  $output .= theme('pager', NULL, UC_FILE_PAGER_SIZE, 0);
  $output .= drupal_render($form);
  return $output;
}