1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-03 14:42:47 +02:00

Adaptation de la plateforme aux besoins des correspondances (en cours)

This commit is contained in:
galaxyoyo
2019-09-11 01:17:05 +02:00
parent e908ad1923
commit 07e7b94f5c
18 changed files with 65 additions and 520 deletions

View File

@ -5,12 +5,11 @@ class Team
private $id;
private $name;
private $trigram;
private $tournament;
private $encadrants;
private $problem;
private $encadrant;
private $participants;
private $inscription_date;
private $validation_status;
private $final_selection;
private $access_code;
private $year;
@ -66,12 +65,11 @@ class Team
$this->id = $data["id"];
$this->name = $data["name"];
$this->trigram = $data["trigram"];
$this->tournament = $data["tournament"];
$this->encadrants = [$data["encadrant_1"], $data["encadrant_2"]];
$this->problem = $data["problem"];
$this->encadrant = $data["encadrant"];
$this->participants = [$data["participant_1"], $data["participant_2"], $data["participant_3"], $data["participant_4"], $data["participant_5"], $data["participant_6"]];
$this->inscription_date = $data["inscription_date"];
$this->validation_status = ValidationStatus::fromName($data["validation_status"]);
$this->final_selection = $data["final_selection"] == true;
$this->access_code = $data["access_code"];
$this->year = $data["year"];
}
@ -105,29 +103,29 @@ class Team
$DB->prepare("UPDATE `teams` SET `trigram` = ? WHERE `id` = ?;")->execute([$trigram, $this->id]);
}
public function getTournamentId()
public function getProblem()
{
return $this->tournament;
return $this->problem;
}
public function setTournamentId($tournament)
public function setProblem($problem)
{
global $DB;
$this->tournament = $tournament;
$DB->prepare("UPDATE `teams` SET `tournament` = ? WHERE `id` = ?;")->execute([$tournament, $this->id]);
$this->problem = $problem;
$DB->prepare("UPDATE `teams` SET `problem` = ? WHERE `id` = ?;")->execute([$problem, $this->id]);
}
public function getEncadrants()
public function getEncadrantId()
{
return $this->encadrants;
return $this->encadrant;
}
public function setEncadrant($i, $encadrant)
public function setEncadrant($encadrant)
{
global $DB;
$this->encadrants[$i - 1] = $encadrant;
$this->encadrant = $encadrant;
/** @noinspection SqlResolve */
$DB->prepare("UPDATE `teams` SET `encadrant_$i` = ? WHERE `id` = ?;")->execute([$encadrant, $this->id]);
$DB->prepare("UPDATE `teams` SET `encadrant` = ? WHERE `id` = ?;")->execute([$encadrant, $this->id]);
}
public function getParticipants()
@ -161,18 +159,6 @@ class Team
$DB->prepare("UPDATE `teams` SET `validation_status` = ? WHERE `id` = ?;")->execute([ValidationStatus::getName($status), $this->id]);
}
public function isSelectedForFinal()
{
return $this->final_selection;
}
public function selectForFinal($selected)
{
global $DB;
$this->final_selection = $selected;
$DB->prepare("UPDATE `teams` SET `final_selection` = ? WHERE `id` = ?;")->execute([$selected, $this->id]);
}
public function getAccessCode()
{
return $this->access_code;

View File

@ -7,18 +7,8 @@ class User
private $pwd_hash;
public $surname;
public $first_name;
public $birth_date;
public $gender;
public $address;
public $postal_code;
public $city;
public $country;
public $phone_number;
public $school;
public $class;
public $responsible_name;
public $responsible_phone;
public $responsible_email;
public $description;
private $role;
private $team_id;
@ -66,18 +56,8 @@ class User
$this->pwd_hash = $data["pwd_hash"];
$this->surname = $data["surname"];
$this->first_name = $data["first_name"];
$this->birth_date = $data["birth_date"];
$this->gender = $data["gender"];
$this->address = $data["address"];
$this->postal_code = $data["postal_code"];
$this->city = $data["city"];
$this->country = $data["country"];
$this->phone_number = $data["phone_number"];
$this->school = $data["school"];
$this->class = SchoolClass::fromName($data["class"]);
$this->responsible_name = $data["responsible_name"];
$this->responsible_phone = $data["responsible_phone"];
$this->responsible_email = $data["responsible_email"];
$this->description = $data["description"];
$this->role = Role::fromName($data["role"]);
$this->team_id = $data["team_id"];
@ -145,90 +125,6 @@ class User
$DB->prepare("UPDATE `users` SET `first_name` = ? WHERE `id` = ?;")->execute([$first_name, $this->getId()]);
}
public function getBirthDate()
{
return $this->birth_date;
}
public function setBirthDate($birth_date)
{
global $DB;
$this->birth_date = $birth_date;
$DB->prepare("UPDATE `users` SET `birth_date` = ? WHERE `id` = ?;")->execute([$birth_date, $this->getId()]);
}
public function getGender()
{
return $this->gender;
}
public function setGender($gender)
{
global $DB;
$this->gender = $gender;
$DB->prepare("UPDATE `users` SET `gender` = ? WHERE `id` = ?;")->execute([$gender, $this->getId()]);
}
public function getAddress()
{
return $this->address;
}
public function setAddress($address)
{
global $DB;
$this->address = $address;
$DB->prepare("UPDATE `users` SET `address` = ? WHERE `id` = ?;")->execute([$address, $this->getId()]);
}
public function getPostalCode()
{
return $this->postal_code;
}
public function setPostalCode($postal_code)
{
global $DB;
$this->postal_code = $postal_code;
$DB->prepare("UPDATE `users` SET `postal_code` = ? WHERE `id` = ?;")->execute([$postal_code, $this->getId()]);
}
public function getCity()
{
return $this->city;
}
public function setCity($city)
{
global $DB;
$this->city = $city;
$DB->prepare("UPDATE `users` SET `city` = ? WHERE `id` = ?;")->execute([$city, $this->getId()]);
}
public function getCountry()
{
return $this->country;
}
public function setCountry($country)
{
global $DB;
$this->country = $country;
$DB->prepare("UPDATE `users` SET `country` = ? WHERE `id` = ?;")->execute([$country, $this->getId()]);
}
public function getPhoneNumber()
{
return $this->phone_number;
}
public function setPhoneNumber($phone_number)
{
global $DB;
$this->phone_number = $phone_number;
$DB->prepare("UPDATE `users` SET `phone_number` = ? WHERE `id` = ?;")->execute([$phone_number, $this->getId()]);
}
public function getSchool()
{
return $this->school;
@ -253,42 +149,6 @@ class User
$DB->prepare("UPDATE `users` SET `class` = ? WHERE `id` = ?;")->execute([SchoolClass::getName($class), $this->getId()]);
}
public function getResponsibleName()
{
return $this->responsible_name;
}
public function setResponsibleName($responsible_name)
{
global $DB;
$this->responsible_name = $responsible_name;
$DB->prepare("UPDATE `users` SET `responsible_name` = ? WHERE `id` = ?;")->execute([$responsible_name, $this->getId()]);
}
public function getResponsiblePhone()
{
return $this->responsible_phone;
}
public function setResponsiblePhone($responsible_phone)
{
global $DB;
$this->responsible_phone = $responsible_phone;
$DB->prepare("UPDATE `users` SET `responsible_phone` = ? WHERE `id` = ?;")->execute([$responsible_phone, $this->getId()]);
}
public function getResponsibleEmail()
{
return $this->responsible_email;
}
public function setResponsibleEmail($responsible_email)
{
global $DB;
$this->responsible_email = $responsible_email;
$DB->prepare("UPDATE `users` SET `responsible_email` = ? WHERE `id` = ?;")->execute([$responsible_email, $this->getId()]);
}
public function getDescription()
{
return $this->description;