View file iblog/admin/tables/comments_tbl.php

File size: 5.1Kb
<?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'];
$status = $_POST['status'];

	function status($stat){
		if($stat == 1){
			$val = "<font color='green'>Approved</font>";
		}else{
			$val =  "<font color='red'>Pending</font>";
		}
		return $val;
	}


	/*Pagination Property*/
	$adjacents = 2;
	$targetpage = "comments_tbl.php";
	$limit = $_POST['rowlimit'];		
	$page = $_POST['page'];
	$total_pages = $DB->totalcomments($searchkey,$datefrom,$dateto,$status);

	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 style="width:10%;">Date </th>
					<th class="column-title">Blog Title </th>
					<th class="column-title">Email </th>
					<th class="column-title">Mobile </th>
					<th class="column-title">Comments </th>
					<th class="column-title">Status </th>
					<th style="width:25%;"><span class="nobr">Action </span></th>
					<th class="bulk-actions" colspan="8">
						<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_comments($start,$limit,$orderby,$searchkey,$datefrom,$dateto,$status);
					$rowcount = count($fetch);
					if($rowcount != 0){
					foreach($fetch as $row){?>
						<tr class="even pointer">
							<td class="a-center "><input type="checkbox" class="flat" name="comments[]" value="<?php echo $row['id'];?>"></td>
							<td> <?php echo $row['id'];?> </td>
							<td> 
								<?php echo date("d-m-Y",strtotime($row['date']));?><br> 
								<?php echo date("h:i:s a",strtotime($row['date']));?>
							</td>
							<td> <?php echo $row['title'];?> </td>
							<td> <?php echo $row['email'];?> </td>
							<td> <?php echo $row['mobile'];?> </td>
							<td> <?php echo $row['comments'];?> </td>
							<td> <?php echo status($row['status']);?> </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="javascript:;" onclick="moderatedialog(<?php echo $row['id'];?>);"<span class="label label-success fa fa-commenting"> Moderate</span></a>
								
								<a href="javascript:;" onclick="deldialog(<?php echo $row['id'];?>);"><span class="label label-danger fa fa-trash"> Delete</span></a>
							</td>
						</tr>
				<?php } } else {?>
						<tr>
							<td colspan="9"> <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='comments[]']").iCheck('check');
		showdelete();
    }
    if (checkState === 'none') {
        $(".bulk_action input[name='comments[]']").iCheck('uncheck');
		hidedelete();
    }

    var checkCount = $(".bulk_action input[name='comments[]']: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>