File: /var/www/nclive/wp-content/plugins/nc_plugin/nc_online_application.php
<?php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url_slug = basename($actual_link);
global $wpdb;
$TT_EXAM = "sp_exam";
$TT_EXAM_LINKS = "sp_exam_links";
$TT_EXAM_CATEGORY = "sp_exam_category";
$TT_EXAM_ENTITY = "sp_exam_entity";
$NC_AD = "ads_nc_pages";
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
$entity_id = 8; // entity_id for exam - online-application
$limit = 6; // limit to show exam data
// query to get data as per entity id
$examDetails = $wpdb->get_results("select l.id, l.exam_id, n.name, l.entity_id, l.display_text, l.date_type, e.url_slug, l.date, l.update_date, e.exam_name, e.total_vacancy, e.fee, c.img_icon FROM $TT_EXAM_LINKS as l LEFT JOIN $TT_EXAM as e on e.exam_id=l.exam_id LEFT JOIN $TT_EXAM_CATEGORY as c ON c.cat_id=e.cat_id LEFT JOIN $TT_EXAM_ENTITY as n ON n.id=l.entity_id WHERE l.status!='0' and e.status!='0' and n.status!='0' and l.entity_id='$entity_id' order by l.update_date desc limit 0, $limit");
$examDetailCount = $wpdb->num_rows;
$getAd = $wpdb->get_row("select id, ad_image, link from $NC_AD where find_in_set('online-application', page_exam_name) <> 0 and status='1' and type='page'");
?>
<style>
.mark,
mark {
padding: 0px !important;
background-color: #ff0;
}
.SeeMoreBtn {
background-color: whitesmoke;
padding: 20px 10px !important;
text-align: center;
box-shadow: 0 0 8px 0px #949494;
}
</style>
<!-- ALL PAGE HEADER SECTION -->
<section class="allPageheaderSection wow fadeInDown">
<div class="allPageheaderSectionbg"></div>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<h2>Online Application</h2>
<h1>Explore the latest government exam online applications for various job recruitments. Find essential details, including important dates, links, and apply online seamlessly.</h1>
<p><a href="/">Home</a> / Online Application</p>
</div>
</div>
</div>
</section>
<!-- END ALL PAGE HEADER SECTION -->
<!-- google ads section -->
<?php if ($getAd->id != '') { ?>
<section class="ad_horizontal">
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 text-center">
<a href="<?php echo $getAd->link; ?>" target="_blank" onclick="trackAdClick('<?php echo $getAd->id; ?>', 'online-application', '<?php echo addslashes($getAd->link); ?>');">
<img src="/all_uploads/adImage/<?php echo $getAd->ad_image; ?>" alt="">
</a>
</div>
</div>
</div>
</section>
<?php } ?>
<!-- google ads section -->
<!-- NOTIFICATION PAGE SECTION -->
<section class="NotificationPageSection OnlineApplicationPageSection">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="NotificationLeftBox wow fadeInLeft">
<div class="d-flex" style="justify-content: space-between;">
<h4>Search Online Applications</h4>
<button class="accrd btn btn-default d-md-none mb-2" type="button" data-bs-toggle="collapse" data-bs-target="#mobileSidebar" aria-controls="mobileSidebar" aria-expanded="false" aria-label="Toggle navigation">
☰
</button>
</div>
<form action="">
<i class="fas fa-search"></i>
<input type="text" id="search_data" placeholder="Exam name, Title or etc...">
</form>
<hr>
<div class="collapse d-md-block" id="mobileSidebar">
<h4>Date Posted</h4>
<ul>
<li><input type="radio" name="get_data" value="all" id="all" checked><label for="all">All</label></li>
<li><input type="radio" name="get_data" value="lasthour" id="lasthour"><label for="lasthour">Today's Update</label></li>
<li><input type="radio" name="get_data" value="lastweek" id="lastweek"><label for="lastweek">Last 7 Days</label></li>
<li><input type="radio" name="get_data" value="lastmonth" id="lastmonth"><label for="lastmonth">Last 30 Days</label></li>
</ul>
</div>
</div>
<!-- Display-Square-Left-Sidebar -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-2967295438144070"
data-ad-slot="1454810216"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<div class="col-md-8 col-sm-8 col-xs-12">
<div class="NotificationRightBox">
<div class="NotificationRightBoxHeader wow fadeInDown">
<h4>Show <b><span id="countData"><?php echo $examDetailCount; ?> </span> </b>Notification</h4> <a onclick="clearAll();" style="cursor:pointer;">Clear all</a>
</div>
<div id="loader" style="display:none">
<p align="center"><i class="fa fa-spinner fa-spin"></i> Loading...</p>
</div>
<?php if ($examDetailCount > 0) { ?>
<div id="examList" class="examList">
<?php foreach ($examDetails as $exam) {
if ($exam->display_text != '') {
$display_text = $exam->display_text;
} else {
$display_text = $exam->name;
}
if ($exam->date_type == 'FT') {
$split_date = preg_split('/,+/', $exam->date);
$date1 = $split_date[0];
$startDate = date('j M Y', strtotime($date1));
$date2 = $split_date[1];
$endDate = date('j M Y', strtotime($date2));
$datetype = ' From ' . $startDate . ' To ' . $endDate;
} else if ($exam->date_type == 'T') {
$datetype = $exam->date;
} else if ($exam->date_type == 'N') {
$datetype = date('jS M Y', strtotime($exam->date));
}
?>
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="NotificationExamBox wow fadeInUp">
<div class="NotificationExamFlexBox">
<?php if ($exam->img_icon != '') { ?>
<img height="33" width="33" src="/images/<?php echo $exam->img_icon; ?>" alt="<?php echo $exam->exam_name; ?>">
<?php } ?>
<div class="NotificationExamBoxDetails">
<a href="/exams/<?php echo $exam->url_slug; ?>/" aria-label="Exam Name"><?php echo $exam->exam_name; ?></a>
<p style="display: block;">
<span style="margin-bottom: 6px;color: #135fb1;" title="<?php echo $exam->name; ?>"> <i class="fas fa-id-card"></i> <?php echo $display_text; ?></span>
<?php if ($datetype != '') { ?>
<span title="<?php echo $exam->name; ?>" style="color: #ed2551;"><i class="fas fa-calendar-alt"></i> <?php echo $datetype; ?> </span>
<?php } ?>
</p>
</div>
</div>
<i class="far fa-bookmark"></i>
<i class="fas fa-bookmark" style="display: none;color: #f1c512;"></i>
</div>
</div>
<?php } ?>
</div>
<div class="loadmore">
<input type="button" id="loadBtn" class="SelectStateBtn" style="display:flex; margin: 0 auto;" value="See More">
<input type="hidden" id="data_row" value="0">
<input type="hidden" id="data_row1" value="">
</div>
<a id="showBlankData" style="display:none;" href="/online-application/" class="SeeMoreBtn wow fadeInUp"></a>
<?php } else { ?>
<div class="SeeMoreBtn wow fadeInUp" id="showBlankData">
<a href="/admit-card/">No information available : Click here to load all Admit-Card</a>
</div>
<?php } ?>
</div>
<!-- Display-Horizontal-Full -->
<ins class="adsbygoogle my-float"
style="display:block"
data-ad-client="ca-pub-2967295438144070"
data-ad-slot="7766773989"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
// function to highlight text
function hightlightTxt(search_name) {
var searchfilter = new RegExp(search_name + "(?=[^>]*<)", "ig");
var repstr = "<mark>$&</mark>";
$('.examList').html($('.examList').html().replace(searchfilter, repstr));
}
$(document).ready(function() {
// load more button
$(document).on('click', '#loadBtn', function() {
var data_row = Number($('#data_row').val());
var row_count = $('#countData').text();
var filter = $("input[name='get_data']:checked").val();
var limit = <?php echo $limit; ?>;
var entity = '<?php echo $entity_id; ?>';
data_row = data_row + limit;
$('#data_row').val(data_row);
var url = '/wp-content/plugins/nc_plugin/api/nc_notification_data.php';
$.ajax({
url: url,
type: 'POST',
data: {
'data_row': data_row,
"id": entity,
"filter": filter,
'limit': limit
},
beforeSend: function() {
$('#loader').show();
},
success: function(data) {
var rowCount = data_row + limit;
$('.examList').append(data);
$('#countData').html(rowCount);
$('#loader').hide();
var pagenum = $('input[name="page_count"]').val();
var totalnum = $('input[name="data_row_count"]').val();
if (parseInt(totalnum) > parseInt(rowCount)) {
$(".loadmore").show();
$('#loadBtn').css("display", "block");
} else {
$('#loadBtn').css("display", "none");
$(".loadmore").hide();
}
}
});
});
// search data using search field
$('#search_data').keyup(function() {
var trim_str = $(this).val();
var search_name = $.trim(trim_str);
var searchfilter = new RegExp(search_name + "(?=[^>]*<)", "ig");
var repstr = "<mark>$&</mark>";
$('.examList').html($('.examList').html().replace(/(^\s+|\s+$)/g, ""));
if (search_name != '') {
hightlightTxt(search_name);
if (search_name.length >= 2) {
searchExam(search_name);
}
} else {
location.reload(true);
}
});
// search function
function searchExam(search_name) {
var entity = '<?php echo $entity_id; ?>';
var filter = $("input[name='get_data']:checked").val();
var url = '/wp-content/plugins/nc_plugin/api/nc_notification_data.php';
$.ajax({
url: url,
type: 'POST',
data: {
"id": entity,
"exam_name": search_name,
"filter": filter
// "limit": limit
},
beforeSend: function() {
$('#loader').show();
},
success: function(response) {
if (response != '') {
$('#examList').html(response);
$('#loader').hide();
var pagenum = $('input[name="page_count"]').val();
$('#countData').text(pagenum);
hightlightTxt(search_name); // function for highlighting data
$('#loadBtn').css("display", "none");
}
}
});
}
// show exam-data as per radio button
$('input[type=radio][name=get_data]').change(function() {
var entity = '<?php echo $entity_id; ?>';
var limit = '<?php echo $limit; ?>';
if (this.value == 'lastmonth') {
var filter = 'lastmonth';
$("#lastmonth").prop("checked", true);
showExam(filter);
} else if (this.value == 'lasthour') {
var filter = 'lasthour';
$("#lasthour").prop("checked", true);
showExam(filter);
} else if (this.value == 'lastweek') {
var filter = 'lastweek';
$("#lastweek").prop("checked", true);
showExam(filter);
} else if (this.value == 'all') {
var filter = 'all';
$("#all").prop("checked", true);
showExam(filter);
}
});
//function to get exam-data as per input radio button
function showExam(filter) {
$('#search_data').val('');
var entity = '<?php echo $entity_id; ?>';
var limit = <?php echo $limit; ?>;
if (entity != '' && entity != 0) {
var url = '/wp-content/plugins/nc_plugin/api/nc_notification_data.php';
$.ajax({
url: url,
type: 'POST',
data: {
"id": entity,
"filter": filter,
"limit": limit
},
beforeSend: function() {
$('#loader').show();
},
success: function(response) {
$('#examList').html(response);
$('#loader').hide();
var pagenum = $('input[name="page_count"]').val();
var totalnum = $('input[name="data_row_count"]').val();
$('#countData').text(pagenum);
$('#data_row1').val(totalnum);
if (parseInt(totalnum) > parseInt(pagenum)) {
$(".loadmore").show();
$('#loadBtn').css("display", "block");
$('#showBlankData').css("display", "none");
$('#showBlankData').html('')
} else {
$('#loadBtn').css("display", "none");
$(".loadmore").hide();
$('#showBlankData').css("display", "block");
$('#showBlankData').html('No information available: Click here to load all Online-Application');
}
}
});
}
}
});
// CLEAR ALL DATA FILter
function clearAll() {
location.reload(true);
}
</script>
<!-- END NOTIFICATION PAGE SECTION -->