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
d457f897
Commit
d457f897
authored
Oct 04, 2018
by
Elias Villiger
Browse files
F6596 - Finalize uid option for excel downloads (including parameters) - refs #6596
parent
de128a42
Changes
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/report/Download.php
View file @
d457f897
...
...
@@ -237,29 +237,28 @@ class Download {
$token
=
$arr
[
0
];
$value
=
$arr
[
1
];
if
(
$token
===
TOKEN_UID
)
{
// extract uid
$uidParamsArr
=
explode
(
'&'
,
$value
,
2
);
$uid
=
$uidParamsArr
[
0
];
$value
=
$uidParamsArr
[
1
]
??
''
;
// additional params
}
switch
(
$token
)
{
case
TOKEN_URL
:
case
TOKEN_URL_PARAM
:
case
TOKEN_PAGE
:
case
TOKEN_UID
:
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
);
}
$urlParam
=
OnString
::
splitParam
(
$value
,
$rcArgs
,
$rcSipEncode
);
$urlParamString
=
KeyValueStringParser
::
unparse
(
$urlParam
,
'='
,
'&'
);
if
(
$rcSipEncode
)
{
$sip
=
new
Sip
();
$urlParamString
=
$sip
->
queryStringToSip
(
$urlParamString
,
RETURN_URL
);
}
if
(
$downloadMode
==
DOWNLOAD_MODE_EXCEL
)
{
if
(
$token
===
TOKEN_UID
)
{
$dbT3
=
$this
->
store
->
getDbT3Name
();
$uid
=
$value
;
// TODO EV extract uid and pass parameters as SIP parameters to qfq store
$sql
=
"SELECT bodytext FROM
$dbT3
.tt_content WHERE uid = ?"
;
$tt_content
=
$this
->
db
->
sql
(
$sql
,
ROW_EXPECT_1
,
[
$uid
]);
$qfq
=
new
QuickFormQuery
([
T3DATA_BODYTEXT
=>
$tt_content
[
T3DATA_BODYTEXT
]],
false
,
false
);
$rcData
=
$qfq
->
process
();
$rcData
=
$this
->
getEvaluatedBodytext
(
$uid
,
$urlParam
);
}
else
{
$baseUrl
=
$this
->
store
->
getVar
(
SYSTEM_BASE_URL
,
STORE_SYSTEM
);
$rcData
=
DownloadPage
::
getContent
(
$urlParamString
,
$baseUrl
);
...
...
@@ -284,6 +283,34 @@ class Download {
return
$filename
;
}
/**
* @param $uid
* @param array $urlParam
*
* @return string
* @throws CodeException
* @throws DbException
* @throws DownloadException
* @throws UserFormException
* @throws UserReportException
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
*/
private
function
getEvaluatedBodyText
(
$uid
,
$urlParam
)
{
foreach
(
$urlParam
as
$key
=>
$paramValue
)
{
$this
->
store
->
setVar
(
$key
,
$paramValue
,
STORE_SIP
);
}
$dbT3
=
$this
->
store
->
getDbT3Name
();
$sql
=
"SELECT bodytext FROM
$dbT3
.tt_content WHERE uid = ?"
;
$tt_content
=
$this
->
db
->
sql
(
$sql
,
ROW_EXPECT_1
,
[
$uid
]);
$qfq
=
new
QuickFormQuery
([
T3DATA_BODYTEXT
=>
$tt_content
[
T3DATA_BODYTEXT
]],
false
,
false
);
return
$qfq
->
process
();
}
/**
* Creates a ZIP Files of all given $files
...
...
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