case "defined": $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $query_timeslot1 = "SELECT classroom_id from timetable_info WHERE classroom_id ='" . $_POST['classroom_id'] . "'"; $timeslot1 = $mysqli->query($query_timeslot1) or die(mysql_error()); $totalRows_timeslot1 = $timeslot1->num_rows; if ($totalRows_timeslot1 < 1) { $query_timeslot2 = "SELECT classroom_id from timetable_info_firstyear WHERE classroom_id ='" . $_POST['classroom_id'] . "'"; $timeslot2 = $mysqli->query($query_timeslot2) or die(mysql_error()); $totalRows_timeslot2 = $timeslot2->num_rows; if ($totalRows_timeslot2 < 1) { drawNotification("Error", "There is no any class for the given classroom.", "error"); } } else { $colname_rs_croom_info = "-1"; if (isset($_POST['classroom_id'])) { $colname_rs_croom_info = $_POST['classroom_id']; } //gives a relation having info_id, emp_id, subject_id, course_id, branch_id, slot_id, classroom_id, semester, subject_name, salutation, first_name, middle_name, last_name, design, dept_id $query_rs_croom_info = sprintf("SELECT * FROM timetable_info, user_details, subjects WHERE timetable_info.emp_id=user_details.emp_id AND timetable_info.subject_id=subjects.subject_id AND classroom_id = %s", GetSQLValueString($colname_rs_croom_info, "int")); //perform query $rs_croom_info = $mysqli->query($query_rs_croom_info) or die(mysql_error()); //returns a row from the record set $row_rs_croom_info = $rs_croom_info->fetch_assoc(); //returns total number of rows in the set $totalRows_rs_croom_info = $rs_croom_info->num_rows; ?>
case "defined": $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $query_timeslot = "SELECT * from timetable_info_firstyear WHERE emp_id ='" . $_SESSION['id'] . "'"; $timeslot = $mysqli->query($query_timeslot) or die(mysql_error()); $totalRows_timeslot = $timeslot->num_rows; ?> <div class="view_table"> <center> <?php if ($totalRows_timeslot < 1) { drawNotification("Error", "There is no any timetable exist for you.", "error"); } else { while ($row = $mysqli->fetch_assoc($timeslot)) { $lectures[$row['slot_id']] = $row['subject_id']; $classrooms[$row['slot_id']] = $row['classroom_id']; $subjects[] = $row['subject_id']; } //removing duplicate subject_ids array_unique($subjects); $subject_str = implode("','", $subjects); $query_rs_subject = "SELECT * FROM subjects WHERE subject_id IN('" . $subject_str . "')"; $rs_subject = $mysqli->query($query_rs_subject) or die(mysql_error()); $totalRows_rs_subject = $rs_subject->num_rows; echo "<h3><a href='faculty_subject.php'>GO BACK</a></h3>"; echo "<h3>Time Table For You</h3>"; echo '
require_once "../Includes/Layout.php"; require_once "../Includes/Auth.php"; require_once "../Includes/ConfigSQL.php"; auth("deo"); //initialize the secure session if it is not initialized session_start_sec(); //to redirect to logout.php page if user is not logged in if (!isset($_SESSION['id'])) { header("Location:../Logout.php"); } $year = Date("Y"); //if it gets session value from post variable if (isset($_POST['session'])) { $sql_query = "insert into subject_faculty values('" . $_POST['faculty'] . "','" . $_POST['subject'] . "','" . $_POST['session'] . "')"; $sql = $mysqli->query($sql_query); drawNotification("Assigned", "The given Subject (" . $_POST['subject'] . ") has been assigned successfully to Faculty (" . $_POST['faculty'] . ")", "success"); } //to fetch subjects from subjects table $subject_query = "select * from subjects"; $subject = $mysqli->query($subject_query); $faculty_query = "select * from user_details, emp_basic_details where user_details.id=emp_basic_details.id and emp_basic_details.auth_id='ft'"; $faculty = $mysqli->query($faculty_query); echo '<form name="form" action="" method="post"> <table> <tr> <td> Select Session: </td> <td> <select name="session"> <option value="' . ($year - 1) . '-' . $year . '">' . ($year - 1) . '-' . $year . '</option>
require_once "../Includes/ConfigSQL.php"; //to draw header drawHeader() is calling drawHeader("TimeTable Info System"); //initialize the session if it is not initialized if (!isset($_SESSION)) { session_start(); } //to redirect to logout.php page if user is not logged in if (!isset($_SESSION['id'])) { header("Location:../Logout.php"); } if (isset($_GET['notification'])) { drawNotification($_GET['notification'], $_GET['content'], $_GET['type']); } if (is_auth("stu")) { header("Location:student.php"); } else { if (is_auth("deo")) { header("Location:dataoperator_timetable.php"); } else { if (is_auth("ft") || is_auth("hod")) { header("Location:view_faculty.php"); } else { drawNotification("Error", "Sorry you are not allowed to access the page.", "error"); } } } drawFooter(); ?> </body> </html>
$classroom_ans = $mysqli->query($classroom_query); $num_building = $classroom_ans->num_rows; if ($num_building < 1) { drawNotification("Error", "There is no any building free to be blocked.", "error"); die; } if (isset($_POST['semester'])) { $sql = "update timetable_classrooms set status='occupied' where building='" . $_POST['building'] . "' and room='" . $_POST['room'] . "'"; $sql_ans = $mysqli->query($sql); $classroom_id_query = "select classroom_id from timetable_classrooms where building='" . $_POST['building'] . "' and room='" . $_POST['room'] . "'"; $classroom_id_ans = $mysqli->query($classroom_id_query); $row_classroom_id = $classroom_id_ans->fetch_assoc(); $classroom_id = $row_classroom_id['classroom_id']; $insert_classroom_id_query = "insert into timetable_classroom_classes('classroom_id','semester','section') values('" . $classroom_id . "','" . $_POST['semester'] . "','" . $_POST['section'] . "')"; $insert_classroom_id_ans = $mysqli->query($insert_classroom_id_query); drawNotification("Assigned", "The entered classroom (" . $_POST['building'] . " " . $_POST['room'] . ") has been assigned successfully for Semester" . $_POST['semester'] . " (Section " . $_POST['section'] . ")", "success"); } ?> <form name="form" action="" method="post"> <table> <tr> <td> Section Semester: </td> <td> <select name="semester"> <option value="">Select Semester</option> <option value="1">1</option> <option value="2">2</option> </select>
} } $colname_rs_faculty_time_table = "-1"; if (isset($_SESSION['id'])) { $colname_rs_faculty_time_table = $_SESSION['id']; } //to format the expression into string variable $query_rs_faculty_time_table = sprintf("SELECT * FROM timetable_info_firstyear WHERE section='" . $_GET['b'] . "'"); $query_rs_croom_info = sprintf("SELECT * FROM timetable_info_firstyear, user_details, subjects WHERE timetable_info_firstyear.emp_id=user_details.id AND timetable_info_firstyear.subject_id=subjects.subject_id AND section = %s", GetSQLValueString($_GET['b'], "text")); //perform query $rs_faculty_time_table = $mysqli->query($query_rs_faculty_time_table) or die(mysql_error()); $rs_faculty_time_t = $mysql->query($query_rs_croom_info) or die(mysql_error()); //to find the total number of rows in the set $totalRows_rs_faculty_time_table = $rs_faculty_time_table->num_rows; if (!$totalRows_rs_faculty_time_table) { drawNotification("Error", "There is no any class exists for given section.", "error"); } else { // mapping slots and subject ids //listing subjects $lectures = array(); $subjects = array(); while ($row = $rs_faculty_time_t->fetch_assoc()) { $lectures[$row['slot_id']] = $row['subject_id']; $subject_name[$row['slot_id']] = $row['subject_name']; $faculty[$row['slot_id']] = $row['emp_id']; $classroom_id = $row['classroom_id']; } $query_classroom = "SELECT building,room FROM timetable_classrooms WHERE classroom_id='" . $classroom_id . "'"; $classroom_result = $mysqli->query($query_classroom) or die(mysql_error()); $ans = $classroom_result->fetch_assoc(); echo '
break; case "date": $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $query_timeslot = "SELECT * from timetable_info and subjects WHERE course_id ='" . $_POST['course'] . "' and branch_id='" . $_POST['branch'] . "' and section='" . $_POST['section'] . "' and semester='" . $_POST['semester'] . "' and session='" . $_POST['session'] . "' and subjects.id=timetable_info.subject_id"; $timeslot = $mysqli->query($query_timeslot) or die(mysql_error()); $totalRows_timeslot = $timeslot->num_rows; if ($totalRows_timeslot < 1) { drawNotification("Error", "There is no any timetable to edit for the given details", "error"); } else { // mapping slots and subject ids //listing subjects $lectures = array(); $faculty = array(); while ($row = $timeslot->fetch_assoc()) { $lectures[$row['slot_id']] = $row['subject_id']; $faculty[$row['slot_id']] = $row['emp_id']; } ?> <center> <form action="timetable_delete.php" method="post" enctype="multipart/form-data" name="time_table" id="time_table.php"> <input type="hidden" name="course" value="<?php
$sql = "insert into timetable_classrooms('building','room','capacity') Values('" . $_POST['buildingt'] . "','" . $i . "','" . $_POST['capacity'] . "')"; $sql_ans = $mysqli->query($sql); } drawNotification("Added", "The entered building (" . $_POST['buildingt'] . ") has been added successfully for rooms from 1 to " . $numofrooms, "success"); } else { if (isset($_POST['buildingd'])) { $max_room_query = "select MAX(room) as max,capacity from timetable_classrooms where building='" . $_POST['buildingd'] . "'"; $max_room_ans = $mysqli->query($max_room_query); $max_room = $max_room_ans - fetch_assoc(); $max = $max_room['max']; $capacity = $max_room['capacity']; for ($i = $max + 1; $i <= $max + $_POST['numberofrooms']; $i++) { $sql = "insert into timetable_classrooms('building','room','capacity') Values('" . $_POST['buildingd'] . "','" . $i . "','" . $_POST['capacity'] . "')"; $sql_ans = $mysqli->query($sql); } drawNotification("Added", "The entered building (" . $_POST['buildingd'] . ") has been added successfully for rooms from " . ($max + 1) . " to " . ($max + $_POST['numberofrooms']), "success"); } } ?> <form name="form" action="" method="post"> <table> <tr> <td> Select Building: </td> <td> <select name="buildingd" id="builing_dropdown"> <option value="">Select Builing</option> <?php while ($row_classroom = $classroom_ans->fetch_assoc()) {