You are here

function fillpdf_parse_uri in FillPDF 7.2

Same name and namespace in other branches
  1. 6 fillpdf.module \fillpdf_parse_uri()
  2. 7 fillpdf.module \fillpdf_parse_uri()

Get the data and form that need to be merged, from the $_GET, and print the PDF

for $_GET params

See also

fillpdf_pdf_link()

1 string reference to 'fillpdf_parse_uri'
fillpdf_menu in ./fillpdf.module
Implements hook_menu().

File

./fillpdf.module, line 203
Allows mappings of PDFs to site content

Code

function fillpdf_parse_uri() {

  // Avoid undefined index warnings, but don't clobber existing values
  $_GET += array(
    'nid' => NULL,
    'nids' => NULL,
    'webform' => NULL,
    'webforms' => NULL,
    'uc_order_id' => NULL,
    'uc_order_ids' => NULL,
    'uc_order_product_id' => NULL,
    'uc_order_product_ids' => NULL,
    'fid' => NULL,
    'sample' => NULL,
    'download' => NULL,
    'flatten' => NULL,
  );
  $force_download = FALSE;
  $flatten = TRUE;

  //this function called multiple times, cut down on DB calls

  //    static $get;if($get)return $get;
  $sample = $_GET['sample'];

  // is this just the PDF populated with sample data?
  $fid = $_GET['fid'];
  $nids = $webforms = $uc_order_ids = $uc_order_product_ids = array();
  if ($_GET['nid'] || $_GET['nids']) {
    $nids = $_GET['nid'] ? array(
      $_GET['nid'],
    ) : $_GET['nids'];
  }
  if ($_GET['webform'] || $_GET['webforms']) {
    $webforms = $_GET['webform'] ? array(
      $_GET['webform'],
    ) : $_GET['webforms'];
  }
  if ($_GET['uc_order_id'] || $_GET['uc_order_ids']) {
    $uc_order_ids = $_GET['uc_order_id'] ? array(
      $_GET['uc_order_id'],
    ) : $_GET['uc_order_ids'];
  }
  if ($_GET['uc_order_product_id'] || $_GET['uc_order_product_ids']) {
    $uc_order_product_ids = $_GET['uc_order_product_id'] ? array(
      $_GET['uc_order_product_id'],
    ) : $_GET['uc_order_product_ids'];
  }
  if (isset($_GET['download']) && (int) $_GET['download'] == 1) {
    $force_download = TRUE;
  }
  if (isset($_GET['flatten']) && (int) $_GET['flatten'] == 0) {
    $flatten = FALSE;
  }
  fillpdf_merge_pdf($fid, $nids, $webforms, $sample, $force_download, FALSE, $flatten, TRUE, $uc_order_ids, $uc_order_product_ids);
}