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
72302beb
Commit
72302beb
authored
Mar 23, 2020
by
KELBERT Paul
Browse files
début partie 1
parent
434e1ebf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Seance5-6/seance/.htaccess
0 → 100644
View file @
72302beb
RewriteEngine
On
#
# RewriteBase indispensable sur webetu :
# RewriteBase /www/username0/mywishlist
#
# Pour interdire l'accès aux répertoires contenant du code
RewriteRule
^sql(/.*|)$ - [NC,F]
RewriteRule
^src(/.*|)$ - [NC,F]
RewriteRule
^vendor(/.*|)$ - [NC,F]
#
# réécriture pour slim
RewriteCond
%{REQUEST_FILENAME} !-d
RewriteCond
%{REQUEST_FILENAME} !-f
RewriteRule
^ index.php [QSA,L]
Seance5-6/seance/index.php
View file @
72302beb
...
...
@@ -2,7 +2,7 @@
require
'vendor/autoload.php'
;
use
seance\modele\Game
;
use
seace\controller\IndexController
;
use
sea
n
ce\controller\IndexController
;
use
Illuminate\Database\Capsule\Manager
as
DB
;
$file
=
parse_ini_file
(
'conf.ini'
);
...
...
@@ -14,9 +14,13 @@ $app = new \Slim\Slim();
$app
->
get
(
'/'
,
function
(){
IndexController
::
test
()
;
echo
"page index"
;
})
->
name
(
'testIndex'
);
$app
->
get
(
'/api/games/:id'
,
function
(
$id
){
IndexController
::
jeuParId
(
$id
);
})
->
name
(
'partie1'
);
$app
->
run
();
...
...
Seance5-6/seance/src/controller/IndexController.php
View file @
72302beb
<?php
namespace
seace\controller
;
namespace
sea
n
ce\controller
;
use
seance\modele\Game
;
use
seance\reponse\CQuestion1
;
use
seance\view\VuePartie1
;
class
IndexController
{
public
static
function
test
(){
new
CQuestion1
();
public
static
function
jeuParId
(
$id
){
$game
=
Game
::
find
(
$id
);
$vue
=
new
VuePartie1
(
$game
);
$vue
->
render
();
}
}
\ No newline at end of file
Seance5-6/seance/src/reponse/CQuestion1.php
deleted
100644 → 0
View file @
434e1ebf
<?php
namespace
seance\reponse
;
use
Illuminate\Database\Eloquent\ModelNotFoundException
;
use
seance\modele\Character
;
use
seance\modele\Game
;
class
CQuestion1
{
public
function
__construct
()
{
echo
"<a href='index.php'>Retour au menu</a><br><br>"
;
$game
=
Game
::
find
(
12342
);
$p
=
$game
->
appears_in
;
foreach
(
$p
as
$pers
)
{
echo
$pers
->
name
.
" -- "
.
$pers
->
deck
.
"<br>"
;
}
}
}
\ No newline at end of file
Seance5-6/seance/src/view/VuePartie1.php
0 → 100644
View file @
72302beb
<?php
namespace
seance\view
;
class
VuePartie1
{
private
$content
;
public
function
__construct
(
$game
)
{
$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
>
{
"id"
:
$game
->
id
,
"name"
:
"
$game->name
"
,
"alias"
:
"
$game->alias
"
,
"deck"
:
"
$game->deck
"
,
"description"
:
...
",
"
original_release_date
": "
$game
->
original_release_date
"
}
</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