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.
44 lines
1.3 KiB
44 lines
1.3 KiB
<?php
|
|
|
|
namespace model;
|
|
|
|
use config\Connection;
|
|
use gateway\UserGateway;
|
|
|
|
class MdlAdmin extends AbsModel
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct("admin");
|
|
}
|
|
|
|
/*public function isAdmin(){
|
|
if( isset ($_SESSION['login'])){
|
|
$login = strip_tags($_SESSION['login']);
|
|
$user = $this->gtw->findUserByEmail($login);
|
|
if ($user && $this->gtw->isAdmin($user->getId())) return $user;
|
|
else return null;
|
|
}
|
|
else return null;
|
|
}*/
|
|
|
|
public function showAllUsers(): array {
|
|
$gtw = new UserGateway(new Connection('mysql:host=localhost;dbname=dbanrichard7', 'anrichard7', 'achanger'));
|
|
return $gtw->findAll();
|
|
}
|
|
|
|
public function showAllAdmins(): array {
|
|
$gtw = new UserGateway(new Connection('mysql:host=localhost;dbname=dbanrichard7', 'anrichard7', 'achanger'));
|
|
return $gtw->findAllAdmins();
|
|
}
|
|
|
|
public function showAllTeachers(): array {
|
|
$gtw = new UserGateway(new Connection('mysql:host=localhost;dbname=dbanrichard7', 'anrichard7', 'achanger'));
|
|
return $gtw->findAllTeachers();
|
|
}
|
|
|
|
public function showAllStudents(): array {
|
|
$gtw = new UserGateway(new Connection('mysql:host=localhost;dbname=dbanrichard7', 'anrichard7', 'achanger'));
|
|
return $gtw->findAllStudents();
|
|
}
|
|
} |