fixed a wrong named variable
This commit is contained in:
parent
744117d958
commit
1b794f775d
|
@ -13,7 +13,6 @@ use App\Entity\User;
|
||||||
use App\Service\Router;
|
use App\Service\Router;
|
||||||
use App\Service\Template;
|
use App\Service\Template;
|
||||||
use App\Repository\UserRepository;
|
use App\Repository\UserRepository;
|
||||||
use JetBrains\PhpStorm\NoReturn;
|
|
||||||
|
|
||||||
class AddressBookAdminController
|
class AddressBookAdminController
|
||||||
{
|
{
|
||||||
|
@ -39,7 +38,7 @@ class AddressBookAdminController
|
||||||
|
|
||||||
public function admin(): never
|
public function admin(): never
|
||||||
{
|
{
|
||||||
// TODO $this->adminCheck();
|
$this->adminCheck();
|
||||||
$this->template->render(templateName: 'admin/index.html.php', vars: [
|
$this->template->render(templateName: 'admin/index.html.php', vars: [
|
||||||
'user' => $this->user,
|
'user' => $this->user,
|
||||||
'router' => $this->router
|
'router' => $this->router
|
||||||
|
@ -49,7 +48,7 @@ class AddressBookAdminController
|
||||||
|
|
||||||
public function adminUser(): never
|
public function adminUser(): never
|
||||||
{
|
{
|
||||||
// TODO $this->adminCheck();
|
$this->adminCheck();
|
||||||
|
|
||||||
$users = $this->userRepository->findAll();
|
$users = $this->userRepository->findAll();
|
||||||
|
|
||||||
|
@ -62,7 +61,7 @@ class AddressBookAdminController
|
||||||
|
|
||||||
public function adminUserEdit(array $parameters): never
|
public function adminUserEdit(array $parameters): never
|
||||||
{
|
{
|
||||||
// TODO $this->adminCheck();
|
$this->adminCheck();
|
||||||
|
|
||||||
if (!empty($_POST)) {
|
if (!empty($_POST)) {
|
||||||
if (!empty($_POST['is_admin'])) {
|
if (!empty($_POST['is_admin'])) {
|
||||||
|
@ -108,8 +107,7 @@ class AddressBookAdminController
|
||||||
// TODO currently breaks on inserting a duplicate nick
|
// TODO currently breaks on inserting a duplicate nick
|
||||||
if (!empty($_POST)) {
|
if (!empty($_POST)) {
|
||||||
$isAdmin = empty($_POST['is_admin']) ? 0 : 1;
|
$isAdmin = empty($_POST['is_admin']) ? 0 : 1;
|
||||||
echo "isA: $isAdmin";
|
$user = new User(nick: $_POST['nick'], newPassword: $_POST['new_password'], first: $_POST['first'], last: $_POST['last'], isAdmin: $isAdmin);
|
||||||
$user = new User(nick: $_POST['nick'], password: $_POST['password'], first: $_POST['first'], last: $_POST['last'], isAdmin: $isAdmin);
|
|
||||||
|
|
||||||
if ($this->userRepository->insert(user: $user)) {
|
if ($this->userRepository->insert(user: $user)) {
|
||||||
$users = $this->userRepository->findAll();
|
$users = $this->userRepository->findAll();
|
||||||
|
|
Loading…
Reference in New Issue