You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
982 B
42 lines
982 B
<?php
|
|
|
|
namespace model;
|
|
|
|
use gateway\UserGateway;
|
|
use gateway\VocabularyGateway;
|
|
use gateway\VocabularyListGateway;
|
|
|
|
class MdlStudent extends MdlUser
|
|
{
|
|
public function getAll():array
|
|
{
|
|
$gtw = new VocabularyListGateway();
|
|
return $gtw->findAll();
|
|
}
|
|
|
|
public function getVocabByName(string $name):array
|
|
{
|
|
$gtw = new VocabularyListGateway();
|
|
return $gtw->findByName($name);
|
|
}
|
|
|
|
public function getVocByGroup(int $group): array
|
|
{
|
|
$gtw = new VocabularyListGateway();
|
|
return $gtw->findByGroup($group);
|
|
}
|
|
|
|
public function getVocabById(int $id): VocabularyList
|
|
{
|
|
$gtw = new VocabularyListGateway();
|
|
return $gtw->findById($id);
|
|
}
|
|
|
|
public function is(string $login, array $roles): ?User
|
|
{
|
|
$gtw = new UserGateway();
|
|
$user = $gtw->findUserByEmail($login);
|
|
return $user->getRoles() == $roles && in_array('student', $user->getRoles()) ? $user : null;
|
|
}
|
|
}
|