-
Notifications
You must be signed in to change notification settings - Fork 9
/
Routes.php
157 lines (98 loc) · 2.97 KB
/
Routes.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
Route::set('index.php', function() {
Index::CreateView('Index');
});
Route::set('about-us', function() {
AboutUs::CreateView('AboutUs');
// AboutUs::test();
AboutUs::printUsers();
});
Route::set('contact-us', function() {
ContactUs::CreateView('ContactUs');
});
Route::set('test', function() {
echo "test";
});
// Display all users
Route::set('listUsers', function() {
UserImpl::CreateView('ListUsers');
//User::addUser();
});
// Delete user
Route::set('deleteUser', function() {
UserImpl::deleteUser($_GET['id']);
UserImpl::CreateView('ListUsers');
});
// Update user information first page
Route::set('updateUser', function() {
//UserImpl::findUser($_GET['id']);
UserImpl::CreateView('UpdateUser');
//User::addUser();
});
// Update user information second page (confirmation)
Route::set('updateUserInfo', function() {
UserImpl::updateUserById($_POST["id"], $_POST["userName"], $_POST["password"], $_POST["role"] );
UserImpl::CreateView('UpdateUserInfo');
//User::addUser();
});
// Adding new user
Route::set('addUser', function() {
//User::listUsers();
UserImpl::CreateView('AddUser');
//User::addUser();
});
Route::set('newUser', function() {
//User::listUsers();
//$_POST["userName"];
//This method prints extra confirmation
UserImpl::addUser($_POST["userName"], $_POST["password"], $_POST["role"]);
UserImpl::CreateView('newUser');
});
// Adding new work order
Route::set('addWorkorder', function() {
WorkorderImpl::CreateView('AddWorkorder');
});
// Accept workorder
Route::set('acceptWorkorder', function() {
// accept workorder
session_start();
WorkorderImpl::acceptWorkorderById($_SESSION['contractor_id'], $_GET['id']);
// display accepted wo
WorkorderImpl::CreateView('Contractor/AcceptedWorkorders');
});
Route::set('newWorkorder', function() {
WorkorderImpl::addWorkorder($_POST["description"], $_POST["estimate"], $_POST["location"], $_POST["received"], $_POST["scheduled"], $_POST["compleated"], $_POST["location_id"]);
WorkorderImpl::CreateView('newWorkorder');
});
// Display all work orders
Route::set('listWorkorders', function() {
WorkorderImpl::CreateView('ShowWorkorders');
});
// Basic authentication
Route::set('login', function() {
LoginImpl::CreateView('LoginView');
});
// Authorization
Route::set('loginAuth', function() {
LoginImpl::loginAuth($_POST["userName"], $_POST["password"]);
header("Location: dashboard");
//LoginImpl::CreateView('Dashboard');
});
// Log out
Route::set('logout', function() {
LoginImpl::logoutSession();
});
// Test authentication
Route::set('loginTest', function() {
//LoginImpl::loginTest();
LoginImpl::CreateView('session_test');
});
// Dashboard
Route::set('dashboard', function() {
LoginImpl::CreateView('Dashboard');
});
// Display all contractors
Route::set('listContractors', function() {
ContractorImpl::CreateView('Contractor/ListContractors');
});
?>