diff --git a/Project/php/index.php b/Project/php/index.php index 84560e6..b450007 100755 --- a/Project/php/index.php +++ b/Project/php/index.php @@ -4,7 +4,11 @@ require_once __DIR__ . '/config/config.php'; require __DIR__ . '/vendor/autoload.php'; - +use model\User; +use model\Teacher; +use model\Vocabulary; +use model\Student; +use model\Group; use controleur\Controleur; //twig diff --git a/Project/php/model/User.php b/Project/php/model/User.php index 3ff7ab7..528dc63 100755 --- a/Project/php/model/User.php +++ b/Project/php/model/User.php @@ -4,34 +4,129 @@ namespace model; class User { - protected String $id; + protected int $id; protected String $mail; - protected String $nom; - protected String $prenom; + protected String $name; + protected String $surname; /** - * @param String $id - * @param String $mail - * @param String $nom - * @param String $prenom + * @param int $id + * @param string $mail + * @param string $name + * @param string $surname */ - public function __construct(string $id, string $mail, string $nom, string $prenom) + public function __construct(int $id, string $mail, string $name, string $surname) { $this->id = $id; $this->mail = $mail; - $this->nom = $nom; - $this->prenom = $prenom; + $this->name = $name; + $this->surname = $surname; } - protected function changeMail(String $newMail){ + public function changeMail(String $newMail){ $this->mail = $newMail; } - protected function changeNom(String $newNom){ - $this->nom = $newNom; + public function changeName(String $newName){ + $this->name = $newName; } - protected function changePrenom(String $newPrenom){ - $this->prenom = $newPrenom; + public function changeSurname(String $newSurname){ + $this->surname = $newSurname; } -} \ No newline at end of file + + /** + * @return int|int + */ + public function getId() + { + return $this->id; + } + + /** + * @return string|string + */ + public function getMail() + { + return $this->mail; + } + + /** + * @return string|string + */ + public function getName() + { + return $this->name; + } + + /** + * @return string|string + */ + public function getSurname() + { + return $this->surname; + } + + /** + * @param int|int $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @param string|string $mail + */ + public function setMail($mail) + { + $this->mail = $mail; + } + + /** + * @param string|string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * @param string|string $surname + */ + public function setSurname($surname) + { + $this->surname = $surname; + } + + + + + +} +/* +$u = new User(1,"mail","name","surname"); +$res = $u->getMail(); +echo "$res"; +$u->changeMail("new_mail"); +$res = $u->getMail(); +echo "
"; +echo "$res"; + +$res = $u->getName(); +echo "
"; +echo "$res"; +$u->changeName("new_name"); +$res = $u->getName(); +echo "
"; +echo "$res"; + +$res = $u->getSurname(); +echo "
"; +echo "$res"; +$u->changeSurname("new_name"); +$res = $u->getSurname(); +echo "
"; +echo "$res"; +*/ + diff --git a/Project/php/model/Vocabulaire.php b/Project/php/model/Vocabulaire.php deleted file mode 100755 index b173db8..0000000 --- a/Project/php/model/Vocabulaire.php +++ /dev/null @@ -1,24 +0,0 @@ -id = $id; - $this->nom = $nom; - $this->picture = $picture; - $this->creator = $creator; - } - - protected function changePicture(Picture $newImg){ - $this->picture = $newImg; - } -} - diff --git a/Project/php/model/Vocabulary.php b/Project/php/model/Vocabulary.php index 305c194..872d01f 100755 --- a/Project/php/model/Vocabulary.php +++ b/Project/php/model/Vocabulary.php @@ -7,22 +7,19 @@ class Vocabulary protected $map = array( "fr" => "eng" ); - protected String $nom; + protected String $name; protected String $image; - protected String $theme; /** * @param string[] $map - * @param String $nom + * @param String $name * @param String $image - * @param String $theme */ - public function __construct(array $map, $nom, $image, $theme) + public function __construct(array $map, $name, $image) { $this->map = $map; - $this->nom = $nom; + $this->name = $name; $this->image = $image; - $this->theme = $theme; } @@ -53,9 +50,9 @@ class Vocabulary /** * @return String */ - public function getNom() + public function getName() { - return $this->nom; + return $this->name; } /** @@ -66,14 +63,6 @@ class Vocabulary return $this->image; } - /** - * @return String - */ - public function getTheme() - { - return $this->theme; - } - /** * @param string[] $map */ @@ -85,9 +74,9 @@ class Vocabulary /** * @param String $nom */ - public function setNom($nom) + public function setName($name) { - $this->nom = $nom; + $this->name = $name; } /** @@ -98,16 +87,21 @@ class Vocabulary $this->image = $image; } - /** - * @param String $theme - */ - public function setTheme($theme) - { - $this->theme = $theme; - } - - - } - +/* +$v = new Vocabulary(array("bonjour" =>"hello"),"test_A1","pas d'image"); + +$res1 = $v->getMap(); +print_r($res1); +echo "\n"; +$trad = $v->translateToEnglish("bonjour"); +echo "$trad"; +$v->addTranslation("chaise","chair"); +echo "\n"; +$res1 = $v->getMap(); +print_r($res1); + +$trad = $v->translateToFrench("chair"); +echo "$trad"; +*/