-
Notifications
You must be signed in to change notification settings - Fork 0
/
sustain.php
34 lines (31 loc) · 1.6 KB
/
sustain.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require_once __DIR__ . "/controller/NavController.php";
require_once __DIR__ . "/model/AdminModel.php";
require_once __DIR__ . '/view/twig.php';
session_start();
if ($_SESSION['access'] < 1) {
header("Location: login.php");
die();
} else if ($_SESSION['access'] < 3) {
$nav = new NavController();
echo $twig->render('message.html.twig', ['nav' => $nav->getNav(),
'title' => "Authorization required", 'icon' => 'lock_outline', 'message' => 'You do not have access to this function',
'buttons' => [['name' => 'Change profile', 'icon' => 'lock_open', 'link' => 'logout.php']],]);
} else {
$model = new AdminModel();
$nav = new NavController();
if(!isset($_REQUEST['id'])){
echo $twig->render('message.html.twig', ['nav' => $nav->getNav(),
'title' => "Error", 'icon' => 'error_outline', 'message' => 'No id was passed',
'buttons' => [['name' => 'Try again', 'icon' => 'replay', 'link' => 'deed.php']],]);
}
else if ($model->sustainReport($_REQUEST['id']) == true) {
echo $twig->render('message.html.twig', ['nav' => $nav->getNav(),
'title' => "Success", 'icon' => 'done', 'message' => 'Report was successfully sustained',
'buttons' => [['name' => 'Process another report', 'icon' => 'replay', 'link' => 'deed.php']],]);
} else {
echo $twig->render('message.html.twig', ['nav' => $nav->getNav(),
'title' => "Error", 'icon' => 'error_outline', 'message' => 'Report has been already processed',
'buttons' => [['name' => 'Try again', 'icon' => 'replay', 'link' => 'deed.php']],]);
}
}