Merge branch 'salva' of https://codefirst.iut.uca.fr/git/IQBall/Application-Web into salva
continuous-integration/drone/push Build is passing Details

pull/21/head^2
samuel 1 year ago
commit b957004939

@ -3,7 +3,7 @@
namespace App\Controller; namespace App\Controller;
use App\Connexion; use App\Connexion;
use App\Controller\Sub\EditorController;
use App\Gateway\TacticInfoGateway; use App\Gateway\TacticInfoGateway;
use App\Gateway\TeamGateway; use App\Gateway\TeamGateway;
use App\Http\HttpResponse; use App\Http\HttpResponse;
@ -13,7 +13,6 @@ use App\Model\TeamModel;
use App\Session\SessionHandle; use App\Session\SessionHandle;
class UserController extends VisitorController { class UserController extends VisitorController {
public function home(): HttpResponse { public function home(): HttpResponse {
$model = new TacticModel(new TacticInfoGateway(new Connexion(get_database()))); $model = new TacticModel(new TacticInfoGateway(new Connexion(get_database())));
$listTactic = $model->getLast(5); $listTactic = $model->getLast(5);
@ -27,12 +26,12 @@ class UserController extends VisitorController {
public function edit(int $id, SessionHandle $session): HttpResponse { public function edit(int $id, SessionHandle $session): HttpResponse {
$model = new TacticModel(new TacticInfoGateway(new Connexion(get_database()))); $model = new TacticModel(new TacticInfoGateway(new Connexion(get_database())));
return (new Sub\EditorController($model))->edit($id, $session); return (new EditorController($model))->edit($id, $session);
} }
public function create(SessionHandle $session): HttpResponse { public function create(SessionHandle $session): HttpResponse {
$model = new TacticModel(new TacticInfoGateway(new Connexion(get_database()))); $model = new TacticModel(new TacticInfoGateway(new Connexion(get_database())));
return (new Sub\EditorController($model))->createNew($session); return (new EditorController($model))->createNew($session);
} }
public function open(int $id, SessionHandle $session): HttpResponse { public function open(int $id, SessionHandle $session): HttpResponse {

@ -40,7 +40,7 @@ class TacticInfoGateway {
*/ */
public function getLast(int $nb) : ?array { public function getLast(int $nb) : ?array {
$res = $this->con->fetch( $res = $this->con->fetch(
"SELECT * FROM TacticInfo ORDER BY creation_date DESC LIMIT :nb ", "SELECT * FROM Tactic ORDER BY creation_date DESC LIMIT :nb ",
[":nb" => [$nb, PDO::PARAM_INT]] [":nb" => [$nb, PDO::PARAM_INT]]
); );
if (count($res) == 0) { if (count($res) == 0) {

@ -73,13 +73,13 @@
<h2> Mes strategies </h2> <h2> Mes strategies </h2>
<button onclick="location.pathname='/tactic/create'"> Créer une nouvelle tactique </button> <button onclick="location.pathname='/user/create'"> Créer une nouvelle tactique </button>
{% if recentTactic != null %} {% if recentTactic != null %}
{% for tactic in recentTactic %} {% for tactic in recentTactic %}
<div onclick="location.pathname=/tactic/edit/{{ strategie.id }}"> <div onclick="location.pathname=/user/edit/{{ strategie.id }}">
<p> {{tactic.id}} - {{tactic.name}} - {{tactic.creation_date}} </p> <p> {{tactic.id}} - {{tactic.name}} - {{tactic.creation_date}} </p>
<button onclick="location.pathname='/tactic/edit/{{ tactic.id }}'"> Editer la stratégie {{tactic.id}} </button> <button onclick="location.pathname='/user/edit/{{ tactic.id }}'"> Editer la stratégie {{tactic.id}} </button>
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}

Loading…
Cancel
Save