File size: 4.49Kb
<?php
include "../../lib/functions_class.php";
include "../../lib/pagination.php";
$blog_page = $DB->blogpage_name(); //Get the blog Page name
$orderby = $_POST['orderby'];
$searchkey = $_POST['searchkey'];
$datefrom = $_POST['datefrom'];
$dateto = $_POST['dateto'];
/*Pagination Property*/
$adjacents = 2;
$targetpage = "pages_tbl.php";
$limit = $_POST['rowlimit'];
$page = $_POST['page'];
$total_pages = $DB->totalblog($searchkey,$datefrom,$dateto);
if($page) {
$start = ($page - 1) * $limit;
}else{
$start = 0;
}
$pagination_out = pagination($tbl_name,$adjacents,$total_pages,$targetpage,$limit,$page,$start);
/*Pagination Property*/
?>
<div class="row">
<div class="table-responsive">
<table class="table table-striped jambo_table bulk_action">
<thead>
<tr class="headings">
<th><input type="checkbox" id="check-all" class="flat"></th>
<th class="column-title">ID </th>
<th class="column-title">Date </th>
<th width="30%">Title </th>
<th class="column-title">Total Views </th>
<th class="column-title no-link last"><span class="nobr">Action</span></th>
<th class="bulk-actions" colspan="7">
<a class="antoo" style="color:#fff; font-weight:500;">Bulk Actions ( <span class="action-cnt"> </span> ) <i class="fa fa-chevron-down"></i></a>
</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
$fetch = $DB->output_blog($start,$limit,$orderby,$searchkey,$datefrom,$dateto);
$rowcount = count($fetch);
if($rowcount != 0){
foreach($fetch as $row){?>
<tr class="even pointer">
<td class="a-center "><input type="checkbox" class="flat" name="blog[]" value="<?php echo $row['id'];?>"></td>
<td> <?php echo $row['id'];?> </td>
<td> <?php echo date("d M Y",strtotime($row['date']));?> </td>
<td> <?php echo $row['title'];?> </td>
<td> <?php echo $row['num_views'];?> </td>
<td class=" last">
<a href="../<?php echo $blog_page."/".$row['page_name'];?>" target="_new"><span class="label label-primary fa fa-eye"> View</span></a>
<a href="add_blog_topic.php?id=<?php echo $row['id'];?>"><span class="label label-success fa fa-edit"> Edit</span></a>
<a href="javascript:;" onclick="deldialog('<?php echo $row['id'];?>','<?php echo $row['feature_img'];?>');"><span class="label label-danger fa fa-trash"> Delete</span></a>
</td>
</tr>
<?php } } else {?>
<tr>
<td colspan="7"> <center>No Data Found</center> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php echo $pagination_out;?>
<script>
// iCheck
$(document).ready(function() {
if ($("input.flat")[0]) {
$(document).ready(function () {
$('input.flat').iCheck({
checkboxClass: 'icheckbox_flat-green',
radioClass: 'iradio_flat-green'
});
});
}
});
// /iCheck
// Table
$('table input').on('ifChecked', function () {
checkState = '';
$(this).parent().parent().parent().addClass('selected');
countChecked();
});
$('table input').on('ifUnchecked', function () {
checkState = '';
$(this).parent().parent().parent().removeClass('selected');
countChecked();
});
var checkState = '';
$('.bulk_action input').on('ifChecked', function () {
checkState = '';
$(this).parent().parent().parent().addClass('selected');
countChecked();
});
$('.bulk_action input').on('ifUnchecked', function () {
checkState = '';
$(this).parent().parent().parent().removeClass('selected');
countChecked();
});
$('.bulk_action input#check-all').on('ifChecked', function () {
checkState = 'all';
countChecked();
});
$('.bulk_action input#check-all').on('ifUnchecked', function () {
checkState = 'none';
countChecked();
});
function countChecked() {
if (checkState === 'all') {
$(".bulk_action input[name='blog[]']").iCheck('check');
showdelete();
}
if (checkState === 'none') {
$(".bulk_action input[name='blog[]']").iCheck('uncheck');
hidedelete();
}
var checkCount = $(".bulk_action input[name='blog[]']:checked").length;
if (checkCount) {
$('.column-title').hide();
$('.bulk-actions').show();
$('.action-cnt').html(checkCount + ' Records Selected');
showdelete();
} else {
$('.column-title').show();
$('.bulk-actions').hide();
hidedelete();
}
}
</script>