/home3/vehiclea/public_html/admin-appleiitfoundationschools-com/exam_report.php
<?php
session_start();
$_SESSION['active'] = 'emReport';
include('include/header.php');
$select_academic=select_academic();
$select_class=select_class();
$select_SyllabusData = select_SyllabusData();
$select_SubjectData = select_SubjectData();
?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<main id="main" class="main">
<div class="pagetitle">
<h1>Apple IIT Schools</h1>
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item">Exam Time Table</li>
</ol>
</nav>
</div>
<section class="section">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h5 class="card-title">Add Exam Time Table</h5>
<div id="fail">
<?php
if(!empty($_POST['submit']))
{
$insert_exam_type = executeworkins("INSERT INTO exam_class (year,class,create_date,exam_type) values ('".$_POST['Year']."','".$_POST['class_name']."','".date('Y-m-d H:i:s')."','".strtoupper($_POST['exam_type'])."')");
$class_id = $insert_exam_type;
$number = count($_POST['Subjects']);
for($i=0; $i<$number; $i++)
{
$year = $_POST['Year'];
$class = $_POST['class_name'];
$exam_type = $_POST['exam_type'];
$subject_name = $_POST['Subjects'][$i];
$exam_date = $_POST['exam_date'][$i];
$exam_time = $_POST['exam_time'][$i];
$insert_exam_type1 = executework("INSERT INTO exam_time_table (class,year,subject,exam_type,create_date,exam_date,exam_time) values ('".$class."','".$year."','".$subject_name."','".$exam_type."','".date('Y-m-d H:i:s')."','".$exam_date."','".$exam_time."')");
}
if($insert_exam_type1)
{
redirect('exam_report.php?succ=1');
}
}
if(!empty($_GET['failed'])){
?>
<div align="center"><h4 style="color:red;">Already Exam Data Inserted </h4></div>
<?php
}
?>
</div>
<div id="update">
<?php
if(!empty($_GET['upd'])){
?>
<div align="center"><h4 style="color:green;">Exam Data Updated Successfully </h4></div>
<?php
}
?>
</div>
<div id="succ">
<?php
if(!empty($_GET['succ'])){
?>
<div align="center"><h4 style="color:green;">Exam Data Inserted Sucessfully </h4></div>
<?php
}
?>
</div>
<div id="delete_data" style="display: none;">
<h4 style="color:red; text-align: center; ">Exam Data Deleted Successfully</h4>
</div>
<form method="post" onsubmit="return book_validation()">
<div class="row">
<div class="col-md-3 mt-4">
<label for="exampleInputEmail1" class="form-label">Academic Year</label>
<select name="Year" id="Year" class="form-control" onChange="select_subjectData(); select_exam()">
<option value="">Please Select Year</option>
<?php
$select_academic = select_academic();
while($academic = mysqli_fetch_array($select_academic)){
?>
<option value="<?= $academic['yearOf']?>"><?= $academic['yearOf']?></option>
<?php
}
?>
</select>
<input type="hidden" name="ayear" id="academic_year">
</div>
<div class="col-md-3 mt-4">
<label for="exampleInputEmail1" class="form-label">Class</label>
<select name="class_name" id="class_name" class="form-control" onChange="select_subjectData(); select_exam()">
<option value="">Please Select Class</option>
<?php
while($class = mysqli_fetch_array($select_class)){
?>
<option value="<?= $class['name']?>"><?= $class['name']?></option>
<?php
}
?>
</select>
</div>
<div class="col-md-3 mt-4">
<label for="exampleInputEmail1" class="form-label">Exam type</label>
<select id="exam_type" name="exam_type" class="form-control">
<option value="">Select Exam Type</option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-3 mt-4">
<label for="exampleInputEmail1" class="form-label">Subjects</label>
<select id="Subjects" name="Subjects[]" class="form-control">
<option value="">Select Subjects</option>
</select>
</div>
<input type="hidden" name="create_date[]" value="<?= date('Y-m-d H:i:s')?>">
<div class="col-md-3 mt-4">
<label for="exampleInputEmail1" class="form-label">Exam Date</label>
<input type="text" name="exam_date[]" class="form-control" id="datepicker" placeholder="Choose Exam Date" readonly>
</div>
<div class="col-md-3 mt-4">
<label for="exampleInputEmail1" class="form-label">Exam Time</label>
<input type="time" name="exam_time[]" class="form-control" id="exam_time" placeholder="Choose Exam Time">
</div>
<div class="col-md-3 mt-4">
<button class="btn btn-success" type="button" name="addnew" style="background-color: #69F0AE; color: #000000;" id="addRowbutton"><i class="fa fa-plus-circle"></i></button>
</div>
</div>
<div id="row_list"></div>
<div class="mt-4">
<input type="submit" class="btn" value="Add" name="submit" style="background-color: #69F0AE; color: #000000;">
</div>
</form>
<h5 class="card-title">Reports</h5>
<div class="col-md-12">
<table class="table">
<thead style="background-color:#7E57C2; color: #ffff;">
<tr>
<th>#</th>
<th>Academic Year</th>
<th>Class Name</th>
<th>Exam Type</th>
<?php
if($_SESSION['user']=='admin'){
?>
<th>Action</th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
$select_exam_table = executework("SELECT * FROM exam_class");
$i=1;
while($exam_table = mysqli_fetch_array($select_exam_table)){
?>
<tr>
<td><?= $i?></td>
<td><?= $exam_table['year']?></td>
<td><?= $exam_table['class']?></td>
<td><?= $exam_table['exam_type']?></td>
<?php
if($_SESSION['user']=='admin'){
?>
<td>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false" style="background-color:#69F0AE;">
Action
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<li><a class="dropdown-item text-center" href="exam_table_edit.php?edit=<?= $exam_table['id']?>">EDIT</a></li>
<li><a class="dropdown-item text-center" href="exam_table_view.php?view=<?= $exam_table['id']?>">View</a></li>
<li><a class="dropdown-item text-center" href="javascript:void();" onclick="confirmDelete(<?php echo $exam_table['id']?>)">DELETE</a></li>
</ul>
</div>
</td>
<?php
}
?>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
</main><!-- End #main -->
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script>
function book_validation()
{
var Year = $('#Year').val();
var classname = $('#class_name').val();
var subjects = $('#Subjects').val();
var exam_type = $('#exam_type').val();
var exam_date = $('#datepicker').val();
var exam_time = $('#exam_time').val();
if(Year == '')
{
swal('Please Select Academic Year');
return false;
}
else if(classname == '')
{
swal('Please Select Class');
return false;
}
else if(subjects == '')
{
swal('Please Select Subjects');
return false;
}
else if(exam_type == '')
{
swal('Please Select Exam Type');
return false;
}
else if(exam_date == '')
{
swal('Please Select Exam Date');
return false;
}
else if(exam_time == '')
{
swal('Please Select Exam Time');
return false;
}
else{
return true;
}
}
</script>
<script>
function confirmDelete(time_tableid)
{
if (time_tableid != '') {
var x = confirm('Are you sure to Delete?');
if(x){
$.ajax({
url : "delete.php",
data : {time_tableid : time_tableid},
type : 'POST',
success : function(response) {
if(response ==1){
$('#succ').hide();
$('#update').hide();
$('#fail').hide();
$('#delete_data').show();
window.location.href = "exam_report.php";
}
}
});
}
}
}
</script>
<script>
function select_subjectData()
{
var academic_year = $('#Year').val();
var class_name = $('#class_name').val();
if(academic_year !='' && class_name !='')
{
$.ajax({
url : "subjectsData.php",
data : {type:4,academic_year:academic_year,class_name : class_name},
type : 'POST',
success : function(response) {
$('#academic_year').val(academic_year);
$('#Subjects').html(response);
}
});
}
}
function select_exam()
{
var academic_year = $('#Year').val();
var class_name = $('#class_name').val();
if(academic_year !='' && class_name !='')
{
$.ajax({
url : "subjectsData.php",
data : {type:5,academic_year:academic_year,class_name : class_name},
type : 'POST',
success : function(response) {
$('#exam_type').html(response);
}
});
}
}
</script>
<script>
$(document).ready(function() {
var Year1 = $('#Year').val();
var i=0;
$("#addRowbutton").on("click", function() {
var academic_year = $('#Year').val();
var class_name = $('#class_name').val();
if(academic_year !='' && class_name !='')
{
$.ajax({
url : "subjectsData.php",
data : {type:4,academic_year:academic_year,class_name : class_name},
type : 'POST',
success : function(response) {
$('#Subjects'+i).html(response);
}
});
}
i++;
$('#row_list').append('<div id="row'+i+'"><div class="row"><div class="col-md-3 mt-4"><select id="Subjects'+i+'" name="Subjects[]" class="form-control"><option value="">Select Subjects</option> </select></div><div class="col-md-3 mt-4"><input type="text" name="exam_date[]" readonly id="datepicker1'+i+'" class="form-control" placeholder="Select Date"></div><div class="col-md-3 mt-4"><input type="time" name="exam_time[]" id="exam_time'+i+'" class="form-control" placeholder="Select Time"></div><div class="col-md-3 mt-4"><button type="button" name="remove" id="'+i+'" style="background-color: red; color: #000000;" class="btn btn-danger btn_remove">X</button></div></div></div>');
$( function() {
$("#datepicker1"+i).datepicker({
dateFormat: "yy-mm-dd",
type: 'datetime',
onClick: function() {
table.draw();
},
changeMonth: true,
changeYear: true
})
});
});
$(document).on('click', '.btn_remove', function(){
var button_id = $(this).attr("id");
$('#row'+button_id+'').remove();
});
});
</script>
<?php include('include/footer.php'); ?>
@LwBee Strong Bypass
Upload File
Create New File