initial commit

This commit is contained in:
root
2024-06-03 16:43:53 +03:00
commit 21e3fd0797
1535 changed files with 60499 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
$servername = "localhost";
$username = "usr";
$password = "admin@1224";
$dbname = "main_bpitattendance_db";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$searchType = $_GET['search_type'];
$searchText = $_GET['search_text'];
if ($searchType === "course") {
$sql = "SELECT stud_first_name, stud_last_name, date_of_birth, batch_year FROM student_record";
} else {
$sql = "SELECT stud_first_name, stud_last_name, date_of_birth, batch_year FROM student_record WHERE enrollment_no = '$searchText'";
}
$result = $conn->query($sql);
if ($result->num_rows > 0) {
if ($searchType === "course") {
echo "<table><tr><th>Student Name</th><th>Date of Birth</th><th>Batch Year</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["stud_first_name"] . " " . $row["stud_last_name"] . "</td><td>" . $row["date_of_birth"] . "</td><td>" . $row["batch_year"] . "</td></tr>";
}
echo "</table>";
} else {
$row = $result->fetch_assoc();
echo "<table><tr><th>Student Name</th><th>Date of Birth</th><th>Batch Year</th></tr>";
echo "<tr><td>" . $row["stud_first_name"] . " " . $row["stud_last_name"] . "</td><td>" . $row["date_of_birth"] . "</td><td>" . $row["batch_year"] . "</td></tr>";
echo "</table>";
}
} else {
echo "0 results";
}
$conn->close();
?>

View File

