function fillpdf_forms_admin in FillPDF 7.2
Same name and namespace in other branches
- 7 fillpdf.admin.inc \fillpdf_forms_admin()
Manage your existing forms, or upload a new one
1 string reference to 'fillpdf_forms_admin'
- fillpdf_menu in ./
fillpdf.module - Implements hook_menu().
File
- ./
fillpdf.admin.inc, line 23 - Allows mappings of PDFs to site content
Code
function fillpdf_forms_admin($form, &$form_state) {
$result = db_query("SELECT admin_title, title, url, fid FROM {fillpdf_forms} ORDER BY admin_title");
$header = array(
t('Administrative title'),
t('Title'),
t('Location'),
array(
'data' => t('Operations'),
'colspan' => '4',
),
);
$rows = array();
foreach ($result as $pdf_form) {
$row = array(
check_plain($pdf_form->admin_title),
check_plain($pdf_form->title),
check_plain($pdf_form->url),
l(t('Edit'), "admin/structure/fillpdf/{$pdf_form->fid}"),
l(t('Delete'), "admin/structure/fillpdf/{$pdf_form->fid}/delete"),
l(t('Export field mappings'), "admin/structure/fillpdf/{$pdf_form->fid}/export"),
l(t('Import field mappings'), "admin/structure/fillpdf/{$pdf_form->fid}/import"),
);
$rows[] = $row;
}
if (!$rows) {
$rows[] = array(
array(
'data' => t('No content available.'),
'colspan' => 7,
),
);
}
$form['existing_forms'] = array(
'#markup' => theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'fillpdf',
),
)),
);
// Only show PDF upload form if fillpdf is configured.
if (variable_get('pdf_forms_handler')) {
$form['#attributes'] = array(
'enctype' => "multipart/form-data",
);
$form['upload_pdf'] = array(
'#type' => 'file',
'#title' => 'Upload',
'#description' => 'Upload a PDF template to create a new form',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Upload'),
'#weight' => 15,
);
}
else {
$form['message'] = array(
'#markup' => '<p>' . t('Before you can upload PDF files, you must !link.', array(
'!link' => l(t('configure PDF Forms API'), 'admin/config/development/pdf_forms'),
)) . '</p>',
);
drupal_set_message(t('PDF Forms API is not configured.'), 'error');
}
return $form;
}