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
KELBERT Paul
ApplicationsBD_CHEVALIER_TONDON_KELBERT
Commits
7e5951e8
Commit
7e5951e8
authored
Mar 25, 2020
by
Tondon César
Browse files
partie 4 refait alors
parent
5c290c5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Seance5-6/seance/index.php
View file @
7e5951e8
...
...
@@ -25,9 +25,6 @@ $app->get('/api/games/',function() {
IndexController
::
partie2
();
})
->
name
(
'partie2'
);
$app
->
get
(
'/partie4'
,
function
(){
IndexController
::
partie4
(
$id
);
})
->
name
(
'partie4'
);
...
...
Seance5-6/seance/src/controller/IndexController.php
View file @
7e5951e8
...
...
@@ -17,6 +17,19 @@ class IndexController
}
public
static
function
partie2
()
{
$game
=
Game
::
select
(
'id'
,
'name'
,
'alias'
,
'deck'
)
->
where
(
'id'
,
'<='
,
'200'
)
->
get
();
// $game = Game::where('id','=',1)->get();
// $json = json_encode($game,JSON_FORCE_OBJECT);
$json
=
'{ "games" : [ '
;
foreach
(
$game
as
$key
=>
$value
)
{
$json
=
$json
.
'"game" :{'
;
$json
=
$json
.
json_encode
(
$value
)
.
',},"links" :{"self": {"href":"/api/games/'
.
$value
->
id
.
'"}}'
;
}
$json
=
$json
.
']}'
;
$cq2
=
new
CQuestion2
(
$json
);
$cq2
->
render
();
/*
$game = Game::select('id','name','alias','deck')->where('id','<=','200')->get();
// $game = Game::where('id','=',1)->get();
// $json = json_encode($game,JSON_FORCE_OBJECT);
...
...
@@ -36,19 +49,13 @@ class IndexController
"name":' . $value->name . ',
"deck":' . $value->deck . ',
}
';
*/
';
}
}
$json = $json . ']}';
$cq2 = new VuePartie2($json);
$cq2
->
render
();
$cq2->render();
*/
}
public
static
function
partie4
(
$id
){
$game
=
Game
::
find
(
$id
);
$vue
=
new
VuePartie4
(
$game
);
$vue
->
render
();
}
}
\ No newline at end of file
Seance5-6/seance/src/view/VuePartie4.php
deleted
100644 → 0
View file @
5c290c5f
<?php
namespace
seance\view
;
class
VuePartie4
{
private
$content
;
public
function
__construct
(
$game
)
{
$game
->
description
=
"..."
;
$json
=
json_encode
(
$game
);
$json
=
$json
.
'"links" : {
"self" : { "href" : "/api/games/'
.
$game
->
id
.
'"}'
;
$this
->
content
=
<<<
END
<!
DOCTYPE
html
>
<
html
lang
=
"fr"
>
<
head
>
<
meta
charset
=
"UTF-8"
content
=
"application/json"
>
<
link
rel
=
"stylesheet"
href
=
"css/main.css"
>
<
title
>
photobox
</
title
>
</
head
>
<
body
>
$json
</
body
>
END
;
}
public
function
render
()
{
echo
$this
->
content
;
}
}
\ 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