View file iblog/admin/tables/pages_tbl.php

File size: 4.95Kb
<?php 
include "../../lib/functions_class.php"; 
include "../../lib/pagination.php";

$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->totalpage($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">Title </th>
					<th class="column-title">Page Name </th>
					<th class="column-title">Meta Title </th>
					<th class="column-title">Menu Order </th>
					<th width="25%"><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_pages($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="pages[]" value="<?php echo $row['id'];?>"></td>
							<td> <?php echo $row['id'];?> </td>
							<td> <?php echo $row['title'];?> </td>
							<td> <?php echo $row['page_name'];?> </td>
							<td> <?php echo $row['meta_title'];?> </td>
							<td>		
								<select class="form-control" id="setorder" name="setorder" style="width:110px;margin-right:5px;">
									<option value="<?php echo "0,".$row['id'];?>">Nav Order</option>
									<?php for($i=1;$i<=$rowcount;$i++){?>
										<option value="<?php echo $i.",".$row['id'];?>" 
										<?php if($row['nav_order'] == $i){echo "selected";}?>><?php echo $i;?></option>
									<?php } ?>
								</select>
							</td>
							<td class=" last">
								<a href="../<?php echo $row['page_name'];?>" target="_new"><span class="label label-primary fa fa-eye"> View</span></a>
								<a href="add_page.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'];?>);"><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>
//Change Order
	$("*#setorder").on('change',function(){
		var getval = $(this).val();
		changeorder(getval);
	});

// 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='pages[]']").iCheck('check');
		showdelete();
    }
    if (checkState === 'none') {
        $(".bulk_action input[name='pages[]']").iCheck('uncheck');
		hidedelete();
    }

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