-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanageProfessorsSubmit.php
51 lines (44 loc) · 2.01 KB
/
manageProfessorsSubmit.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
<?php
include 'functions.php';
if(!empty($_POST)){
if (!empty($_POST['submit'])) {
$submit = $_POST['submit'];
if ($submit == 'add') {
if (!empty($_POST['professorPassword']) && !empty($_POST['professorUsername'])&& !empty($_POST['selectedDepartmentId'])) {
$departmentId = $_POST['selectedDepartmentId'];
$professorUsername = $_POST['professorUsername'];
$professorPassword = $_POST['professorPassword'];
$isExecutedSuccessful = addProfessor($professorUsername, $professorPassword, $departmentId);
}
} else if ($submit == 'change') {
if (!empty($_POST['selectedProfessorId'])) {
$professorId = $_POST['selectedProfessorId'];
if(!empty($_POST['professorUsername'])){
$professorUsername = $_POST['professorUsername'];
$isExecutedSuccessful = changeProfessorUsername($professorUsername, $professorId);
}
if(!empty($_POST['professorPassword'])){
$professorPassword = $_POST['professorPassword'];
$isExecutedSuccessful = changeProfessorPassword($professorPassword, $professorId);
}
}
} else if ($submit == 'transfer') {
if (!empty($_POST['selectedProfessorId']) && !empty($_POST['selectedDepartmentIdTo'])) {
$professorId = $_POST['selectedProfessorId'];
$departmentIdTo = $_POST['selectedDepartmentIdTo'];
$isExecutedSuccessful = transferProfessor($professorId, $departmentIdTo);
}
} else if ($submit == 'remove') {
if (!empty($_POST['selectedProfessorId'])) {
$professorId = $_POST['selectedProfessorId'];
$isExecutedSuccessful = removeProfessor($professorId);
}
}
}
}
if(!empty($isExecutedSuccessful)) {
echo queryStatusMessage($isExecutedSuccessful);
} else {
echo emptyFormMessage();
}
?>