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
fa3aa553
Commit
fa3aa553
authored
9 years ago
by
Carsten Rose
Browse files
Options
Downloads
Patches
Plain Diff
Form: changed detection of load/save. now based on GET/POST. Catch exception in __construct().
parent
f199be4e
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
qfq/Form.php
+27
-6
27 additions, 6 deletions
qfq/Form.php
with
27 additions
and
6 deletions
qfq/Form.php
+
27
−
6
View file @
fa3aa553
...
...
@@ -84,14 +84,35 @@ class Form {
// protected $formElements = null;
// protected $userLog = null;
/*
/**
* Construct the Form Class and Store too. This is the base initialization moment.
*
* As a result of instantiating of Form, the class Store will initially called the first time and therefore instantiated automatically.
* Store might throw an exception, in case the URL-passed SIP is invalid.
*
* @param string $bodytext
*/
public
function
__construct
(
$bodytext
=
''
)
{
$this
->
store
=
Store
::
getInstance
(
$bodytext
);
$this
->
db
=
new
Database
();
$this
->
eval
=
new
Evaluate
(
$this
->
store
,
$this
->
db
);
try
{
$this
->
store
=
Store
::
getInstance
(
$bodytext
);
$this
->
db
=
new
Database
();
$this
->
eval
=
new
Evaluate
(
$this
->
store
,
$this
->
db
);
}
catch
(
UserException
$e
)
{
echo
$e
->
formatMessage
();
exit
;
}
catch
(
CodeException
$e
)
{
echo
$e
->
formatMessage
();
exit
;
}
catch
(
DbException
$e
)
{
echo
$e
->
formatMessage
();
exit
;
}
catch
(
\Exception
$e
)
{
echo
"Generic Exception: "
.
$e
->
getMessage
();
exit
;
}
}
/**
...
...
@@ -109,8 +130,6 @@ class Form {
// multimode: none
try
{
// Form action: load or save?
$mode
=
(
$this
->
store
->
getVar
(
CLIENT_POST_SIP
,
STORE_CLIENT
)
===
false
)
?
FORM_LOAD
:
FORM_SAVE
;
$formName
=
$this
->
loadFormSpecification
();
...
...
@@ -135,6 +154,8 @@ class Form {
throw
new
CodeException
(
"This statement should never be reached"
,
ERROR_CODE_SHOULD_NOT_HAPPEN
);
}
// Form action: load or save?
$mode
=
isset
(
$_SERVER
[
'REQUEST_METHOD'
])
&&
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
?
FORM_SAVE
:
FORM_LOAD
;
switch
(
$mode
)
{
case
FORM_LOAD
:
$html
.
=
$build
->
process
();
...
...
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