Mini Shell
<?php
require_once("../config.php");
require_once("function-file.php");
require_once("function-menu.php");
cookiecheck();
$subid=$_GET['subid'];
$sub_data=$conn->prepare("select * from subjects where subject_id='$subid'");
$sub_data->execute();$sub_result=$sub_data->fetch();
if((!empty($_GET['action']))&&($_GET['action']=='Chapter')){
$subid=$_GET['subid'];
$chapter_id=$_GET['chapter_id'];
$conn->exec("delete from chapters where chapter_id='$chapter_id'");
header("location:chapters.php?subid=$subid");
}
if(!empty($_GET['chpid'])){
$chpid=$_GET['chpid'];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Chapters</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<?php cssfile();datatablecss();?>
<style>.list-group-item{padding-left:10px !important;cursor:pointer}
.skin-blue .wrapper{ background-color:#f4f4f4;}
.box-set,.box-set2{border-top: 5px solid #222D32;}
.active{background: #43464b !important;color: #FFFFFF;}.clickme{font-size: 18px;}
.chap-head{color: #FFFFFF;
font-size: 16px;
border: 1px solid #A9A9A9;
padding: 1%;
background: #43464b;
font-weight:bold;
}
.top-head{ padding: 10px;
background: #3C8DBC;
font-weight: bold;
font-size: 16px;
}
td{ padding: 1% !important;
font-weight: bold;}
td:hover{background:#ccc;}
.td-a{ color: #41474A;display: block; width: 100%; height: 100%; }
.td-a:hover{ color: #41474A;}.clickme {
font-size: 14px;
}.current{ /*background: rgba(243, 156, 18, 0.58);*/background-color: #ccc;}
#settable li:nth-child(2n+1){ background-color: #f9f9f9; }
#settable li:hover{ background-color: #ccc; }
.box-body img{
height: auto !important;
max-width: 100%;
}
@media (max-width: 1024px){
.content{ padding-left: 0;padding-right: 0; }
}
</style>
</head>
<body class="hold-transition skin-blue layout-top-nav">
<!-- Site wrapper -->
<div class="wrapper">
<?php headermenu();?>
<!-- =============================================== -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<div class="col-sm-4">
<section class="content">
<!-- Default box -->
<div class="box box-set">
<div class="box-header with-border">
</div>
<div class="box-body" id="settable">
<h4 class='top-head'><?php echo $sub_result['subject_name'];?></h4>
<br>
<ul class="list-group list-group-unbordered">
<?php $data=$conn->prepare("select * from chapters where subject_id='$subid'");
$data->execute();$result=$data->fetchall();$i=1;
foreach($result as $row){
if(!empty($chpid)){
$addclass = $chpid == $row['chapter_id'] ? 'active' : '';
}
echo "<li class='list-group-item clickme $addclass fisrt$i' id='$row[chapter_id]'><b>$row[chapter_name]</b></li>";
$i++;
}
?>
</ul>
</div><!-- /.box-body -->
</div><!-- /.box -->
</section><!-- /.content -->
</div>
<div class="col-sm-8">
<section class="content">
<!-- Default box -->
<div class="box box-set2" >
<div class="box-header with-border">
<h3 class="box-title"> </h3>
<div class="box-tools pull-right">
<!-- <a href="javascript:history.back()" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a> -->
<a onClick="backClick()" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a>
</div>
</div>
<div id="result"></div>
</div>
</div><!-- /.box -->
</section><!-- /.content -->
</div>
</div></div><!-- /.content-wrapper -->
<?php footer();?>
</div><!-- ./wrapper -->
<?php jsfile();datatablejs();?>
<script>
$var = 'firsttime';
function backClick(){
// window.history.back();
history.go(-1);
setTimeout(function(){
// window.location.href = window.location.href;
chapter_id = location.href.split('&chpid=')[1];
if(chapter_id){
$(".clickme").removeClass("active");
$('#'+chapter_id).addClass("active");
$.ajax({
type:'POST',
url:'get-topic-ajax.php',
data:{'chapter_id':chapter_id,'subid':<?php echo $subid;?>},
success: function(data)
{
$("#result").html(data);
}
})
}else if($var == 'firsttime'){
$(".clickme").removeClass("active");
$('.fisrt1').addClass("active");
chapter_id = $('.fisrt1').attr('id');;
$.ajax({
type:'POST',
url:'get-topic-ajax.php',
data:{'chapter_id':chapter_id,'subid':<?php echo $subid;?>},
success: function(data)
{
$("#result").html(data);
$var = 'secondtime';
}
})
// window.location.href = window.location.href;
}else{
history.back();
}
}, 500);
}
$('.clickme').click(function(e) {
var chapter_id=this.id;
$(".clickme").removeClass("active");
$(this).addClass("active");
// url = location.href+'&chpid='+chapter_id;
url = location.href.split('&chpid')[0]+'&chpid='+chapter_id;
history.pushState(null, null, url);
$.ajax({
type:'POST',
url:'get-topic-ajax.php',
data:{'chapter_id':chapter_id,'subid':<?php echo $subid;?>},
success: function(data)
{
$("#result").html(data);
}
})
});
$(document).ready(function(){
if($(".active").size() == 1){
var chapter_id = $('.active').attr('id');
}else{
var chapter_id=document.querySelector('.fisrt1').id
}
$("#"+chapter_id).addClass("active");
$.ajax({
type:'POST',
url:'get-topic-ajax.php',
data:{'chapter_id':chapter_id,'subid':<?php echo $subid;?>},
success: function(data)
{
$("#result").html(data);
}
})
})
function afterdelte(chapter_id,subid){
$(".clickme").removeClass("active");
$("#"+chapter_id).addClass("active");
$.ajax({
type:'POST',
url:'get-topic-ajax.php',
data:{'chapter_id':chapter_id,'subid':subid},
success: function(data)
{
$("#result").html(data);
}
})
}
</script>
<style type="text/css">
@media (max-width: 991px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar-text {
float: none;
margin: 15px 0;
}
/* since 3.1.0 */
.navbar-collapse.collapse.in {
display: block!important;
}
.collapsing {
overflow: hidden!important;
}
}
</style>
</body>
</html>
Zerion Mini Shell 1.0