-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanageGrades.php
90 lines (82 loc) · 5.78 KB
/
manageGrades.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
<?php
include 'header.php';
checkAndRedirectNotAuthorizedUsers($_SESSION, array("ADMIN", "SECRETARY", "PROFESSOR"));
?>
<script src="gradesAjax.js"></script>
<script src="formSubmitAjax.js"></script>
<div class="formContainer">
<div id="msg"></div>
<div class="grade" id="add">
<h4>Add Grade</h4>
<form action="manageGradesSubmit.php" method="post">
<?php
if(isLoginAsAdmin()) {
echo generateDropDownListWithFirstOption(getAllUniversitiesNames(), "Select University", 'selectedUniversity', 'selectedUniversityAdd');
echo generateDropDownListWithFirstOption(null, "Select University First", 'selectedDepartmentId', 'selectedDepartmentAdd');
echo generateDropDownListWithFirstOption(null, "Select Department First", 'selectedStudentId', 'selectedStudentAdd');
echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseAdd');
} else if(isLoginAsSecretary()) {
$departmentId = $_SESSION["departmentId"];
echo "<input type='hidden' id='selectedDepartmentAdd' name='selectedDepartmentId' value='$departmentId'>";
echo generateDropDownListWithFirstOptionAndSpecifiedValueKey(getStudents($departmentId), "Select Student", 'selectedStudentId', 'selectedStudentAddSec', 'studentId', 'studentUsername');
echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseAddSec');
} else if(isLoginAsProfessor()) {
$departmentId = $_SESSION["departmentId"];
echo "<input type='hidden' id='selectedDepartmentAdd' name='selectedDepartmentId' value='$departmentId'>";
echo generateDropDownListWithFirstOptionAndSpecifiedValueKey(getStudents($departmentId), "Select Student", 'selectedStudentId', 'selectedStudentAddSec', 'studentId', 'studentUsername');
echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseAddSec');
}
?>
<input type="text" name="gradeValue" placeholder="Grade Value"><br>
<input type="submit" name="submit" value="add">
</form>
</div>
<?php if(!isLoginAsProfessor()) { ?>
<div class="grade" id="change">
<h4>Change Grade</h4>
<form action="manageGradesSubmit.php" method="post">
<?php
if(isLoginAsAdmin()) {
echo generateDropDownListWithFirstOption(getAllUniversitiesNames(), "Select University", 'selectedUniversity', 'selectedUniversityChange');
echo generateDropDownListWithFirstOption(null, "Select University First", 'selectedDepartmentId', 'selectedDepartmentChange');
echo generateDropDownListWithFirstOption(null, "Select Department First", 'selectedStudentId', 'selectedStudentChange');
echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseChange');
echo generateDropDownListWithFirstOption(null, "Select Course First", 'selectedGradeId', 'selectedGradeChange');
} else if(isLoginAsSecretary()) {
$departmentId = $_SESSION["departmentId"];
echo "<input type='hidden' id='selectedDepartmentChange' name='selectedDepartmentId' value='$departmentId'>";
echo generateDropDownListWithFirstOptionAndSpecifiedValueKey(getStudents($departmentId), "Select Student", 'selectedStudentId', 'selectedStudentChangeSec', 'studentId', 'studentUsername');
echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseChangeSec');
echo generateDropDownListWithFirstOption(null, "Select Course First", 'selectedGradeId', 'selectedGradeChangeSec');
}
?>
<input type="text" name="gradeValue" placeholder="New Grade Value"><br>
<input type="submit" name="submit" value="change">
</form>
</div>
<div class="grade" id="remove">
<h4>Remove Grade</h4>
<form action="manageGradesSubmit.php" method="post">
<?php
if(isLoginAsAdmin()) {
echo generateDropDownListWithFirstOption(getAllUniversitiesNames(), "Select University", 'selectedUniversity', 'selectedUniversityRemove');
echo generateDropDownListWithFirstOption(null, "Select University First", 'selectedDepartmentId', 'selectedDepartmentRemove');
echo generateDropDownListWithFirstOption(null, "Select Department First", 'selectedStudentId', 'selectedStudentRemove');
echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseRemove');
echo generateDropDownListWithFirstOption(null, "Select Course First", 'selectedGradeId', 'selectedGradeRemove');
} else if(isLoginAsSecretary()) {
$departmentId = $_SESSION["departmentId"];
echo "<input type='hidden' id='selectedDepartmentRemove' name='selectedDepartmentId' value='$departmentId'>";
echo generateDropDownListWithFirstOptionAndSpecifiedValueKey(getStudents($departmentId), "Select Student", 'selectedStudentId', 'selectedStudentRemoveSec', 'studentId', 'studentUsername');
echo generateDropDownListWithFirstOption(null, "Select Student First", 'selectedCourseId', 'selectedCourseRemoveSec');
echo generateDropDownListWithFirstOption(null, "Select Course First", 'selectedGradeId', 'selectedGradeRemoveSec');
}
?>
<input type="submit" name="submit" class="warningButton" value="remove">
</form>
</div>
<?php } ?>
</div>
<?php
include 'footer.php';
?>