View file iblog/admin/blog_post.php

File size: 8.66Kb
<?php 
	include "../lib/functions_class.php"; 
	include "inc/check_session.php"; 
 ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>iBlog | Blog Topics</title>

	
	<!-- FAVICONS -->
    <link rel="shortcut icon" href="../uploads/favicon/<?php echo $DB->get_settingdata('favicon');?>" type="image/x-icon">
	
    <!-- Bootstrap -->
    <link href="plugins/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="plugins/iCheck/skins/flat/green.css" rel="stylesheet">
	
	<!-- JqueryUi -->
    <link href="plugins/jquery.ui/jquery-ui-1.9.2.custom.css" rel="stylesheet">
	
	<!-- Alert, Info, Confirm Plugin -->
    <link href="plugins/lobibox/lobibox.min.css" rel="stylesheet">
	
    <!-- bootstrap-progressbar -->
    <link href="plugins/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <!-- jVectorMap -->
    <link href="css/maps/jquery-jvectormap-2.0.3.css" rel="stylesheet"/>

    <!-- Custom Theme Style -->
    <link href="css/custom.css" rel="stylesheet">
  </head>

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">

            <?php include "inc/header.php";?>
			

        <?php include "inc/top_nav.php";?>
		
        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3><li class="fa fa-home"></li>Home / Topics</h3>
              </div>

              <div class="title_right">
                <div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
                  <div class="input-group">
						<button class="form-control"><i class="fa fa-file-text-o"></i> All Topics</button>
                    <span class="input-group-btn">
						<a href="add_blog_topic.php"><button class="btn btn-default" type="button"><i class="fa fa-edit"></i> Add Topics </button></a>
                          </span>
                  </div>
                </div>
              </div>
            </div>
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
			  
			<!----Filter Start------->  
			  <form id="filter">
					<div class="col-md-1 col-sm-12 col-xs-12">
						<select class="form-control" name="rowlimit" id="rowlimit">
							<option value="10">10</option>
							<option value="20">20</option>
							<option value="50">50</option>
							<option value="100">100</option>
						</select>
					</div>
								
					<div class="col-md-3 col-sm-12 col-xs-12">
						<select class="form-control" name="orderby" id="orderby">
							<option value="DESC">Decending</option>
							<option value="ASC">Ascending</option>
						</select>
					</div>
					
					<div class="col-md-3 col-sm-12 col-xs-12">
						<input type="text" class="form-control" name="searchkey" id="searchkey" placeholder="Search keyword"> 
					</div>
								
					<div class="col-md-2 col-sm-12 col-xs-12">
						<input type="text" class="form-control date-picker" name="datefrom" id="datefrom" placeholder="Date From">			
					</div>

					<div class="col-md-2 col-sm-12 col-xs-12">
						<input type="text" class="form-control date-picker" name="dateto" id="dateto" placeholder="Date To"> 
					</div>
								
					<div class="col-md-1 col-sm-12 col-xs-12">
						<button type="submit" class="btn btn-primary"><li class="fa fa-search"></li> Filter</button>
					</div>
				</form>
			<!----Filter End------->  
			
                <div class="x_panel" style="height:100%;">
                  <div class="x_title">
						<h2>Blog Topics</h2>
						<button onclick="deleteall();" type="button" class="btn btn-danger btn-addon m-b-sm hidden deleteall" 
							style="float:right;margin-left: 2%;"><i class="fa fa-trash"></i> Delete Selected</button>
                    <div class="clearfix"></div>
                  </div>
				  
                  <div class="x_content">
                    
						<div id="blog_tbl"></div>
							
                  </div>
				  
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
		
		<div id="dialog" title="Confirmation Required" style="display:none;">
			Are you sure , You want to delete?
		</div>
		
		<?php include "inc/footer.php";?>
		
      </div>
    </div>

    <!-- jQuery -->
    <script src="plugins/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="plugins/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="plugins/fastclick/lib/fastclick.js"></script>
	
	<!-- Date Picker -->
	<script src="js/moment/moment.min.js"></script>
	<script src="js/datepicker/daterangepicker.js"></script>
	
    <!-- NProgress -->
    <script src="plugins/nprogress/nprogress.js"></script>
    <!-- iCheck -->
    <script src="plugins/iCheck/icheck.min.js"></script>
	
	<!-- Alert, Info Or Confirm Plugin -->
    <script src="plugins/lobibox/lobibox.js"></script>
	
	<!-- JqueryUI -->
    <script src="plugins/jquery.ui/jquery-ui-1.9.2.custom.js"></script>
    
    <!-- Custom Theme Scripts -->
    <script src="js/custom.js"></script>
	
	
	<script>
	$(document).ready(function() {
		pages_tbl();
			
		//Date Picker
		$('.date-picker').daterangepicker({
			singleDatePicker: true,
			dateFormat: 'dd-mm-yy',
			calender_style: "picker_1"
			}, function(start, end, label) {
			console.log(start.toISOString(), end.toISOString(), label);
		});
	});
	
	////////////Show Delete Button
	function showdelete(){
		$(".deleteall").removeClass("hidden");
	}
	//Hide Delete Button
	function hidedelete(){
		$(".deleteall").addClass("hidden");
	}
	
	function deleteall(){
		Lobibox.confirm({
			msg: "You want to delete all selected.",
			callback: function ($this, type, ev) {
				if (type === 'yes') {
					delselect();
				}
			}
		}); 
	}
	
	function delselect(){	
		var checked = []
		$("input[name='blog[]']:checked").each(function (){
			checked.push(parseInt($(this).val()));
		});
		
		$.post("controller/blog_ajax.php",{
			action:'multidelete',
			id:checked,
			},function(data){
				if(data == 3){
					pages_tbl();
					hidedelete();
				}

		});		
	}
	////////Delete All

	//To Load Table
	function pages_tbl(){
		var rowlimit = $("#rowlimit").val();
		var orderby = $("#orderby").val();
		var searchkey = $("#searchkey").val();
		var datefrom = $("#datefrom").val();
		var dateto = $("#dateto").val();
		$("#blog_tbl").html("<center><img src='images/loading.gif'></center>");
		$.post("tables/blog_tbl.php",{
			rowlimit:rowlimit,
			orderby:orderby,
			searchkey:searchkey,
			datefrom:datefrom,
			dateto:dateto,
			},function(data){
				$("#blog_tbl").html(data);
		});
	}
	
	$("#rowlimit").on('change',function(){
		pages_tbl();
	});

	$("#orderby").on('change',function(){
		pages_tbl();
	});

	$("#searchkey").on('keyup',function(){
		pages_tbl();
	});
	
	$("#filter").submit(function (event){
	event.preventDefault();
	$.ajax({
			url:'tables/blog_tbl.php',
			type:'POST',
			data:$(this).serialize(),
			success: function(response){
				$('#blog_tbl').html(response);
					
			}

		});
	});
		
	//Next And Previous Page
	$('#blog_tbl').on('click','.clickpage',function(e){
		e.preventDefault();
		
		var rowlimit = $("#rowlimit").val();
		var orderby = $("#orderby").val();
		var searchkey = $("#searchkey").val();
		var datefrom = $("#datefrom").val();
		var dateto = $("#dateto").val();
		//Get Page ID
		$page = $(this).attr('href');
		$pageind = $page.indexOf('page=');
		$page = $page.substring(($pageind+5));
		
		//alert($page);
		$.post("tables/blog_tbl.php",{
			page:$page,
			rowlimit:rowlimit,
			orderby:orderby,
			searchkey:searchkey,
			datefrom:datefrom,
			dateto:dateto,
			},function(data){
				$("#blog_tbl").html(data);
		});
	});

	//Delete
	function deleted(id,pic){
		//var message = "Entry Deleted Sucessfully.";
		$.post("controller/blog_ajax.php",{
			action:'delete',
			id:id,
			pic:pic,
			},function(data){
				pages_tbl();
		});
			
	}
	
  //Dilaog Delete Function
  function deldialog(id,pic){
    $("#dialog").dialog({
	  show: 'explode',
	  hide: 'fold',
      buttons : {
        "Confirm" : function() {
          deleted(id,pic);
		  $(this).dialog("close");
        },
        "Cancel" : function() {
          $(this).dialog("close");
        }
      }
    });

    $("#dialog").dialog("open");
  }
	
	</script>
  </body>
</html>