Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Projet_idaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Liang Wu
Projet_idaw
Commits
e6108cfa
Commit
e6108cfa
authored
Apr 05, 2020
by
Liang Wu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gvipers.imt-lille-douai.fr/lwu/projet_idaw
parents
be77a7fb
4b361f4c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
2 deletions
+100
-2
aliments.php
aliments.php
+2
-0
read_indicateur.php
api/read_indicateur.php
+38
-0
home.php
home.php
+1
-2
indicateurs.php
indicateurs.php
+59
-0
No files found.
aliments.php
View file @
e6108cfa
...
...
@@ -106,6 +106,8 @@
<select
id=
"cat"
name=
"cat"
size=
"1"
>
<option
value=
"Fruit"
>
Fruit
</option>
<option
value=
"Legume"
>
Legume
</option>
<option
value=
"Feculent"
>
Feculent
</option>
<option
value=
"Laitage"
>
Legume
</option>
<option
value=
"Sucrerie"
>
Sucrerie
</option>
</select>
...
...
api/read_indicateur.php
0 → 100644
View file @
e6108cfa
<?php
require_once
(
"template.php"
);
$tab
=
array
();
$requete0
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Fruit'"
;
$rep0
=
$mysqli
->
query
(
$requete0
);
$result0
=
$rep0
->
fetch_all
();
$tab
[
0
]
=
$result0
[
0
][
0
];
$requete1
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Legume'"
;
$rep1
=
$mysqli
->
query
(
$requete1
);
$result1
=
$rep1
->
fetch_all
();
$tab
[
1
]
=
$result1
[
0
][
0
];
$requete2
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Feculent'"
;
$rep2
=
$mysqli
->
query
(
$requete2
);
$result2
=
$rep2
->
fetch_all
();
$tab
[
2
]
=
$result2
[
0
][
0
];
$requete3
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Laitage'"
;
$rep3
=
$mysqli
->
query
(
$requete3
);
$result3
=
$rep3
->
fetch_all
();
$tab
[
3
]
=
$result3
[
0
][
0
];
$requete4
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Sucrerie'"
;
$rep4
=
$mysqli
->
query
(
$requete4
);
$result4
=
$rep4
->
fetch_all
();
$tab
[
4
]
=
$result4
[
0
][
0
];
echo
reponse_json
(
$tab
);
home.php
View file @
e6108cfa
...
...
@@ -15,8 +15,7 @@ if(isset($_GET['page'])){
<header
class=
"masthead bg-primary text-white text-center"
>
<div
class=
"container d-flex align-items-center flex-column"
>
<!-- Masthead Heading -->
<!-- <h2 class="masthead-heading text-uppercase mb-0">
<?php
echo
$mymenu
[
$currentPageId
][
0
]
?>
</h2> -->
<!-- Masthead Subheading -->
...
...
indicateurs.php
0 → 100644
View file @
e6108cfa
<head>
<meta
charset=
"utf-8"
/>
<script
src=
"https://code.jquery.com/jquery-3.4.1.js"
integrity=
"sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin=
"anonymous"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css"
>
<script
type=
"text/javascript"
charset=
"utf8"
src=
"https://cdn.datatables.net/1.10.20/js/jquery.dataTables.js"
></script>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
'#table_aliments'
).
DataTable
();
resetForm
();
}
);
function
resetForm
()
{
document
.
getElementById
(
"id"
).
value
=
""
document
.
getElementById
(
"aliment"
).
value
=
""
;
document
.
getElementById
(
"calories"
).
value
=
""
;
document
.
getElementById
(
"cat"
).
value
=
""
;
document
.
getElementById
(
"submit_button"
).
value
=
"Ajouter"
;
};
</script>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
.
getJSON
(
'https://eden.imt-lille-douai.fr/~charlotte.raulin/Projet/api/read_indicateur.php'
,
function
(
json
){
table
=
$
(
'#tbody_indicateur'
);
table
.
html
(
''
);
echo
(
json
);
echo
(
json
[
0
]);
// cf. https://api.jquery.com/jQuery.getJSON/
// $.each( json, function( key, val ) {
// // table.append('
<
tr
><
td
>
'+val[0]+'
<
/td><td>'+val
[
1
]
+'</
td
><
td
>
'+val[2]+'
<
/td><td><button '
+
// // 'onclick="onEdit('+val[0]+',\''+val[1]+'\',\''+val[2]+'\')">Modifier
<
/button></
td
><
/tr>'
)
;
// table.append('
<
tr
><
td
>
'+val[0]+'
<
/td><td>'+val
[
1
]
+'</
td
><
td
>
'+val[2]+'
<
/td><td>'+val
[
3
]
+'</
td
><
td
>
'+val[4]+'
<
/td></
tr
>
');
// });
}
);
});
</script>
</head>
<div
style=
"margin-right:100px"
>
<table
id=
"table_indicateur"
class=
"dataTable"
style=
"color : #212529; "
>
<thead>
<tr>
<th>
Fruit
</th>
<th>
Legume
</th>
<th>
Feculent
</th>
<th>
Laitage
</th>
<th>
Sucrerie
</th>
</tr>
</thead>
<tbody
id=
"tbody_indicateur"
><tbody>
</table>
</div>
\ No newline at end of file
Write
Preview
Markdown
is supported
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