Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
clivi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
NF17 - CAMP - P14
clivi
Commits
4fa3c319
Commit
4fa3c319
authored
10 years ago
by
clement
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.utc.fr:nf17-camp-p14/clivi
parents
30c31f40
7cad9691
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
class/field.php
+11
-1
11 additions, 1 deletion
class/field.php
class/form.php
+15
-0
15 additions, 0 deletions
class/form.php
class/objet.php
+1
-1
1 addition, 1 deletion
class/objet.php
css/custom_boostrap.css
+20
-0
20 additions, 0 deletions
css/custom_boostrap.css
view/form.php
+1
-0
1 addition, 0 deletions
view/form.php
with
48 additions
and
2 deletions
class/field.php
+
11
−
1
View file @
4fa3c319
...
...
@@ -9,10 +9,20 @@ class Field {
}
public
function
html
()
{
// Todo, if isset($_POST[$this->name]) && !$this->validate() => Show a error msg explanation for this line.
return
'<div class="form-group">
<label for="form'
.
$this
->
name
.
'">'
.
ucfirst
(
$this
->
name
)
.
'</label>
<input type="text" class="form-control" name="'
.
$this
->
name
.
'" >
<input type="text" class="form-control" name="'
.
$this
->
name
.
'"
value="'
.
$this
->
value
.
'"
>
</div>'
;
}
/*
Load the data from $_POST
and return false, if data is not valid !
*/
public
function
validate
()
{
$this
->
value
=
$_POST
[
$this
->
name
];
return
true
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
class/form.php
+
15
−
0
View file @
4fa3c319
...
...
@@ -19,8 +19,19 @@ class Form {
if
(
isset
(
$_POST
[
"submitForm"
]))
{
$post
=
true
;
// Apply validators
$success
=
true
;
foreach
(
$this
->
fields
as
$field
)
{
$success
=
$success
&&
$field
->
validate
();
}
// If all validators ok, commit
if
(
$success
)
{
if
(
$this
->
action
==
"Modifier"
)
{
$this
->
object
->
update
();
}
else
{
$this
->
object
->
insert
();
}
}
}
else
{
$post
=
false
;
}
...
...
@@ -38,4 +49,8 @@ class Form {
return
$this
->
fields
;
}
public
function
getAlerts
()
{
return
'<p class="bg-danger">Code en cours d\'implémentation, l\'enregistrement n\'a pas été ajouté !</p>'
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
class/objet.php
+
1
−
1
View file @
4fa3c319
...
...
@@ -51,7 +51,7 @@ class Objet
return
$ret
;
}
public
static
function
insert
All
()
public
static
function
insert
()
{
$className
=
get_called_class
();
$dbName
=
lcfirst
(
$className
);
...
...
This diff is collapsed.
Click to expand it.
css/custom_boostrap.css
0 → 100644
+
20
−
0
View file @
4fa3c319
#footer
{
position
:
absolute
;
bottom
:
0
;
width
:
100%
;
/* Set the fixed height of the footer here */
height
:
30px
;
background-color
:
#f5f5f5
;
}
.footer_container
{
width
:
auto
;
max-width
:
680px
;
padding-top
:
10px
;
padding-bottom
:
0px
;
text-align
:
center
;
}
.text-footer
{
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
view/form.php
+
1
−
0
View file @
4fa3c319
...
...
@@ -3,6 +3,7 @@
<div
class=
"page-header"
>
<h1>
<?php
echo
$formConf
->
getTitle
();
?>
</h1>
</div>
<?php
echo
$formConf
->
getAlerts
();
?>
<form
role=
"form"
method=
"post"
>
<input
type=
"hidden"
name=
"submitForm"
value=
"1"
>
<?php
foreach
(
$formConf
->
getFields
()
as
$field
)
:
?>
...
...
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