| 1 | = Teacher Class Creation Process = |
| 2 | |
| 3 | == Step 1 - System Login == |
| 4 | The teacher logs into the system by entering their **email** and **password**. The password is hashed and checked against the database. |
| 5 | |
| 6 | {{{ |
| 7 | SELECT id_user, username |
| 8 | FROM User |
| 9 | WHERE email = :input_email AND password = :hashed_input_pass; |
| 10 | }}} |
| 11 | ''Note:'' `:hashed_input_pass` is securely hashed before being checked. |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | == Step 2 - Teacher Dashboard == |
| 16 | After logging in, the teacher can see the **subjects** and **classes** they are assigned to. |
| 17 | |
| 18 | === List Subjects Assigned to the Teacher === |
| 19 | {{{ |
| 20 | SELECT DISTINCT s.id_subject, s.name AS subject_name |
| 21 | FROM Teacher t |
| 22 | JOIN Course c ON t.id_teacher = c.created_by |
| 23 | JOIN Subject_Course sc ON c.id_Course = sc.id_Course |
| 24 | JOIN Subject s ON sc.id_subject = s.id_subject |
| 25 | WHERE t.id_user = :curr_usr_id; |
| 26 | }}} |
| 27 | Displays all subjects the teacher is responsible for. |
| 28 | |
| 29 | === List Teacher’s Upcoming Classes === |
| 30 | {{{ |
| 31 | SELECT cl.id_class, cl.start_time, cl.end_time, cl.duration, c.id_Course, s.name AS subject_name |
| 32 | FROM Class cl |
| 33 | JOIN Teacher t ON cl.teacher_id = t.id_teacher |
| 34 | JOIN Course_Class cc ON cl.id_class = cc.id_class |
| 35 | JOIN Course c ON cc.id_Course = c.id_Course |
| 36 | JOIN Subject_Course sc ON c.id_Course = sc.id_Course |
| 37 | JOIN Subject s ON sc.id_subject = s.id_subject |
| 38 | WHERE t.id_user = :curr_usr_id AND cl.start_time >= CURRENT_TIME; |
| 39 | }}} |
| 40 | Lists upcoming classes assigned to the teacher. |
| 41 | |
| 42 | --- |
| 43 | |
| 44 | == Step 3 - Creating a New Class == |
| 45 | The teacher clicks the **"Create New Class"** button and is redirected to a form to enter class details. |
| 46 | |
| 47 | --- |
| 48 | |
| 49 | == Step 4 - Filling Out the Class Creation Form == |
| 50 | The teacher selects: |
| 51 | * **Subject** – From the list of subjects they teach. |
| 52 | * **Start Time** – Class start time (`HH:MM:SS`). |
| 53 | * **End Time** – Class end time (`HH:MM:SS`). |
| 54 | * **Duration** – Automatically calculated based on start and end time. |
| 55 | * **Course** – The course that this class belongs to. |
| 56 | |
| 57 | === Retrieve Subjects for Selection === |
| 58 | {{{ |
| 59 | SELECT DISTINCT s.id_subject, s.name |
| 60 | FROM Subject s |
| 61 | JOIN Subject_Course sc ON s.id_subject = sc.id_subject |
| 62 | JOIN Course c ON sc.id_Course = c.id_Course |
| 63 | WHERE c.created_by = :curr_teacher_id; |
| 64 | }}} |
| 65 | |
| 66 | --- |
| 67 | |
| 68 | == Step 5 - Submitting the Class to the Database == |
| 69 | After filling in the form, the system inserts the new class record. |
| 70 | |
| 71 | === Insert New Class === |
| 72 | {{{ |
| 73 | INSERT INTO Class (id_class, start_time, end_time, duration, teacher_id) |
| 74 | VALUES (:id_class, :start_time, :end_time, TIMESTAMPDIFF(MINUTE, :start_time, :end_time), :teacher_id); |
| 75 | }}} |
| 76 | ''Duration is automatically calculated using TIMESTAMPDIFF().'' |
| 77 | |
| 78 | === Link the Class to a Course === |
| 79 | {{{ |
| 80 | INSERT INTO Course_Class (id_Course, id_class) |
| 81 | VALUES (:selected_course_id, :id_class); |
| 82 | }}} |
| 83 | Links the new class to an existing course. |
| 84 | |
| 85 | --- |
| 86 | |
| 87 | == Step 6 - Confirmation & Viewing the Schedule == |
| 88 | Once the new class is created, the teacher can view their **updated schedule**. |
| 89 | |
| 90 | === Retrieve Updated Class Schedule === |
| 91 | {{{ |
| 92 | SELECT cl.id_class, cl.start_time, cl.end_time, cl.duration, s.name AS subject_name |
| 93 | FROM Class cl |
| 94 | JOIN Course_Class cc ON cl.id_class = cc.id_class |
| 95 | JOIN Course c ON cc.id_Course = c.id_Course |
| 96 | JOIN Subject_Course sc ON c.id_Course = sc.id_Course |
| 97 | JOIN Subject s ON sc.id_subject = s.id_subject |
| 98 | WHERE cl.teacher_id = :curr_teacher_id |
| 99 | ORDER BY cl.start_time ASC; |
| 100 | }}} |
| 101 | Shows all upcoming classes assigned to the teacher. |
| 102 | |
| 103 | --- |
| 104 | |
| 105 | == Step 7 - Managing Classes == |
| 106 | Teachers can **modify** or **cancel** classes if needed. |
| 107 | |
| 108 | === Cancel a Class === |
| 109 | {{{ |
| 110 | DELETE FROM Class WHERE id_class = :id_class; |
| 111 | }}} |
| 112 | Completely removes the class from the schedule. |
| 113 | |
| 114 | === Update Class Timing === |
| 115 | {{{ |
| 116 | UPDATE Class |
| 117 | SET start_time = :new_start_time, |
| 118 | end_time = :new_end_time, |
| 119 | duration = TIMESTAMPDIFF(MINUTE, :new_start_time, :new_end_time) |
| 120 | WHERE id_class = :id_class; |
| 121 | }}} |
| 122 | Updates the class timing dynamically. |
| 123 | |
| 124 | --- |
| 125 | |
| 126 | == Conclusion == |
| 127 | This **step-by-step process** allows teachers to: |
| 128 | ✔ Log in to the system. |
| 129 | ✔ View their subjects and assigned classes. |
| 130 | ✔ Create new classes and link them to courses. |
| 131 | ✔ View and manage their schedule. |