Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
c4a94d75
Commit
c4a94d75
authored
Jul 10, 2018
by
Carsten Rose
Browse files
Export Excel: Prepare download to accept SIP parameter - still not working.
parent
9a4b9c6c
Pipeline
#687
passed with stage
in 1 minute and 33 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/helper/OnString.php
View file @
c4a94d75
...
...
@@ -107,4 +107,42 @@ class OnString {
return
true
;
}
/**
* Split the wkthtml Parameter between:
* - general 'urlParam' for the specific website (page which will be converted to PDF).
* - `wkthml` Parameter. Those will always start with '-' and control wkhtml how to render the PDF.
* - '_sip' - to activate that `urlParam` parameters will be SIP encoded.
*
* @param string $urlParamString
* @param array $rcArgs
* @param bool $rcSipEncode
*
* @return array The remaining 'real' URL parameter to call the T3 page.
* @throws UserFormException
*/
public
static
function
splitParam
(
$urlParamString
,
array
&
$rcArgs
,
&
$rcSipEncode
)
{
$urlParamNew
=
array
();
$rcArgs
[
WKHTML_OPTION_VIEWPORT
]
=
WKHTML_OPTION_VIEWPORT_VALUE
;
// Forces wkhtml to render Bootstrap page in 'md', not 'xs'
$urlParam
=
KeyValueStringParser
::
parse
(
$urlParamString
,
'='
,
'&'
,
KVP_IF_VALUE_EMPTY_COPY_KEY
);
foreach
(
$urlParam
as
$key
=>
$value
)
{
switch
(
substr
(
$key
,
0
,
1
))
{
case
'-'
:
$rcArgs
[
$key
]
=
$value
;
break
;
case
'_'
:
if
(
$key
==
DOWNLOAD_SIP_ENCODE_PARAMETER
)
{
$rcSipEncode
=
true
;
}
break
;
default
:
$urlParamNew
[
$key
]
=
$value
;
break
;
}
}
return
$urlParamNew
;
}
}
extension/qfq/qfq/report/Download.php
View file @
c4a94d75
...
...
@@ -15,7 +15,9 @@ namespace qfq;
require_once
(
__DIR__
.
'/../Constants.php'
);
require_once
(
__DIR__
.
'/../store/Session.php'
);
require_once
(
__DIR__
.
'/../store/Store.php'
);
require_once
(
__DIR__
.
'/../store/Sip.php'
);
require_once
(
__DIR__
.
'/../helper/OnArray.php'
);
require_once
(
__DIR__
.
'/../helper/OnString.php'
);
require_once
(
__DIR__
.
'/../helper/Logger.php'
);
require_once
(
__DIR__
.
'/../helper/Sanitize.php'
);
require_once
(
__DIR__
.
'/../helper/HelperFile.php'
);
...
...
@@ -217,7 +219,10 @@ class Download {
*/
private
function
getElement
(
$element
,
$downloadMode
,
&
$tmpData
)
{
$filename
=
''
;
$filename
=
''
;
$rcArgs
=
array
();
$rcSipEncode
=
false
;
$arr
=
explode
(
':'
,
$element
,
2
);
if
(
count
(
$arr
)
!=
2
)
{
throw
new
DownloadException
(
'Missing parameter for "'
.
$element
.
'"'
,
ERROR_MISSING_REQUIRED_PARAMETER
);
...
...
@@ -232,8 +237,15 @@ class Download {
case
TOKEN_PAGE
:
if
(
$downloadMode
==
DOWNLOAD_MODE_EXCEL
)
{
$urlParam
=
OnString
::
splitParam
(
$value
,
$rcArgs
,
$rcSipEncode
);
$urlParamString
=
KeyValueStringParser
::
unparse
(
$urlParam
,
'='
,
'&'
);
if
(
$rcSipEncode
)
{
$sip
=
new
Sip
();
$urlParamString
=
$sip
->
queryStringToSip
(
$urlParamString
,
RETURN_URL
);
}
$baseUrl
=
$this
->
store
->
getVar
(
SYSTEM_BASE_URL
,
STORE_SYSTEM
);
$tmpData
=
DownloadPage
::
getContent
(
$
value
,
$baseUrl
);
$tmpData
=
DownloadPage
::
getContent
(
$
urlParamString
,
$baseUrl
);
}
else
{
$filename
=
$this
->
html2pdf
->
page2pdf
(
$token
,
$value
);
}
...
...
@@ -336,12 +348,12 @@ class Download {
$elements
=
explode
(
PARAM_DELIMITER
,
$vars
[
SIP_DOWNLOAD_PARAMETER
]);
// Get all files / content
$tmpData
=
array
();
$tmpData
=
array
();
foreach
(
$elements
as
$element
)
{
$data
=
''
;
$data
=
''
;
$tmpFiles
[]
=
$this
->
getElement
(
$element
,
$downloadMode
,
$data
);
if
(
!
empty
(
$data
)){
$tmpData
[]
=
$data
;
if
(
!
empty
(
$data
))
{
$tmpData
[]
=
$data
;
}
}
...
...
extension/qfq/qfq/report/Html2Pdf.php
View file @
c4a94d75
...
...
@@ -116,42 +116,6 @@ class Html2Pdf {
header
(
"Content-Transfer-Encoding: binary"
);
}
/**
* Split the wkthtml Parameter between:
* - general 'urlParam' for the specific website (page which will be converted to PDF).
* - `wkthml` Parameter. Those will always start with '-' and control wkhtml how to render the PDF.
* - '_sip' - to activate that `urlParam` parameters will be SIP encoded.
*
* @param string $urlParamString
* @param array $rcArgs
* @param bool $rcSipEncode
*
* @return array The remaining 'real' URL parameter to call the T3 page.
* @throws UserFormException
*/
private
function
splitParam
(
$urlParamString
,
array
&
$rcArgs
,
&
$rcSipEncode
)
{
$urlParamNew
=
array
();
$rcArgs
[
WKHTML_OPTION_VIEWPORT
]
=
WKHTML_OPTION_VIEWPORT_VALUE
;
// Forces wkhtml to render Bootstrap page in 'md', not 'xs'
$urlParam
=
KeyValueStringParser
::
parse
(
$urlParamString
,
'='
,
'&'
,
KVP_IF_VALUE_EMPTY_COPY_KEY
);
foreach
(
$urlParam
as
$key
=>
$value
)
{
switch
(
substr
(
$key
,
0
,
1
))
{
case
'-'
:
$rcArgs
[
$key
]
=
$value
;
break
;
case
'_'
:
if
(
$key
==
DOWNLOAD_SIP_ENCODE_PARAMETER
)
{
$rcSipEncode
=
true
;
}
break
;
default
:
$urlParamNew
[
$key
]
=
$value
;
break
;
}
}
return
$urlParamNew
;
}
/**
* Converts a Webpage (URL) to a PDF file.
...
...
@@ -186,7 +150,7 @@ class Html2Pdf {
}
$rcSipEncode
=
false
;
$urlParam
=
$this
->
splitParam
(
$urlParamString
,
$rcArgs
,
$rcSipEncode
);
$urlParam
=
OnString
::
splitParam
(
$urlParamString
,
$rcArgs
,
$rcSipEncode
);
$rcArgs
=
OnArray
::
arrayEscapeshellarg
(
$rcArgs
);
$options
=
KeyValueStringParser
::
unparse
(
$rcArgs
,
' '
,
' '
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment