You are here

function views_pdf_templates in Views PDF 7

Same name and namespace in other branches
  1. 7.3 views_pdf.admin.inc \views_pdf_templates()

Page to manage PDF templates.

2 string references to 'views_pdf_templates'
PdfTemplate::getAvailableTemplates in ./views_pdf_template.php
This method returns a list of current uploaded files.
views_pdf_menu in ./views_pdf.module
Implements hook_menu().

File

./views_pdf.admin.inc, line 62
Theme function for enhence the views admin interface vor PDF options.

Code

function views_pdf_templates($form, &$form_state) {
  $rows = array();
  foreach (_list_pdfs($pdf_dir) as $file_name => $name) {
    $rows[] = array(
      array(
        'data' => l($name, file_create_url("{$pdf_dir}/{$file_name}")),
      ),
      array(
        'data' => l(t('Delete'), "admin/structure/views/pdfs/delete/{$file_name}"),
      ),
    );
  }
  $form['decription']['#markup'] = t('<h4>The files listed and uploaded here are available as templates for use in <em>PDF Page</em> view displays.</h4>');
  $form['pdf_list']['#markup'] = theme_table(array(
    'header' => array(
      t('Template files'),
      t('Action'),
    ),
    'rows' => $rows,
    'attributes' => array(),
    'caption' => '',
    'colgroups' => array(),
    'sticky' => 0,
    'empty' => '',
  ));
  $form['template_file'] = array(
    '#type' => 'file',
    '#title' => t('Upload new template file'),
    '#description' => t('Select a PDF to upload for use as a template'),
  );
  $form['pdf_dir'] = array(
    '#type' => 'value',
    '#value' => $pdf_dir,
  );
  $form['actions'] = array(
    '#type' => 'actions',
    'submit' => array(
      '#type' => 'submit',
      '#value' => t('Upload'),
      '#submit' => array(
        'views_pdf_templates_submit',
      ),
    ),
  );
  return $form;
}