@@ -0,0 +1,214 @@
<!-- <!DOCTYPE html>
<html>
<head>
<title>Display Students</title>
<link rel="stylesheet" href="view.css">
<script>
function selectRadioButton(buttonId) {
var buttons = document.querySelectorAll('.radio-button');
for (var i = 0; i < buttons.length; i++) {
buttons[i].classList.remove('selected');
}
document.getElementById(buttonId).classList.add('selected');
}
function displayStudents() {
var searchType = document.querySelector('.radio-button.selected').getAttribute('data-search-type');
var searchText = document.getElementById("search_text").value.trim();
if (searchText === "") {
alert("Please enter a search term.");
return;
}
var studentList = document.getElementById("student_list");
var searchResult = document.getElementById("search_result");
if (searchType === "course") {
// Display course search result
studentList.innerHTML = `
<table>
<thead>
<tr>
<th>Student Name</th>
<th>Date of Birth</th>
<th>Batch Year</th>
</tr>
</thead>
<tbody>
<tr>
<td>John Doe</td>
<td>1990-01-01</td>
<td>2021-25</td>
</tr>
<tr>
<td>Jane Smith</td>
<td>1992-05-15</td>
<td>2021-25</td>
</tr>
<tr>
<td>Michael Johnson</td>
<td>1988-11-30</td>
<td>2021-25</td>
</tr>
</tbody>
</table>`;
searchResult.innerHTML = "";
} else {
// Display enrollment search result
searchResult.innerHTML = `
<table>
<thead>
<tr>
<th>Student Name</th>
<th>Date of Birth</th>
<th>Batch Year</th>
</tr>
</thead>
<tbody>
<tr>
<td>John Doe</td>
<td>1990-01-01</td>
<td>2021-25</td>
</tr>
</tbody>
</table>`;
studentList.innerHTML = "";
}
}
</script>
</head>
<body>
<h1>Teacher Dashboard</h1>
<div id="search_option">
<button id="search_by_course" class="radio-button selected" data-search-type="course" onclick="selectRadioButton('search_by_course')">Search by Course ID</button>
<button id="search_by_enrollment" class="radio-button" data-search-type="enrollment" onclick="selectRadioButton('search_by_enrollment')">Search by Enrollment Number</button>
</div>
<div id="search">
<input type="text" id="search_text" placeholder="Enter search term">
<button id="click" onclick="displayStudents()">Search</button>
</div>
<div id="student_list"></div>
<div id="search_result"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Display Students</title>
<link rel="stylesheet" href="view.css">
<script>
function selectRadioButton(buttonId) {
var buttons = document.querySelectorAll('.radio-button');
for (var i = 0; i < buttons.length; i++) {
buttons[i].classList.remove('selected');
}
document.getElementById(buttonId).classList.add('selected');
}
function displayStudents() {
var searchType = document.querySelector('.radio-button.selected').getAttribute('data-search-type');
var searchText = document.getElementById("search_text").value.trim();
if (searchText === "") {
alert("Please enter a search term.");
return;
}
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
var response = xhr.responseText;
if (searchType === "course") {
document.getElementById("student_list").innerHTML = response;
document.getElementById("search_result").innerHTML = "";
} else {
document.getElementById("search_result").innerHTML = response;
document.getElementById("student_list").innerHTML = "";
}
} else {
alert('There was a problem with the request.');
}
}
};
xhr.open("GET", "get_students.php?search_type=" + searchType + "&search_text=" + searchText, true);
xhr.send();
}
</script>
</head>
<body>
<h1>Teacher Dashboard</h1>
<div id="search_option">
<button id="search_by_course" class="radio-button selected" data-search-type="course" onclick="selectRadioButton('search_by_course')">Search by Course ID</button>
<button id="search_by_enrollment" class="radio-button" data-search-type="enrollment" onclick="selectRadioButton('search_by_enrollment')">Search by Enrollment Number</button>
</div>
<div id="search">
<input type="text" id="search_text" placeholder="Enter search term">
<button id="click" onclick="displayStudents()">Search</button>
</div>
<div id="student_list"></div>
<div id="search_result"></div>
</body>
</html> -->
<!DOCTYPE html>
<html>
<head>
<title>Display Students</title>
<link rel="stylesheet" href="view.css">
<script>
function selectRadioButton(buttonId) {
var buttons = document.querySelectorAll('.radio-button');
for (var i = 0; i < buttons.length; i++) {
buttons[i].classList.remove('selected');
}
document.getElementById(buttonId).classList.add('selected');
}
function displayStudents() {
var searchType = document.querySelector('.radio-button.selected').getAttribute('data-search-type');
var searchText = document.getElementById("search_text").value.trim();
if (searchText === "") {
alert("Please enter a search term.");
return;
}
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
var response = xhr.responseText;
if (searchType === "course") {
document.getElementById("student_list").innerHTML = response;
document.getElementById("search_result").innerHTML = "";
} else {
document.getElementById("search_result").innerHTML = response;
document.getElementById("student_list").innerHTML = "";
}
} else {
alert('There was a problem with the request.');
}
}
};
xhr.open("GET", "get_students.php?search_type=" + searchType + "&search_text=" + searchText, true);
xhr.send();
}
</script>
</head>
<body>
<h1>Teacher Dashboard</h1>
<div id="search_option">
<button id="search_by_course" class="radio-button selected" data-search-type="course" onclick="selectRadioButton('search_by_course')">Search by Course ID</button>
<button id="search_by_enrollment" class="radio-button" data-search-type="enrollment" onclick="selectRadioButton('search_by_enrollment')">Search by Enrollment Number</button>
</div>
<div id="search">
<input type="text" id="search_text" placeholder="Enter search term">
<button id="click" onclick="displayStudents()">Search</button>
</div>
<div id="student_list"></div>
<div id="search_result"></div>
</body>
</html>

103
nakul/teacher_dash/view.css Normal file
View File

@@ -0,0 +1,103 @@
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
text-align: center;
margin-bottom: 20px;
padding: 70px;
letter-spacing: 3px;
background-color: #c7c7c7;
}
.radio-button {
display: inline-block;
background-color: #c3c3c3;
border: 2px solid #000000;
padding: 8px 16px;
margin-right: 10px;
border-radius: 4px;
cursor: pointer;
}
.radio-button.selected {
background-color: #000000;
color: #fff;
}
input[type="numbers"] {
padding: 5px;
margin-bottom: 10px;
}
button {
padding: 8px 20px;
background-color: #989898;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #000000;
}
#search_option {
margin-bottom: 10px;
display: flex;
justify-content: center;
}
#student_list,
#search_result {
margin-top: 20px;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #c3c3c3;
/* color: #fff; */
}
#student_list table,
#search_result table {
margin-top: 10px;
}
#search {
display: flex;
justify-content: center;
gap: 15px;
margin-top: 20px;
}
#search_by_enrollment, #search_by_course {
width: 300px;
height: 50px;
font-size: 18px;
}
#search_text {
height: 40px;
width: 100%;
font-size: 20px;
padding-left: 14px;
}
#click {
width: 20%;
/* height: 51px; */
font-size: 20px;
}