Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BDAPPLI_LAURENT_VONDERSCHER_SASSU_PERCIN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
VONDERSCHER William
BDAPPLI_LAURENT_VONDERSCHER_SASSU_PERCIN
Commits
4e296f35
Commit
4e296f35
authored
5 years ago
by
SASSU Thomas
Browse files
Options
Downloads
Patches
Plain Diff
TD3 done
parent
00f253ad
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GamePedia/php/Script_TD3b.php
+9
-4
9 additions, 4 deletions
GamePedia/php/Script_TD3b.php
GamePedia/php/script_TD1.php
+2
-2
2 additions, 2 deletions
GamePedia/php/script_TD1.php
GamePedia/src/controleurs/ControleurScript.php
+40
-12
40 additions, 12 deletions
GamePedia/src/controleurs/ControleurScript.php
with
51 additions
and
18 deletions
GamePedia/php/Script_TD3b.php
+
9
−
4
View file @
4e296f35
...
...
@@ -22,16 +22,21 @@ echo ("<!DOCTYPE html>
<h2> Consignes : </h2>
<p> Pour chaque requête, mettre le paramètre dans l'url ?requete='Numero de la requete'</p>
</div>"
);
if
(
isset
(
$_GET
[
'requete'
])
&&
$_GET
[
'requete'
]
>
0
&&
$_GET
[
'requete'
]
<=
5
)
{
if
(
isset
(
$_GET
[
'requete'
])
&&
$_GET
[
'requete'
]
>
0
&&
$_GET
[
'requete'
]
<=
6
)
{
echo
"<div><center>"
;
$nb
=
$_GET
[
'requete'
];
$c
=
new
ControleurScript
();
$c
->
setLog
(
true
);
$function
=
'td3_q'
.
$nb
.
'b'
;
$res
=
$c
->
$function
();
// foreach ($res as $item){
// echo "<p>$item->name</p>";
// }
if
(
$res
!=
null
)
{
foreach
(
$res
as
$item
)
{
if
(
$nb
!=
6
)
echo
"<p>
$item->name
</p>"
;
else
echo
"<p>
$item
</p>"
;
}
}
else
echo
"<p>Aucun résultat</p>"
;
echo
"</center></div>"
;
echo
"<div>"
;
echo
$c
->
getLog
();
...
...
This diff is collapsed.
Click to expand it.
GamePedia/php/script_TD1.php
+
2
−
2
View file @
4e296f35
<?php
require_once
__DIR__
.
'
..
/vendor/autoload.php'
;
require_once
dirname
(
__DIR__
)
.
'/vendor/autoload.php'
;
;
session_start
();
use
\Slim\Slim
as
Slim
;
...
...
@@ -9,7 +9,7 @@ use \gp\controleurs\ControleurPrincipal as ControleurPrincipal;
use
\gp\controleurs\ControleurScript
as
ControleurScript
;
$db
=
new
DB
();
$db
->
addConnection
(
parse_ini_file
(
'./conf/conf.ini'
));
$db
->
addConnection
(
parse_ini_file
(
'.
.
/conf/conf.ini'
));
$db
->
setAsGlobal
();
$db
->
bootEloquent
();
...
...
This diff is collapsed.
Click to expand it.
GamePedia/src/controleurs/ControleurScript.php
+
40
−
12
View file @
4e296f35
...
...
@@ -248,7 +248,7 @@ class ControleurScript
}
public
function
td3_q1b
(){
return
Game
::
where
(
'name'
,
'like'
,
'%Mario%'
)
->
get
();
return
Game
::
where
(
'name'
,
'like'
,
'%Mario%'
)
->
get
();
}
public
function
td3_q2b
(){
...
...
@@ -257,26 +257,54 @@ class ControleurScript
public
function
td3_q3b
(){
$res
=
null
;
$games
=
Game
::
where
(
'name'
,
'like'
,
'%Mario%'
)
->
get
();;
foreach
(
$games
as
$game
)
echo
"<p>
$game->name
</p>"
;
$characters
=
$game
->
characters
()
->
get
();
foreach
(
$characters
as
$character
){
echo
"<p>
$character->name
</p>"
;
$first
=
$character
->
games
()
->
orderBy
(
'original_release_date'
,
'asc'
)
->
first
();
if
(
$first
!=
null
&&
str_contains
(
strtolower
(
$first
->
name
),
'mario'
))
$q
=
Game
::
where
(
'name'
,
'like'
,
"%Mario%"
)
->
get
();
foreach
(
$q
as
$game
)
{
$list
=
$game
->
characters
()
->
get
();
foreach
(
$list
as
$character
)
$first
=
$character
->
games
()
->
orderBy
(
'original_release_date'
,
'asc'
)
->
first
();
if
(
$first
!=
null
&&
str_contains
(
strtolower
(
$first
->
name
),
'mario'
))
$res
[]
=
$character
;
}
$res
=
array_unique
((
array
)
$res
);
return
$res
;
}
public
function
td3_q4b
(){
$characters
=
$this
->
td3_q1b
()
->
characters
()
->
get
();
return
$characters
;
$q
=
Game
::
where
(
'name'
,
'like'
,
"Mario%"
)
->
get
();
foreach
(
$q
as
$game
)
{
$characters
=
$game
->
characters
()
->
get
();
foreach
(
$characters
as
$char
)
$res
[]
=
$char
;
}
$res
=
array_unique
((
array
)
$res
);
return
$res
;
}
public
function
td3_q5b
(){
return
Company
::
where
(
'name'
,
'like'
,
'%Sony%'
)
->
get
()
->
games
();
$res
=
null
;
$comps
=
Company
::
where
(
'name'
,
'like'
,
'%Sony%'
)
->
get
();
foreach
(
$comps
as
$comp
)
{
$games
=
$comp
->
games
()
->
get
();
foreach
(
$games
as
$game
)
$res
[]
=
$game
;
}
$res
=
array_unique
((
array
)
$res
);
return
$res
;
}
public
function
td3_q6b
(){
$res
=
null
;
$results
=
DB
::
table
(
'game'
)
->
select
(
DB
::
raw
(
'group_concat(character.name) as names'
))
->
join
(
'game2character'
,
'game.id'
,
'='
,
'game2character.game_id'
)
->
join
(
'character'
,
'game2character.character_id'
,
'='
,
'character.id'
)
->
whereRaw
(
'`game`.`name` like \'%Mario%\''
)
->
groupBy
(
'game.name'
)
->
get
();
foreach
(
$results
as
$result
)
{
$names
=
explode
(
','
,
$result
->
names
);
foreach
(
$names
as
$name
)
$res
[]
=
$name
;
}
return
$res
;
}
public
function
allGame
(){
...
...
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