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
ee8e46e5
Commit
ee8e46e5
authored
Jan 17, 2016
by
Carsten Rose
Browse files
Form.php: renamed formDef to formSpec to be more descriptive
parent
755ea8ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
qfq/Form.php
View file @
ee8e46e5
...
...
@@ -42,9 +42,9 @@ class Form {
protected
$store
=
null
;
protected
$db
=
null
;
protected
$form
Def
=
array
();
// Form Definition: copy of the loaded form
protected
$fe
Def
Action
=
array
();
// FormEelement Definition: all formElement.class='action' of the loaded form
protected
$fe
Def
Native
=
array
();
// FormEelement Definition: all formElement.class='native' of the loaded form
protected
$form
Spec
=
array
();
// Form Definition: copy of the loaded form
protected
$fe
Spec
Action
=
array
();
// FormEelement Definition: all formElement.class='action' of the loaded form
protected
$fe
Spec
Native
=
array
();
// FormEelement Definition: all formElement.class='native' of the loaded form
/*
* TODO:
...
...
@@ -89,18 +89,20 @@ class Form {
// Form action: load or save?
$mode
=
(
$this
->
store
->
getVar
(
CLIENT_POST_SIP
,
STORE_CLIENT
)
===
false
)
?
FORM_LOAD
:
FORM_SAVE
;
$formName
=
$this
->
loadForm
Defini
tion
();
$formName
=
$this
->
loadForm
Specifica
tion
();
$sipFound
=
$this
->
validateForm
();
if
(
!
$sipFound
)
{
$this
->
store
->
createSipAfterFormLoad
(
$formName
);
}
$this
->
store
->
fillStoreTableDefinition
(
$this
->
formSpec
[
'tableName'
]);
// TODO: replace switch() by Marschaller
// render: FormPlain | FormBootstrap
switch
(
$this
->
form
Def
[
'render'
])
{
switch
(
$this
->
form
Spec
[
'render'
])
{
case
'Plain'
:
$build
=
new
FormBuildPlain
(
$this
->
form
Def
,
$this
->
fe
Def
Action
,
$this
->
fe
Def
Native
);
$build
=
new
FormBuildPlain
(
$this
->
form
Spec
,
$this
->
fe
Spec
Action
,
$this
->
fe
Spec
Native
);
break
;
case
'Bootstrap'
:
//TODO: implement bootstrap rendering: FormBuildBootstrap
...
...
@@ -143,14 +145,14 @@ class Form {
* @throws DbException
* @throws UserException
*/
private
function
loadForm
Defini
tion
()
{
private
function
loadForm
Specifica
tion
()
{
$formName
=
$this
->
getFormName
();
$this
->
form
Def
=
$this
->
db
->
sql
(
"SELECT * FROM Form AS f WHERE f.name LIKE ? AND f.deleted='no'"
,
ROW_EXACT_1
,
[
$formName
]);
$this
->
form
Spec
=
$this
->
db
->
sql
(
"SELECT * FROM Form AS f WHERE f.name LIKE ? AND f.deleted='no'"
,
ROW_EXACT_1
,
[
$formName
]);
$sql
=
"SELECT * FROM FormElement AS fe WHERE fe.formId = ? AND fe.deleted='no' AND fe.class = ? AND fe.enabled='yes' ORDER BY fe.order, fe.id"
;
$this
->
fe
Def
Action
=
$this
->
db
->
sql
(
$sql
,
ROW_REGULAR
,
[
$this
->
form
Def
[
"id"
],
'action'
]);
$this
->
fe
Def
Native
=
$this
->
db
->
sql
(
$sql
,
ROW_REGULAR
,
[
$this
->
form
Def
[
"id"
],
'native'
]);
$this
->
fe
Spec
Action
=
$this
->
db
->
sql
(
$sql
,
ROW_REGULAR
,
[
$this
->
form
Spec
[
"id"
],
'action'
]);
$this
->
fe
Spec
Native
=
$this
->
db
->
sql
(
$sql
,
ROW_REGULAR
,
[
$this
->
form
Spec
[
"id"
],
'native'
]);
return
$formName
;
}
...
...
@@ -182,7 +184,7 @@ class Form {
$r
=
$this
->
store
->
getVar
(
SIP_RECORD_ID
,
STORE_SIP
.
STORE_CLIENT
);
// If there is a record_id>0: EDIT else NEW
$mode
=
(
$r
>
0
)
?
$this
->
form
Def
[
'permitEdit'
]
:
$this
->
form
Def
[
'permitNew'
];
$mode
=
(
$r
>
0
)
?
$this
->
form
Spec
[
'permitEdit'
]
:
$this
->
form
Spec
[
'permitNew'
];
$feUserLoggedIn
=
isset
(
$GLOBALS
[
"TSFE"
]
->
fe_user
->
user
[
"uid"
])
&&
$GLOBALS
[
"TSFE"
]
->
fe_user
->
user
[
"uid"
]
>
0
;
...
...
@@ -213,7 +215,7 @@ class Form {
}
// Form Definition valid?
if
(
$this
->
form
Def
[
'multiMode'
]
!==
'none'
&&
$this
->
form
Def
[
'multiSql'
]
===
''
)
{
if
(
$this
->
form
Spec
[
'multiMode'
]
!==
'none'
&&
$this
->
form
Spec
[
'multiSql'
]
===
''
)
{
throw
new
UserException
(
"MultiMode selected, but MultiSQL missing"
,
ERROR_MULTI_SQL_MISSING
);
}
...
...
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