Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qfq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
typo3
qfq
Commits
19ced86c
Commit
19ced86c
authored
8 years ago
by
Carsten Rose
Browse files
Options
Downloads
Patches
Plain Diff
Save.php: elements() simplified by using STORE_FORM.
parent
5605ee52
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
extension/qfq/qfq/Save.php
+3
-33
3 additions, 33 deletions
extension/qfq/qfq/Save.php
with
3 additions
and
33 deletions
extension/qfq/qfq/Save.php
+
3
−
33
View file @
19ced86c
...
...
@@ -74,15 +74,10 @@ class Save {
*/
public
function
elements
(
$recordId
)
{
//TODO: Umstellen auf Nutzung der Klasse FillStoreForm.
$html
=
''
;
$newValues
=
array
();
$tableColumns
=
array_keys
(
$this
->
store
->
getStore
(
STORE_TABLE_COLUMN_TYPES
));
$clientValues
=
$this
->
store
->
getStore
(
STORE_CLIENT
);
// Retrieve SIP vars, e.g. for HIDDEN elements.
$sipValues
=
$this
->
store
->
getStore
(
STORE_SIP
);
$formValues
=
$this
->
store
->
getStore
(
STORE_FORM
);
// Iterate over all table.columns. Built an assoc array $newValues.
foreach
(
$tableColumns
AS
$column
)
{
...
...
@@ -98,34 +93,9 @@ class Save {
// Preparation for Log, Debug
$this
->
store
->
setVar
(
SYSTEM_FORM_ELEMENT
,
$formElement
[
'name'
]
.
' / '
.
$formElement
[
'id'
],
STORE_SYSTEM
);
if
(
$formElement
[
'type'
]
==
'hidden'
)
{
// Hidden elements will be transferred by SIP
if
(
!
isset
(
$sipValues
[
$column
]))
{
throw
new
CodeException
(
"Missing the hidden field '
$column
' in SIP."
,
ERROR_MISSING_HIDDEN_FIELD_IN_SIP
);
}
$newValues
[
$column
]
=
$sipValues
[
$column
];
continue
;
}
// construct the field name used in the form
$clientFieldName
=
HelperFormElement
::
buildFormElementId
(
$column
,
$recordId
);
if
(
isset
(
$clientValues
[
$clientFieldName
]))
{
// SELECT with multiple values, or Multi CHECKBOX are delivered as array: implode them
if
(
is_array
(
$clientValues
[
$clientFieldName
]))
{
// E.g. Checkboxes needs a 'HIDDEN' HTML input to detect 'unset' of values. These 'HIDDEN' element
// needs to be removed, if there is at least one checkbox is checked (=submitted)
if
(
count
(
$clientValues
[
$clientFieldName
])
>
1
)
array_shift
(
$clientValues
[
$clientFieldName
]);
$clientValues
[
$clientFieldName
]
=
implode
(
','
,
$clientValues
[
$clientFieldName
]);
}
$newValues
[
$column
]
=
Sanitize
::
sanitize
(
$clientValues
[
$clientFieldName
],
$formElement
[
'checkType'
],
$formElement
[
'checkPattern'
],
SANATIZE_EXCEPTION
);
if
(
isset
(
$formValues
[
$column
]))
{
$newValues
[
$column
]
=
$formValues
[
$column
];
}
}
return
(
$recordId
==
0
)
?
$this
->
insertRecord
(
$this
->
formSpec
[
'tableName'
],
$newValues
)
:
$this
->
updateRecord
(
$this
->
formSpec
[
'tableName'
],
$newValues
,
$recordId
);
...
...
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