File: /var/www/nclive/technc/central_exam.php
<?php
include 'header.php';
if (isset($_POST['submit'])) {
unset($_SESSION['central_category_id']);
$category = $_POST['nc_category'];
if ($category != '') {
$_SESSION['central_category_id'] = $category;
}
}
$sql = $db->prepare("SELECT cat_id, name FROM sp_exam_category");
$sql->execute();
?>
<style>
.total_ques_div {
background-color: white;
border-color: #C8D5E0;
border-image: none;
border-style: solid;
border-width: 1px 1px 2px;
color: #1E598E;
font-weight: bold;
padding: 8px 10px;
text-decoration: none;
}
.form-table td {
padding:0px !important;
}
.extLink{
text-decoration: none;
cursor: pointer;
}
.fancybox-skin
{ margin-left: 400px!important;
width: 500px!important;
}
.form-table td {
padding: 5px !important;
}
</style>
<script type="text/javascript" charset="utf8" src="assets/js/jquery-1.4.1.min.js"></script>
<script type="text/javascript" charset="utf8" src="assets/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="assets/css/jquery.dataTables.min.css">
<main id="main-container">
<div class="content content-narrow">
<div class="row">
<div class="col-lg-12">
<form class="form-inline" method="post">
<div class="form-group">
<select name="nc_category" class="form-control">
<option value="">--Select Category--</option>
<?php while($row=$sql->fetch(PDO::FETCH_ASSOC)) { ?>
<option value="<?php echo $row['cat_id']; ?>"><?php echo $row['name']; ?></option>
<?php } ?>
</select>
</div>
<input class="btn btn-info" type="submit" value="Select Category" name="submit" />
</form>
</div>
<div class="col-lg-12">
<h2 class="content-heading">Exam List</h2>
<div class="table-responsive">
<table id="exam_list" class="table table-striped table-bordered dt-responsive nowrap" style="width: 100%; cellspacing: 0;">
<thead>
<tr>
<th>S.no</th>
<th>Status</th>
<th>Edit </th>
<th>Exam name</th>
<th>Post name</th>
<th>Url Slug</th>
<th>Domain name</th>
<th>Category</th>
<th>State</th>
<th >Type</th>
</tr>
</thead>
</table>
<script type="text/javascript">
jQuery(function($) {
jQuery('#exam_list').dataTable({
"dom" : "Bfrtip",
"pagingType": "full_numbers",
"processing": true,
"serverSide": true,
"responsive": true,
"ajax": "/technc/central_exam_list_data.php",
"columns": [
{"data": "id",
render: function(data, type, row, meta) {
return meta.row + meta.settings._iDisplayStart + 1;
}
},
{"data": "status",
render: function(data, type, row, meta) {
if (row.status == '1') {
return '<span id="status">Active</span></a>';
} else if (row.status == '0') {
return '<span id="status">Deactive</span></a>';
}
},
},
{"data": "action",
render: function(data, type, row, meta) {
var ret = '';
ret += '<a href="edit.php?id='+row.exam_id+'"><button class="btn btn-info"> Edit </button> </a>';
return ret;
}
},
{"data": "exam_name"},
{"data": "post_name"},
{"data": "url_slug"},
{"data": "off_web_link"},
{"data": "name"},
{"data": "state_name"},
{"data": "type"}
],
"order": [
[0, 'desc']
],
"bPaginate": true,
"iDisplayLength": 50,
"bProcessing" : true,
"bServerSide" : true,
"lengthMenu": [
[50, 100, 200, 300, 1000],
[50, 100, 200, 300, "All"]
]
});
});
</script>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function update(id){
var txt;
var r = confirm("Do you want to change status ?");
if (r == true) {
var str = id;
var array = str.split(',');
var status = array[1];
$.ajax('status_active.php', {
type: 'POST', // http method
data: { id:id }, // data to submit
success: function (data, status, xhr) {
//console.log(data);
var update_id=data.st;
if(status!=update_id){
location.reload();
}
},
error: function (jqXhr, textStatus, errorMessage) {
}
});
}
}
</script>
<?php include 'footer.php'; ?>