You are here

public static function PdfTemplate::getAvailableTemplates in Views PDF 7.3

Same name and namespace in other branches
  1. 6 views_pdf_template.php \PdfTemplate::getAvailableTemplates()
  2. 7 views_pdf_template.php \PdfTemplate::getAvailableTemplates()
  3. 7.2 views_pdf_template.php \PdfTemplate::getAvailableTemplates()

This method returns a list of current uploaded files.

1 call to PdfTemplate::getAvailableTemplates()
views_pdf_get_pdf_templates in ./views_pdf.module
This method can be used to get all available templates.

File

./views_pdf_template.php, line 1066
PDF Class to generate PDFs with native PHP. This class based on FPDF and FPDI.

Class

PdfTemplate
The main class to generate the PDF.

Code

public static function getAvailableTemplates() {
  if (self::$templateList != NULL) {
    return self::$templateList;
  }
  $files_path = drupal_realpath('public://');
  $template_dir = variable_get('views_pdf_template_path', 'views_pdf_templates');
  $dir = $files_path . '/' . $template_dir;
  $templatesFiles = file_scan_directory($dir, '/.pdf$/', array(
    'nomask' => '/(\\.\\.?|CVS)$/',
  ), 1);
  $templates = array();
  foreach ($templatesFiles as $file) {
    $templates[$file->filename] = $file->name;
  }
  self::$templateList = $templates;
  return $templates;
}