Select Git revision
IndexController.php
IndexController.php 2.43 KiB
<?php
namespace seance\controller;
use seance\modele\Game;
use seance\view\VuePartie1;
use seance\view\VuePartie2;
class IndexController
{
public static function jeuParId($id){
$game = Game::find($id);
$vue = new VuePartie1($game);
$vue->render();
}
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);
foreach($game as $key => $value) {
<<<<<<< HEAD
$json = $json . json_encode($value) . ',';
/*$json = $json . '{
"id": ' . $value->id . ',
"name":' . $value->name . ',
"deck":' . $value->deck . ',
},
';*/
if ($value->id == 200) {
$json = $json . json_encode($value);/*
$json = $json . '{
"id": ' . $value->id . ',
"name":' . $value->name . ',
"deck":' . $value->deck . ',
}
';
}
}
$json = $json . ']}';
=======
$value->description = "...";
}
$json = json_encode($game);
>>>>>>> e2c791070c5330916f63fb55c2b639a71a327bcb
$cq2 = new VuePartie2($json);
$cq2->render();*/
}
public static function partie5($id){
$comment = Commentary::select('id', 'titre', 'contenu', 'dateCreation', 'userID')->where('jeuConcerne', '=', $id)->get();
$json = '{ "comments" : [';
foreach ($comment as $c){
if($c === array_key_last($$comment)){
$json = $json . ']}';
}else{
$json = $json . json_encode($c) . ',';
}
}
$vue = new VuePartie2($json);
$vue->render();
}
}