Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fillpdf
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
fillpdf
Commits
1969c51e
Commit
1969c51e
authored
9 years ago
by
Kevin Kaland
Browse files
Options
Downloads
Patches
Plain Diff
Issue #2359213: Remove some ported D7 code.
parent
0443439e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fillpdf.module
+0
-143
0 additions, 143 deletions
fillpdf.module
with
0 additions
and
143 deletions
fillpdf.module
+
0
−
143
View file @
1969c51e
...
...
@@ -29,149 +29,6 @@ function fillpdf_help($path, $arg) {
}
}
/**
* Implements hook_menu().
*
* @todo: Remove once converted.
*/
function
fillpdf_menu
()
{
$access
=
array
(
'administer pdfs'
);
$items
=
array
();
// fillpdf?fid=10&nids[]=1&webforms[0][nid]=2&webforms[0][sid]=3
$items
[
'fillpdf'
]
=
array
(
'page callback'
=>
'fillpdf_parse_uri'
,
// Can't use access callback. We need the arguments, but they're passed as $GET. Will access-check in fillpdf_merge_pdf
'access arguments'
=>
array
(
'access content'
),
'type'
=>
MENU_CALLBACK
,
);
// --------- Form ------------------------
$items
[
'admin/structure/fillpdf'
]
=
array
(
'title'
=>
'FillPDF'
,
'description'
=>
'Manage your PDFs'
,
'page callback'
=>
'drupal_get_form'
,
'page arguments'
=>
array
(
'fillpdf_forms_admin'
),
'access arguments'
=>
$access
,
);
$items
[
'admin/structure/fillpdf/%'
]
=
array
(
'title'
=>
'Edit PDF form'
,
'page callback'
=>
'drupal_get_form'
,
'page arguments'
=>
array
(
'fillpdf_form_edit'
,
3
),
'access arguments'
=>
$access
,
);
$items
[
'admin/structure/fillpdf/%/delete'
]
=
array
(
'page callback'
=>
'drupal_get_form'
,
'page arguments'
=>
array
(
'fillpdf_form_delete_confirm'
,
3
),
'access arguments'
=>
$access
,
'type'
=>
MENU_CALLBACK
,
);
$items
[
'admin/structure/fillpdf/%/export'
]
=
array
(
'title'
=>
'Export FillPDF field mappings'
,
'page callback'
=>
'fillpdf_form_export'
,
'page arguments'
=>
array
(
3
),
'access arguments'
=>
$access
,
);
$items
[
'admin/structure/fillpdf/%/import'
]
=
array
(
'title'
=>
'Import FillPDF field mappings'
,
'page callback'
=>
'drupal_get_form'
,
'page arguments'
=>
array
(
'fillpdf_form_import_form'
,
3
),
'access arguments'
=>
$access
,
);
// --------- Fields ------------------------
$items
[
'admin/structure/fillpdf/%/add'
]
=
array
(
'title'
=>
'Add field'
,
'page callback'
=>
'fillpdf_field'
,
'page arguments'
=>
array
(
4
,
3
),
'access arguments'
=>
$access
,
'type'
=>
MENU_LOCAL_TASK
,
);
$items
[
'admin/structure/fillpdf/%/edit/%'
]
=
array
(
'page callback'
=>
'fillpdf_field'
,
'page arguments'
=>
array
(
4
,
3
,
5
),
'access arguments'
=>
$access
,
);
return
$items
;
}
/**
* Gets a link to the prinable PDF, merged with the passed-in data
* @param array/int $nids or $nid, if you pass in one value it will merge with that node.
* If array, it will merge with multiple nodes, with later nids overriding previous ones.
* @param array $webforms Array of webforms, of this strucure: array('nid'=>1, 'sid'=>1)
* @param bool $sample TRUE if you want to populate the form with its own field-names (to get a gist of PDF)
*/
function
fillpdf_pdf_link
(
$fid
,
$nids
=
NULL
,
$webform_arr
=
NULL
,
$sample
=
FALSE
)
{
$nids_uri
=
$webforms_uri
=
""
;
if
(
is_array
(
$nids
))
{
$nids_uri
=
'&nids[]='
.
implode
(
'&nids[]='
,
$nids
);
}
elseif
(
isset
(
$nids
))
{
$nids_uri
=
"&nids[]=
{
$nids
}
"
;
}
if
(
is_array
(
$webform_arr
))
{
if
(
$webform_arr
[
'nid'
])
{
$webform_arr
=
array
(
$webform_arr
);
}
foreach
(
$webform_arr
as
$key
=>
$webform
)
{
$webforms_uri
.
=
"&webforms[
{
$key
}
][nid]=
{
$webform
[
'nid'
]
}
"
;
}
$webforms_uri
.
=
$webform
[
'sid'
]
?
"&webforms[
{
$key
}
][sid]=
{
$webform
[
'sid'
]
}
"
:
""
;
}
$sample
=
$sample
?
'&sample=true'
:
''
;
return
url
(
''
,
array
(
'absolute'
=>
TRUE
))
.
"fillpdf?fid=
{
$fid
}{
$nids_uri
}{
$webforms_uri
}{
$sample
}
"
;
}
/**
* Get the data and form that need to be merged, from the $_GET, and print the PDF
*
* @see fillpdf_pdf_link()
* for $_GET params
*/
function
fillpdf_parse_uri
()
{
// Avoid undefined index warnings, but don't clobber existing values
$_GET
+=
array
(
'nid'
=>
NULL
,
'nids'
=>
NULL
,
'webform'
=>
NULL
,
'webforms'
=>
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
=
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
(
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
);
}
/**
* Constructs a page from scratch (pdf content-type) and sends it to the
* browser or saves it, depending on if a custom path is configured or not.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment