function fillpdf_forms_admin in FillPDF 7
Same name and namespace in other branches
- 7.2 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 147 - 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) {
$pdf_file = file_load($pdf_form->fid);
$link = file_create_url($pdf_file->uri);
$row = array(
check_plain($pdf_form->admin_title),
check_plain($pdf_form->title),
l($pdf_file->uri, $link),
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('fillpdf_service')) {
$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',
'#attributes' => array(
'accept' => 'application/pdf',
),
);
$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 FillPDF'), 'admin/config/media/fillpdf'),
)) . '</p>',
);
drupal_set_message(t('FillPDF is not configured.'), 'error');
}
return $form;
}