File: /var/www/nclive/technc/testlink.php
<?php
//$page=basename(substr($_SERVER['PHP_SELF'],0,strrpos($_SERVER['PHP_SELF'],'.')));
include 'config.php';
$max=50;
//$min=$_REQUEST['pageN'];
$min=isset($_GET['page']) ? $_GET['page'] : 1;
$count = ($min - 1) * $max;
//$count= $min * $limit;
$count1="SELECT count(*) as total FROM sp_exam_links as el
left join sp_exam as e on e.exam_id=el.exam_id
left join sp_exam_entity as ee on ee.id=el.entity_id";
$sql2=$db->prepare($count1);
$sql2->execute();
$row2=$sql2->fetch();
$countresult=$row2['total'];
$div= ceil($countresult / $max);
$query="SELECT el.id,el.exam_id,el.display_text, el.description, el.links, el.date_type, el.date, el.status,e.exam_name,ee.name FROM sp_exam_links as el
left join sp_exam as e on e.exam_id=el.exam_id
left join sp_exam_entity as ee on ee.id=el.entity_id limit $count,$max";
$sql=$db->prepare($query);
$sql->execute();
?>
<!DOCTYPE html>
<!--[if IE 9]> <html class="ie9 no-focus" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-focus" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Naukri Connect - Dashboard</title>
<meta name="description" content="">
<meta name="author" content="pixelcave">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Icons -->
<!-- The following icons can be replaced with your own, they are used by desktop and mobile browsers -->
<link rel="shortcut icon" href="assets/img/favicons/favicon.png">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-160x160.png" sizes="160x160">
<link rel="icon" type="image/png" href="assets/img/favicons/favicon-192x192.png" sizes="192x192">
<link rel="apple-touch-icon" sizes="57x57" href="assets/img/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="assets/img/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/img/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="assets/img/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/img/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="assets/img/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="assets/img/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="assets/img/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/img/favicons/apple-touch-icon-180x180.png">
<!-- END Icons -->
<!-- Stylesheets -->
<!-- Web fonts -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400italic,600,700%7COpen+Sans:300,400,400italic,600,700">
<!-- Page JS Plugins CSS -->
<link rel="stylesheet" href="assets/js/plugins/slick/slick.min.css">
<link rel="stylesheet" href="assets/js/plugins/slick/slick-theme.min.css">
<!-- Bootstrap and OneUI CSS framework -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" id="css-main" href="assets/css/oneui.css">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/flick/jquery-ui.css">
<script src="ckeditor/ckeditor.js" type="text/javascript"></script>
<style>
.text-capitalize{
text-transform:none;
}
#statusModel .modal-content
{
height:500px;
width:900px;
overflow:auto;
}
</style>
<!-- You can include a specific file from css/themes/ folder to alter the default color theme of the template. eg: -->
<!-- <link rel="stylesheet" id="css-theme" href="assets/css/themes/flat.min.css"> -->
<!-- END Stylesheets -->
</head>
<body>
<!-- Page Container -->
<!--
Available Classes:
'enable-cookies' Remembers active color theme between pages (when set through color theme list)
'sidebar-l' Left Sidebar and right Side Overlay
'sidebar-r' Right Sidebar and left Side Overlay
'sidebar-mini' Mini hoverable Sidebar (> 991px)
'sidebar-o' Visible Sidebar by default (> 991px)
'sidebar-o-xs' Visible Sidebar by default (< 992px)
'side-overlay-hover' Hoverable Side Overlay (> 991px)
'side-overlay-o' Visible Side Overlay by default (> 991px)
'side-scroll' Enables custom scrolling on Sidebar and Side Overlay instead of native scrolling (> 991px)
'header-navbar-fixed' Enables fixed header
-->
<div id="page-container" class="sidebar-l sidebar-o side-scroll header-navbar-fixed">
<!-- Header -->
<header id="header-navbar" class="content-mini content-mini-full">
<!-- Header Navigation Left -->
<ul class="nav-header pull-left">
<li class="hidden-md hidden-lg">
<!-- Layout API, functionality initialized in App() -> uiLayoutApi() -->
<button class="btn btn-default" data-toggle="layout" data-action="sidebar_toggle" type="button">
<i class="fa fa-navicon"></i>
</button>
</li>
<li class="hidden-xs hidden-sm">
<!-- Layout API, functionality initialized in App() -> uiLayoutApi() -->
<button class="btn btn-default" data-toggle="layout" data-action="sidebar_mini_toggle" type="button">
<i class="fa fa-ellipsis-v"></i>
</button>
</li>
<li>
<!-- Opens the Apps modal found at the bottom of the page, before including JS code -->
<button class="btn btn-default pull-right" data-toggle="modal" data-target="#apps-modal" type="button">
<i class="si si-grid"></i>
</button>
</li>
<li class="visible-xs">
<!-- Toggle class helper (for .js-header-search below), functionality initialized in App() -> uiToggleClass() -->
<button class="btn btn-default" data-toggle="class-toggle" data-target=".js-header-search" data-class="header-search-xs-visible" type="button">
<i class="fa fa-search"></i>
</button>
</li>
<li class="js-header-search header-search">
<form class="form-horizontal" method="post">
<div class="form-material form-material-primary input-group remove-margin-t remove-margin-b">
<input class="form-control" type="text" id="base-material-text" name="base-material-text" placeholder="Search..">
<span class="input-group-addon"><i class="si si-magnifier"></i></span>
</div>
</form>
</li>
</ul>
<!-- END Header Navigation Left -->
</header>
<!-- END Header -->
<!-- Main Container -->
<main id="main-container">
<div class="content content-narrow">
<!-- Forms Row -->
<div class="row">
<div class="col-lg-12">
<!-- Bootstrap Forms Validation -->
<h2 class="content-heading">Exam Cutoff List</h2>
<div class="table-responsive">
<table class="table table-striped table-hover text-capitalize table-condensed">
<thead>
<tr class="danger">
<th class="text-center">S.no</th>
<th class="text-center">Exam Name</th>
<th class="text-center">Entity</th>
<th class="text-center">Display Text</th>
<th class="text-center">Description</th>
<th class="text-center">Links</th>
<th class="text-center">Date Type</th>
<th class="text-center">Date</th>
<th class="text-center">Status</th>
<th class="text-center">Action</th>
</tr>
</thead>
<?php $number=1;
$a = ($min - 1) * 50 + $number;
while($row=$sql->fetch()){
if($row['status'] == '1'){
$status = "<font style='color:green'>Active</font>";
}
else {
$status ="<font style='color:red'>Deactive</font>";
}
?>
<tr>
<td class="text-center"><?php echo $a; ?></td>
<td class="text-center"><?php echo $row['exam_name']; ?></td>
<td class="text-center"><?php echo $row['name']; ?></td>
<td class="text-center"><?php echo $row['display_text']; ?></td>
<td class="text-center"><?php echo $row['description']; ?></td>
<td class="text-center"><a target="_blank" href="<?php echo $row['links']; ?>"><?php echo $row['links']; ?></a></td>
<td class="text-center"><?php echo $row['date_type']; ?></td>
<td class="text-center"><?php echo $row['date']; ?></td>
<td class="text-center"><?php echo $status; ?></td>
<td class="text-center"><button name="update" class="btn btn-info" onClick="selectData(<?php echo $row['id']; ?>)" data-toggle="tooltip" title="Edit this exam">Edit</button></td>
</tr>
<?php $a++; } ?>
<tr class="danger">
<th colspan='6'>Total Exams<?php //echo pagination($limit, $pageNo, $ ."&pageN=", $count);?></th>
<td colspan='3'><?php echo $plus['total']; ?></td>
</tr>
</table>
</div>
<!-- Bootstrap Forms Validation -->
</div>
<center>
<ul class="pagination">
<?php
$nextpage=$min+1;
$prevpage=$min-1;
if($prevpage!=0){
?>
<li class="page-item"><a class="page-link" id="prev" href="/testlink.php?page=<?php echo 1; ?>">First</a></li>
<li class="page-item"><a class="page-link" id="prev" href="/testlink.php?page=<?php echo $prevpage; ?>">Previous</a></li>
<?php }
for($d=1;$d<=$div;$d++){ ?>
<li class="page-item "><a class="page-link" href="/testlink.php?page=<?php echo $d; ?>"><?php echo $d; ?></a></li>
<?php }
if($nextpage<=$div){
?>
<li class="page-item"><a class="page-link" id="next" href="/testlink.php?page=<?php echo $nextpage; ?>">Next</a></li>
<li class="page-item"><a class="page-link" id="next" href="/testlink.php?page=<?php echo $div; ?>">Last</a></li>
<?php } ?>
</ul></center>
</div>
</div>
<!-- END Forms Row -->
</div>
<!-------STATUS MODEL------------------------------->
<div class=" modal fade" id="statusModel" 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">Do you want to change Exams Links Details ? </h4>
</div>
<div class="modal-body">
<?php
$curDate = date('Y-m-d H:i:s');
if(isset($_REQUEST['submit'])){
$id=$_REQUEST['id'];
$name= $_REQUEST['examname'];
$entity= $_REQUEST['entity'];
$dis= $_REQUEST['dis_text'];
$desc= $_REQUEST['editor'];
$link= $_REQUEST['link'];
$type=$_REQUEST['search_type'];
if($type=='N'){
$date=$_REQUEST['normal'];
}
else if($type=='FT'){
$date=$_REQUEST['fromdate'] .',' . $_REQUEST['todate'];
}
$query1="UPDATE sp_exam_links SET exam_id='$name',entity_id='$entity',display_text='$dis',description='$desc',links='$link',date_type='$type',date='$date',update_by='$user_id',update_date='curDate' WHERE id='$id'";
$sql1 = $db->prepare($query1);
if($sql1->execute()){
echo '<h3 style="color:green;">Data Update successfully</h3>';
echo "<meta http-equiv='refresh' content='0'>";
}
else{echo "Something Wrong!";}
}
?>
<form class="js-validation-bootstrap form-horizontal" action="" method="post" id="form">
<div class="form-group">
<label class="col-md-2 control-label" for="val-select2">Select Exam</label>
<div class="col-md-10">
<input type="hidden" name="id" id="id">
<select class="js-select2 form-control" name="examname" style="width: 100%;">
<?php
$sql = $db->prepare("SELECT exam_id,exam_name FROM sp_exam");
$sql->execute();
?><option selected="selected" id="examname">--Select exam--</option><?php
while($row=$sql->fetch(PDO::FETCH_ASSOC))
{
?>
<option value="<?php echo $row['exam_id']; ?>"><?php echo $row['exam_name']; ?></option>
<?php
} ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-select2">Select Exam Entity</label>
<div class="col-md-10">
<select class="js-select2 form-control" name="entity" style="width: 100%;">
<?php
$sql = $db->prepare("SELECT id,name FROM sp_exam_entity");
$sql->execute();
?><option selected="selected" id="entity">--Select exam--</option><?php
while($row=$sql->fetch(PDO::FETCH_ASSOC))
{
?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></option>
<?php
} ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-username">Display Text<span class="text-danger">*</span></label>
<div class="col-md-10">
<input class="form-control" type="text" name="dis_text" placeholder="" id="dis_text">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-email">Description<span class="text-danger">*</span></label>
<div class="col-md-10">
<textarea class="ckeditor" name="editor" id="editor"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-password">Links<span class="text-danger">*</span></label>
<div class="col-md-10">
<input class="form-control" type="text" name="link" id="link" placeholder="">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-password">On Date<span class="text-danger">*</span></label>
<div class="col-md-1">
<input type="radio" name="search_type" class="radio" value="N" id="N" />
</div>
<div class="col-md-5" id="normal" style="display:none;">
<input type="text" placeholder="Select Dates" class="dates_opted dates_opted_1 width_100" name="normal" id="nor" style="width:400px">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="val-password">From & To Date<span class="text-danger">*</span></label>
<div class="col-md-1" >
<input type="radio" name="search_type" value="FT" class="radio" id="FT" />
</div>
<div class="col-md-5" id="fromto" style="display:none;">
<input class="form-control" type="date" name="fromdate" placeholder="" id="fromdate">
<input class="form-control" type="date" name="todate" placeholder="" id="todate">
</div>
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2">
<button class="btn btn-lg btn-primary" type="submit" name="submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!---------END STATUS MODEL----->
<!-- END Page Content -->
</main>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('.radio').on('change', function() {
if (this.value == 'N') {
$("#normal").css('display','block');
$("#fromto").css('display','none');
}
else if (this.value == 'FT') {
$("#fromto").css('display','block');
$("#normal").css('display','none');
}
});
});
</script>
<script type="text/javascript">
function selectData(id) {
var base_url = window.location.origin;
//alert(id);
$.ajax('exam_links_list_select.php', {
type: 'POST', // http method
data: { id:id }, // data to submit
success: function (data, status, xhr) {
console.log(data);
document.getElementById('id').value= data.id;
document.getElementById('examname').value = data.exam_id;
document.getElementById('examname').innerHTML = data.exam_name;
document.getElementById('entity').value = data.entity_id;
document.getElementById('entity').innerHTML = data.name;
document.getElementById('dis_text').value = data.display_text;
document.getElementById('editor').value = data.description;
document.getElementById('link').value = data.links;
var c='';
var date=data.date;
if(data.date_type == 'N'){
document.getElementById('nor').value = date;
document.getElementById('fromdate').value = c;
document.getElementById('todate').value = c;
}
else if(data.date_type == 'FT'){
var date=data.date;
var d = date.split(",");
var myd= d[0] + ',' + d[1];
document.getElementById('fromdate').value = d[0];
document.getElementById('todate').value = d[1];
document.getElementById('nor').value = c;
}},
error: function (jqXhr, textStatus, errorMessage) {
}
});
jQuery("#statusModel").modal();
// body...
}
</script>
<script>
function cleanArray(actual) {
var newArray = new Array();
for (var i = 0; i < actual.length; i++) {
if (actual[i]) {
newArray.push(actual[i]);
}
}
return newArray;
}
jQuery(document).ready(function($) {
$('.dates_opted').each(function(index){
var dates=[];
$(this).datepicker({
dateFormat: "yy-mm-dd",
onSelect: function(){
dates=cleanArray(dates);
dates.push($(this).val());
//console.log(dates);
$(this).val(dates);
},showAnim :'clip',
changeYear:true,
changeMonth:true,
yearRange:"2000:2030"
}).keyup(function(e) {
if(e.keyCode == 8 || e.keyCode == 46) {
var datesString=$(this).val().split(",");
dates=[];
for(var i=0 ; i<datesString.length-1;i++){
dates.push(datesString[i]);
}
$(this).blur();
$(this).val(dates);
}
});
});
});
</script>
<?php include 'footer.php'; ?>
<!-- END Main Container -->