YOUR SUBMITTED EVALUATIONS
This page displays all the evaluations you have submitted for other groups.
These evaluations are final and cannot be changed.
prepare($sql_course)) { // Bind variables to the prepared statement as parameters $stmt_course->bind_param("s", $param_courseID); // Set parameters $param_courseID = $courseID; // Attempt to execute the prepared statement if ($stmt_course->execute()) { // Get result $result = $stmt_course->get_result(); // Check if the course exists if ($result->num_rows == 1) { // Fetch result as an associative array $courseDetails = $result->fetch_assoc(); $coursename = $courseDetails['coursename']; $degree = $courseDetails['degree']; $startdate = $courseDetails['start']; $time = $courseDetails['time']; $room = $courseDetails['room']; $instructorID = $courseDetails['instructorID']; } else { // Course not found, handle the error as needed header('Location: /acb/login.html?error=Course not found'); exit(); } } else { echo "Oops! Something went wrong. Please try again later."; } // Close statement $stmt_course->close(); } // Create DateTime objects try { $startdateObj = new DateTime($startdate); $timeObj = new DateTime($time); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; exit; } // Translate day of the week and time of day $dayOfWeek = translateDayOfWeek($startdateObj->format('l')); $timeOfDay = translateTimeOfDay((int)$timeObj->format('H')); // Format date and time $startdateFormatted = $startdateObj->format('d/m/Y'); $timeFormatted = $timeObj->format('H:i'); // Combine the time description $fullTimeDescription = $timeFormatted . ' (' . $dayOfWeek . ' ' . $timeOfDay . ')'; //echo $fullTimeDescription; // Fetch instructor's full name based on instructorID $instructor = 'Instructor not found'; $sql_instructor = "SELECT fullname FROM instructors WHERE instructorID = ?"; if ($stmt_instructor = $link->prepare($sql_instructor)) { // Bind variables to the prepared statement as parameters $stmt_instructor->bind_param("s", $param_instructorID); // Set parameters $param_instructorID = $instructorID; // Attempt to execute the prepared statement if ($stmt_instructor->execute()) { // Get result $result = $stmt_instructor->get_result(); // Check if the instructor exists if ($result->num_rows == 1) { // Fetch result as an associative array $instructorData = $result->fetch_assoc(); $instructor = $instructorData['fullname']; } else { // Instructor not found, handle the error as needed $instructor = 'Instructor not found'; } } else { echo "Oops! Something went wrong. Please try again later."; } // Close statement $stmt_instructor->close(); } // Get all evaluated data // Step 1: Fetch all submitted evaluations for this student $sql = "SELECT * FROM midterm WHERE courseID = ? AND studentID = ? ORDER BY sessionID ASC, type DESC"; $stmt = $link->prepare($sql); $stmt->bind_param("ss", $courseID, $studentID); $stmt->execute(); $result = $stmt->get_result(); $evaluated = []; // Final array to store evaluations while ($row = $result->fetch_assoc()) { // Step 2: Extract sessionID (e.g., "1A", "2B") and compute topicID $sessionID = $row['sessionID']; $sessionIndex = intval($sessionID[0]); // Extract first character as integer $topicID = $sessionIndex + 1; // Subtract 1 to get correct topicID // Step 3: Lookup topic name from topics table $sqlTopic = "SELECT name FROM topics WHERE id = ?"; $stmtTopic = $link->prepare($sqlTopic); if ($stmtTopic) { // Ensure statement was prepared successfully $stmtTopic->bind_param("i", $topicID); $stmtTopic->execute(); $resultTopic = $stmtTopic->get_result(); $topicName = ($rowTopic = $resultTopic->fetch_assoc()) ? $rowTopic['name'] : "Unknown Topic"; $stmtTopic->close(); // Only close if the statement was initialized } else { $topicName = "Unknown Topic"; // Default value if the statement fails } // Add topic name to evaluation entry $row['topicName'] = $topicName; // Step 4: Calculate average of c1 to c10 (10 evaluation criteria) $criteria = ['c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'c10']; $total = 0; $count = 0; foreach ($criteria as $criterion) { if (isset($row[$criterion]) && is_numeric($row[$criterion])) { $total += $row[$criterion]; $count++; } } // Calculate and round the average $row['averageScore'] = ($count > 0) ? round($total / $count, 1) : null; // Step 5: Fetch team members of the presenting/discussing group $groupID = $row['group']; $teamMembers = []; $sqlTeam = "SELECT lastname, firstname FROM students WHERE courseID = ? AND `group` = ?"; $stmtTeam = $link->prepare($sqlTeam); $stmtTeam->bind_param("ss", $courseID, $groupID); $stmtTeam->execute(); $resultTeam = $stmtTeam->get_result(); while ($teamRow = $resultTeam->fetch_assoc()) { $teamMembers[] = $teamRow['lastname'] . " " . $teamRow['firstname']; } // Step 6: Add team members to the evaluated array $row['team'] = !empty($teamMembers) ? implode(", ", $teamMembers) : "Unknown Team"; $evaluated[] = $row; // Store modified row in final array } // Fetch evaluation criteria descriptions $criteriaDescriptions = []; $sql = "SELECT * FROM criteria"; $result = $link->query($sql); while ($row = $result->fetch_assoc()) { $criteriaDescriptions[$row['id']] = [ 'present' => $row['present'], 'discuss' => $row['discuss'] ]; } // Close database connection $stmt->close(); $link->close(); ?>
This page displays all the evaluations you have submitted for other groups.
These evaluations are final and cannot be changed.