You are here

function fillpdf_field in FillPDF 6

Same name and namespace in other branches
  1. 7.2 fillpdf.admin.inc \fillpdf_field()
  2. 7 fillpdf.admin.inc \fillpdf_field()
1 string reference to 'fillpdf_field'
fillpdf_menu in ./fillpdf.module
Implementation of hook_menu().

File

./fillpdf.admin.inc, line 559
Allows mappings of PDFs to site content

Code

function fillpdf_field($op, $fid, $pdf_key = NULL) {
  if (is_numeric($fid)) {
    $pdf_form = db_fetch_object(db_query("SELECT * FROM {fillpdf_forms} WHERE fid = %d", $fid));
  }
  if (!$pdf_form) {
    drupal_not_found();
    exit;
  }
  if ($op == 'add') {
    drupal_set_title(check_plain($pdf_form->title));
  }
  else {
    if ($op != 'edit') {
      return fillpdf_form_overview($pdf_form);
    }
    else {
      if ($pdf_key) {
        $pdf_key = rawurldecode(rawurldecode($pdf_key));
        $field = db_fetch_object(db_query("SELECT * FROM {fillpdf_fields} WHERE pdf_key = '%s' AND fid = %d", $pdf_key, $fid));
        if (!$field) {
          drupal_not_found();
          exit;
        }
        drupal_set_title(check_plain($field->label));

        //$type = $field->type;
      }
    }
  }
  return drupal_get_form('fillpdf_field_edit', $pdf_form, $field);
}