Pierre BALLANDRAS 2 years ago
commit a0f0a3468d

@ -1,52 +0,0 @@
<?php
class DetailPartieGateway
{
private Connection $con;
/**
* @param Connection $con
*/
public function __construct(Connection $con)
{
$this->con = $con;
}
/**
* @param Connection $con
*/
public function setCon(Connection $con): void
{
$this->con = $con;
}
public function insert(DetailPartie $detailPartie)
{
$query="INSERT INTO DetailPartie VALUES (:idDetailPartie,:joueur,:partie,:enigme,:pointsObtenus,:classement)";
$this->con->executeQuery($query,array(
'idDetailPartie' => array($detailPartie->getIdDetailPartie(),PDO::PARAM_STR),
'joueur' => array($detailPartie->getJoueur(),PDO::PARAM_STR),
'partie' => array($detailPartie->getPartie(),PDO::PARAM_STR),
'enigme' => array($detailPartie->getEnigme(),PDO::PARAM_STR),
'pointsObtenus' => array($detailPartie->getPointsObtenus(),PDO::PARAM_INT),
'classement' => array($detailPartie->getClassement(),PDO::PARAM_INT)
));
}
public function delete(string $partie){
$query="DELETE * FROM DetailPartie WHERE partie=:partie";
$this->con->executeQuery($query,array(
'partie' => array($partie,PDO::PARAM_STR)
));
}
public function showAll(){
$query="SELECT * FROM DetailPartie";
$this->con->executeQuery($query);
$results=$this->con->getResults();
foreach($results as $row)
{
$row['idDetailPartie'];
}
}
}

@ -1,125 +0,0 @@
<?php
class DetailPartie
{
private string $idDetailPartie;
private string $joueur;
private string $partie;
private string $enigme;
private int $pointsObtenus;
private int $classement;
/**
* @param string $idDetailPartie
* @param string $joueur
* @param string $partie
* @param string $enigme
* @param int $pointsObtenus
* @param int $classement
*/
public function __construct(string $idDetailPartie, string $joueur, string $partie, string $enigme, int $pointsObtenus, int $classement)
{
$this->idDetailPartie = $idDetailPartie;
$this->joueur = $joueur;
$this->partie = $partie;
$this->enigme = $enigme;
$this->pointsObtenus = $pointsObtenus;
$this->classement = $classement;
}
/**
* @return string
*/
public function getIdDetailPartie(): string
{
return $this->idDetailPartie;
}
/**
* @param string $idDetailPartie
*/
public function setIdDetailPartie(string $idDetailPartie): void
{
$this->idDetailPartie = $idDetailPartie;
}
/**
* @return string
*/
public function getJoueur(): string
{
return $this->joueur;
}
/**
* @param string $joueur
*/
public function setJoueur(string $joueur): void
{
$this->joueur = $joueur;
}
/**
* @return string
*/
public function getPartie(): string
{
return $this->partie;
}
/**
* @param string $partie
*/
public function setPartie(string $partie): void
{
$this->partie = $partie;
}
/**
* @return string
*/
public function getEnigme(): string
{
return $this->enigme;
}
/**
* @param string $enigme
*/
public function setEnigme(string $enigme): void
{
$this->enigme = $enigme;
}
/**
* @return int
*/
public function getPointsObtenus(): int
{
return $this->pointsObtenus;
}
/**
* @param int $pointsObtenus
*/
public function setPointsObtenus(int $pointsObtenus): void
{
$this->pointsObtenus = $pointsObtenus;
}
/**
* @return int
*/
public function getClassement(): int
{
return $this->classement;
}
/**
* @param int $classement
*/
public function setClassement(int $classement): void
{
$this->classement = $classement;
}
}

@ -3,17 +3,15 @@
class Enigme class Enigme
{ {
private string $idEnigme; private string $idEnigme;
private string $admin;
private string $enonce; private string $enonce;
private string $aide; private string $aide;
private string $rappel; private string $rappel;
private string $solution; private string $solution;
private string $test; private string $test;
private float $tempsDeResolution; private int $tempsDeResolution;
/** /**
* @param string $idEnigme * @param string $idEnigme
* @param string $admin
* @param string $enonce * @param string $enonce
* @param string $aide * @param string $aide
* @param string $rappel * @param string $rappel
@ -21,16 +19,29 @@ class Enigme
* @param string $test * @param string $test
* @param int $tempsDeResolution * @param int $tempsDeResolution
*/ */
public function __construct(string $idEnigme, string $admin, string $enonce, string $aide, string $rappel, string $solution, string $test, float $tempsDeResolution) public function __construct(string $idEnigme, string $enonce, string $aide, string $rappel, string $solution, string $test, int $tempsDeResolution)
{ {
$this->idEnigme = $idEnigme; $arguments=func_get_args();
$this->admin = $admin; $index=func_num_args();
$this->enonce = $enonce; if(method_exists($this,$function='__construct'.$index));
$this->aide = $aide; call_user_func(array(array($this,$function),$arguments));
$this->rappel = $rappel; }
$this->solution = $solution;
$this->test = $test; public function __constructMulti(string $idEnigme, string $enonce, string $solution, string $test, int $tempsDeResolution){
$this->tempsDeResolution = $tempsDeResolution; $this->idEnigme=$idEnigme;
$this->enonce=$enonce;
$this->solution=$solution;
$this->test=$test;
$this->tempsDeResolution=$tempsDeResolution;
}
public function __constructSolo(string $idEnigme, string $enonce, string $aide, string $rappel, string $solution, string $test){
$this->idEnigme=$idEnigme;
$this->enonce=$enonce;
$this->aide=$aide;
$this->rappel=$rappel;
$this->solution=$solution;
$this->test=$test;
} }
/** /**
@ -49,22 +60,6 @@ class Enigme
$this->idEnigme = $idEnigme; $this->idEnigme = $idEnigme;
} }
/**
* @return string
*/
public function getAdmin(): string
{
return $this->admin;
}
/**
* @param string $admin
*/
public function setAdmin(string $admin): void
{
$this->admin = $admin;
}
/** /**
* @return string * @return string
*/ */
@ -148,7 +143,7 @@ class Enigme
/** /**
* @return int * @return int
*/ */
public function getTempsDeResolution(): float public function getTempsDeResolution(): int
{ {
return $this->tempsDeResolution; return $this->tempsDeResolution;
} }
@ -156,7 +151,7 @@ class Enigme
/** /**
* @param int $tempsDeResolution * @param int $tempsDeResolution
*/ */
public function setTempsDeResolution(float $tempsDeResolution): void public function setTempsDeResolution(int $tempsDeResolution): void
{ {
$this->tempsDeResolution = $tempsDeResolution; $this->tempsDeResolution = $tempsDeResolution;
} }

@ -3,13 +3,16 @@
class Partie class Partie
{ {
private string $idPartie; private string $idPartie;
private date $datePartie;
/** /**
* @param string $idPartie * @param string $idPartie
* @param date $datePartie
*/ */
public function __construct(string $idPartie) public function __construct(string $idPartie)
{ {
$this->idPartie = $idPartie; $this->idPartie = $idPartie;
$this->datePartie = getdate(NULL);
} }
/** /**
@ -27,4 +30,22 @@ class Partie
{ {
$this->idPartie = $idPartie; $this->idPartie = $idPartie;
} }
/**
* @return date
*/
public function getDatePartie(): date
{
return $this->datePartie;
}
/**
* @param date $datePartie
*/
public function setDatePartie(date $datePartie): void
{
$this->datePartie = $datePartie;
}
} }
Loading…
Cancel
Save