File: /home/bibuzptr/elearning.bibu-edu.us/admin/honorary-doctorate-awards.php
<?php
ob_start();
session_start();
include_once('../includes/db_connect.php');
include_once("app/updateimage.php");
$today = date('Y-m-d');
$now = date('Y-m-d H:i:s');
$year = date("Y");
if(isset($_SESSION["OpenUni^###DHSG"])){
$email = $_SESSION["OpenUni^###DHSG"];
$chkuser = mysqli_query($con,"SELECT * FROM admins WHERE admin_email='$email'");
while($row = mysqli_fetch_assoc($chkuser)){
$id = $row["id"];
$name = $row["admin_name"];
}
}
else{
header("Location:../adminlogin.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<title>Honorary Doctorate Applications | Breakthrough Open University</title>
<link rel="shortcut icon" type="image/x-icon" href="../assets/img/logo.png">
<link rel="stylesheet" href="../assets/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/plugins/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="../assets/plugins/fontawesome/css/all.min.css">
<link rel="stylesheet" href="../assets/css/feather.css">
<link rel="stylesheet" href="../assets/css/style.css">
<link rel="stylesheet" href="../assets/css/dashboard2.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<style>
#hda{
background: #102044;
border-left: 6px solid #06bf1c;
color: #fff;
}
#stdmodal #login{
width: 90%;
margin: 10px;
display: block;
}
#stdmodal h2{
text-align: left;
}
#edtstudentmodal #login{
width: 90%;
margin: 10px;
display: block;
}
#edtstudentmodal h2{
text-align: left;
}
.menu{
background: #fff;
margin-top: -20px;
margin-bottom: 5px;
padding: 10px 0px 10px 20px;
border-bottom: 1px solid #ddd;
}
.menu .item{
background: #1e8c70;
font-size: 13px;
color: #fff;
padding: 5px 10px 5px 10px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="main-wrapper">
<?php include_once("../includes/header-students.php") ?>
<div class="page-content">
<div class="container1" style="margin-left:2%; margin-right:2%">
<div class="row">
<div class="col-xl-3 col-lg-3 col-md-12 theiaStickySidebar">
<?php include_once("includes/aside.php") ?>
</div>
<div class="col-xl-9 col-lg-9 col-md-12">
<div class="row">
<div class="col-md-12">
<div class="settings-widget">
<div class="settings-inner-blk p-0">
<div class="sell-student-head comman-space">
<div class="row">
<div class="col-md-6">
<h3>Applications </h3>
<p></p>
</div>
<div class="col-md-6">
<!--<div class="go-dashboard text-center">-->
<!-- <a class="btn btn-primary item item1" data-bs-toggle="modal" data-bs-target="#stdmodal">Add New Student</a>-->
<!--</div>-->
</div>
</div>
</div>
<div class="comman-space pb-0">
<div class="settings-tickets-blk student-instruct-blk table-responsive">
<table id="dataTable" class="table table-striped table-nowrap1 mb-21 table-responsive">
<thead>
<tr><th>Fullname</th><th>Phone</th><th>Email</th><th>Address</th><th>City</th><th>Country</th><th>Programme</th><th>CV</th><th>Recommendation Letter</th><th>Supporting Documents</th><th style="min-width: 100px;">Action</th></tr>
</thead>
<tbody>
<?php
$chkusers = mysqli_query($con,"SELECT * FROM professorship ORDER BY id DESC");
while($row = mysqli_fetch_assoc($chkusers)){ ?>
<tr>
<td><?php echo $row["prefix"]." ".$row["fullname"];?></td>
<td><?php echo $row["countrycode"]." ".$row["phone"];?></td>
<td><?php echo $row["email"];?></td>
<td><?php echo $row["address"];?></td>
<td><?php echo $row["city"];?></td>
<td><?php echo $row["country"];?></td>
<td><?php echo $row["programme"];?></td>
<td><a target="_blank" href="../honordocs/<?php echo $row["cv"];?>">CV</a></td>
<td><a target="_blank" href="../honordocs/<?php echo $row["recommendationletter"];?>">Recommendation Letter</a></td>
<td>
<?php
$num=0;
$otherimages=$row['otherdocs'];
$decodedimg=json_decode($otherimages);
$number_of_items_in_array=count($decodedimg);
for($img=0; $img<$number_of_items_in_array; $img++){
$decodedimg[$img];
$num++;
?>
<a target="_blank" href="../honordocs/<?php echo $decodedimg[$img] ?>">Document <?php echo $num ?></a><br>
<?php } ?>
</td>
<td>
<a style="display:none" data-toggle="tooltip" data-placement="bottom" title="Edit Applications"><button class="btn btn-xs btn-primary edtuser" data-id="<?php echo $row["id"];?>" data-fname="<?php echo $row["first_name"];?>" data-lname="<?php echo $row["last_name"];?>" data-phone="<?php echo $row["phone"];?>" data-email="<?php echo $row["email"];?>"><i class="fas fa-pencil-alt"></i></button></a>
<button style="display:none" class="btn btn-xs btn-danger deluser" id="<?php echo $row["id"];?>" data-toggle="tooltip" data-placement="bottom" title="Delete Doctor"><i class="fa fa-trash"></i></button>
</td>
</tr>
<?php }
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="stdmodal" class="stdmodal modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content" style="padding:15px">
<div class="modal-header">
<h4><i class="fa fa-list-alt"></i> <span id="addstudent">Add Student</span></h4>
</div>
<div class="add-student-form">
<form method="post" role="form" id="stdfrm" enctype="multipart/form-data">
<div class="add-student-inner-header">
</div>
<div class="input-block">
<label class="add-student-label">Student Adm No</label>
<input type="text" class="form-control" placeholder="" name="admno" id="admno">
</div>
<div class="input-block">
<label class="add-student-label">Student Name</label>
<input type="hidden" name="id" id="id">
<input type="text" class="form-control" placeholder="Student name" name="stdname" id="stdname" required>
</div>
<div class="input-block">
<label class="add-student-label">Student Phone</label>
<input type="text" class="form-control" placeholder="Student phone" name="stdphone" id="stdphone">
</div>
<div class="input-block">
<label class="add-student-label">Student Email</label>
<input type="email" class="form-control" placeholder="Student email" name="stdemail" id="stdemail">
</div>
<div style="display:none" class="input-block">
<label class="add-student-label">Student Join Date</label>
<input type="date" class="form-control" placeholder="" name="stdjoinyr" id="stdjoinyr">
</div>
<div style="display:none" class="input-block">
<label class="add-student-label">Student Complete Date</label>
<input type="date" class="form-control" placeholder="" name="stdcompleteyr" id="stdcompleteyr">
</div>
<div style="display:none" class="input-block">
<label class="add-student-label">Students Course</label>
<select class="form-control select" name="stdcourse" id="stdcourse">
<?php
$listcat=mysqli_query($con,"SELECT * FROM courses ORDER BY title ASC");
while($lc=mysqli_fetch_assoc($listcat)){
?>
<option value="<?php echo $lc['id'] ?>"><?php echo $lc['title'] ?></option>
<?php } ?>
</select>
</div>
<div class="input-block">
<label class="add-student-label">Students Campus</label>
<select class="form-control select" name="stdcampus" id="stdcampus">
<?php
$listcat=mysqli_query($con,"SELECT * FROM campuses ORDER BY campusname ASC");
while($lc=mysqli_fetch_assoc($listcat)){
?>
<option value="<?php echo $lc['id'] ?>"><?php echo $lc['campusname'] ?></option>
<?php } ?>
</select>
</div>
<button type="submit" class="btn btn-success btn-lg"><i class="fa fa-save"> </i>Save</button>
<p id="status11"></p>
</form>
</div>
</div>
</div>
</div>
<!-- upload product image -->
<div id="uploadimage" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"><i class="fa fa-plus"> </i>Update Image</h4>
</div>
<div class="col-md-12">
<form method="post" enctype="multipart/form-data">
<div class="modal-body">
<label>Main Image</label>
<input type="hidden" name="studentid" id="pproductid">
<input type="file" name="fileToUploadsch" id="fileToUploadsch" accept="image/*" required="required" placeholder="" class="form-control"><br>
<button class="btn btn-success" name="update_studentimage" type="submit"><i class="fa fa-upload"> </i>upload</button>
</div>
</form>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
<?php include_once("../includes/footer-student.php") ?>
<?php include_once("includes/buttons.php"); ?>
<script>
$(function(){
// $("#stdcourse").select2();
//delete student
$("#dataTable").on('click', '.delete', function(){
var stdid = $(this).attr("id");
var d = confirm('Are you sure you want to delete this student?');
if(d == false){
return false;
}
else{
$.ajax({
method:"post",
url:"app/students",
data:{stdid:stdid},
cache:false
}).done(function(data){
if(data.status == "200"){
alert("student deleted successfully");
window.location.replace("students");
}else{
alert("error deleting student");
}
});
}
});
});
</script>
<script>
//$('#dataTable').DataTable({"aaSorting" : []});
function dataTables(tb){
var table = $('#'+tb+'').DataTable({
lengthChange: false,
"aaSorting": [],
"buttons": [
{"extend": 'copy', "text":'<i class="fas fa-copy"></i> Copy',"className": 'btn btn-success btn-sm'},
{"extend": 'csv', "text":'<i class="fas fa-file-csv"></i> CSV',"className": 'btn btn-success btn-sm'},
{"extend": 'excel', "text":'<i class="fas fa-file-excel"></i> Excel',"className": 'btn btn-success btn-sm' },
{"extend": 'pdf', "text":'<i class="fas fa-file-pdf"></i> PDF',"className": 'btn btn-success btn-sm'},
{"extend": 'print', "text":'<i class="fas fa-print"></i> Print',"className": 'btn btn-success btn-sm'}
]
});
table.buttons().container().appendTo( '#'+tb+'_wrapper .col-md-6:eq(0)' );
}
dataTables("dataTable");
$("#stdfrm").submit(function(e){
e.preventDefault();
$("#status11").html("<p class=' bg-success'><i class='fa fa-spinner fa-pulse'></i> Saving the student...</p>");
$.ajax({
method: "POST",
url: "app/students",
data: new FormData(this),
contentType: false,
processData: false,
cache:false
}).done(function(data){
if(data.status == "200"){
$("#status11").html("<p class=' bg-success'><i class='fa fa-check'></i> student saved successfully.</p>");
window.location.replace("students");
}
if(data.message == "ERROR"){
$("#status11").html("<p class=' bg-danger'><i class='fa fa-exclamation-circle'></i> An error occured, please try again later.</p>");
}
});
});
//upload image
$('#dataTable').on('click', '.imagebutton', function(){
//$(".imagebutton").click(function () {
var studentid=$(this).attr("id");
$('#pproductid').val(studentid);
$('#uploadimage').modal('show');
});
//Activate a student
$(".activate").click(function(){
var studentid = $(this).attr("id");
var d = confirm('Are you sure you want to activate this student?');
if(d == false){
return false;
}
else{
$.ajax({
method:"post",
url:"app/activate-student",
data:{studentid:studentid},
cache:false
}).done(function(data){
if(data.status == "200"){
alert("student activated successfully");
window.location.replace("students");
}else{
alert("error activating student");
}
});
}
});
//DeActivate a student
$(".deactivate").click(function(){
var studentid2 = $(this).attr("id");
var d = confirm('Are you sure you want to deactivate this student?');
if(d == false){
return false;
}
else{
$.ajax({
method:"post",
url:"app/activate-student",
data:{studentid2:studentid2},
cache:false
}).done(function(data){
if(data.status == "200"){
alert("student deactivated successfully");
window.location.replace("students");
}else{
alert("error deactivating student");
}
});
}
});
//Delete a student
// $(".delstudent").click(function(){
$('#dataTable').on('click', '.delstudent', function(){
var studentid3 = $(this).attr("id");
var d = confirm('Are you sure you want to delete this student?');
if(d == false){
return false;
}
else{
$.ajax({
method:"post",
url:"app/activate-student",
data:{studentid3:studentid3},
cache:false
}).done(function(data){
if(data.status == "200"){
alert("student deleted successfully");
window.location.replace("students");
}else{
alert("error deleting student");
}
});
}
});
//edit student
// $(".edtstudent").click(function(){
$('#dataTable').on('click', '.edtstudent', function(){
$("#id").val($(this).attr("id"));
$("#stdname").val($(this).attr("data-name"));
$("#admno").val($(this).attr("data-admno"));
$("#stdemail").val($(this).attr("data-email"));
$("#stdphone").val($(this).attr("data-phone"));
$("#stdcourse").val($(this).attr("data-courseid"));
$("#stdjoinyr").val($(this).attr("data-joindate"));
$("#stdcompleteyr").val($(this).attr("data-completedate"));
$("#stdcampus").val($(this).attr("data-campus"));
$("#addstudent").html("Edit Student")
$('.stdmodal').modal('show');
});
</script>
</div>
</html>