policybot/application/views/admin/blog/list.php

228 lines
5.9 KiB
PHP
Raw Normal View History

2021-11-30 10:56:55 +00:00
<link href="<?=base_url();?>bassets/jquery-tags-input/jquery-tags-input.css" rel="stylesheet">
<?php $this->load->view('admin/includes/header');?>
<style>
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.sliderrr {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #e43a45;
-webkit-transition: .4s;
transition: .4s;
width: 50px;
height: 30px;
border-radius: 20px !important;
}
.sliderrr:before {
position: absolute;
content: "";
height: 22px;
width: 22px;
left: 0px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .sliderrr {
background-color: #26c281;
width: 50px;
height: 30px;
border-radius: 20px !important;
}
input:focus + .sliderrr {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .sliderrr:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.sliderrr.round {
border-radius: 34px;
}
.sliderrr.round:before {
border-radius: 50%;
}
</style>
<div class="page-container">
<?php $this->load->view('admin/includes/sidebar');?>
<!-- start page content -->
<div class="page-content-wrapper">
<div class="page-content">
<div class="page-bar">
<div class="page-title-breadcrumb">
<div class=" pull-left">
<div class="page-title">Blog List</div>
</div>
<ol class="breadcrumb page-breadcrumb pull-right">
<li><i class="fa fa-home"></i>&nbsp;<a class="parent-item" href="index.html">Home</a>&nbsp;<i class="fa fa-angle-right"></i>
</li>
<li><a class="parent-item" href="#">Blog</a>&nbsp;<i class="fa fa-angle-right"></i>
</li>
<li class="active">Blog List</li>
</ol>
</div>
</div>
<?php $this->load->view('admin/includes/msg');?>
<div class="row">
<div class="col-md-12">
<div class="card card-topline-orange">
<div class="white-box">
<div class="card card-box">
<div class="card-head">
<header>Blog</header>
</div>
<div class="card-body ">
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-6" style="float:left">
<div class="btn-group">
<a href="<?=base_url();?>admin/add-blog" id="addRow" class="btn btn-info">
Add New <i class="fa fa-plus"></i>
</a>
</div>
</div>
</div>
<div class="table-scrollable">
<table class="table table-hover table-checkable order-column full-width" id="example4">
<thead>
<tr>
<th>S no</th>
<th> Name </th>
<th> Image </th>
<th> Details </th>
<th> Tags </th>
<th> Edit </th>
<th> Action </th>
</tr>
</thead>
<tbody>
<?php
if(isset($blo)&& $blo->num_rows()>0)
{
$i=1;
foreach($blo->result() as $s)
{
$id=$s->id;
$name=$s->name;
$tags=$s->tags;
$image=$s->image;
$intro=$s->intro;
$enable_disable=$s->status;
?>
<tr class="odd gradeX">
<td><?=$i;?></td>
<td><?=ucwords($name);?></td>
<td><img src="<?=base_url();?>/<?=$image;?>" width="75px" height="75px"></td>
<td><?=ucwords($intro);?></td>
<td>
<?php
$i=1;
$tag=explode(",", $tags);
foreach($tag as $tg)
{ if($tg!=" "){?>
<i class="label label-sm label-primary" href="javascript::"><?=ucwords($tg);?></i>
</p> <?php } $i++;} ?>
</td>
<td>
<a href="<?=base_url();?>admin/edit-blog/<?=$id;?>" class="btn btn-primary btn-xs " > <!--data-type="1" for edit-->
<i class="fa fa-pencil"></i>
</a>
</td>
<td>
<label class="switch">
<input type="checkbox" id="chkid_<?=$id;?>" <?php if($enable_disable==1) { ?> checked <?php } ?>>
<span class="sliderrr round"></span>
</label>
</td>
</tr>
<?php $i++;} } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php $this->load->view('admin/includes/footer');?>
<script type="text/javascript" src="<?=base_url();?>bassets/admin/js/jquery.cookie.min.js"></script>
<script>
var base_path=$('body').attr('data-path');
$('input[type="checkbox"]').click(function(){
if($(this).prop("checked") == true){
var pri_id=$(this).attr("id");
var sep_id = pri_id.split('_');
var banner_id=sep_id[1];
var del_value="1";
var url23=base_path+"blog/check_uncheck_blog";
$.post(url23,{id:banner_id,val:del_value,csrf_test_name:$.cookie('csrf_cookie_name')},function(res23){
if(res23==1)
{
location.reload();
}
});
}
else if($(this).prop("checked") == false){
var pri_id=$(this).attr("id");
var sep_id = pri_id.split('_');
var banner_id=sep_id[1];
var del_value="0";
var url23=base_path+"blog/check_uncheck_blog";
$.post(url23,{id:banner_id,val:del_value,csrf_test_name:$.cookie('csrf_cookie_name')},function(res23){
if(res23==1)
{
location.reload();
}
});
}
});
</script>