Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/thread-self/root/home/rizant5/www/admin/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/thread-self/root/home/rizant5/www/admin/chapters.php

<?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");
}
?>
<!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>.selected{color:red;}#settable div.DTTT_container{margin-top: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">
        <!-- Content Header (Page header) -->
        <!-- Main content -->
        <div class="col-sm-4">
        <section class="content">
          <!-- Default box -->
          <div class="box">
            <div class="box-header with-border">
              <h3 class="box-title"><?php echo $sub_result['subject_name'];?></h3>
            </div> 
            <div class="box-body" id="settable">
            <div class="col-sm-3 col-xs-12">
                <a href="chapter-new.php?subid=<?php echo $subid;?>" class="btn btn-primary btn-sm" ><i class="fa fa-plus"></i> Add New Chapter</a>
              </div>
              <table class="table table-bordered table-striped dataTable" id="data-table">
                <thead><tr><th>Chapters Name</th><th>Action</th></tr></thead>
                 <tbody>
                 	<?php  $data=$conn->prepare("select * from chapters where subject_id='$subid'");
					$data->execute();$result=$data->fetchall();$i=1;
					foreach($result as $row){
						echo "<tr>";
						echo "<td><a class='clickme fisrt$i' id='$row[chapter_id]'>$row[chapter_name]</a></td>";
						echo "<td><a href='chapter-edit.php?chapter_id=$row[chapter_id]&subid=$subid' title='Edit Chapter' class='btn btn-info btn-xs'>Edit</a>&nbsp;&nbsp;";?><a href='chapters.php?action=Chapter&chapter_id=<?php echo $row['chapter_id'];?>&subid=<?php echo $subid;?>' onclick="return confirm('Are you sure you want to delete?')" title='Delete Chapter' class='btn btn-danger btn-xs'>Delete</a></td><?php
						echo "</tr>";
						$i++;
					}
					?>
                 </tbody>
                 </table>
            </div><!-- /.box-body -->
          </div><!-- /.box -->
        </section><!-- /.content -->
        </div>
         <div class="col-sm-8">
        <section class="content">
          <!-- Default box -->
          <div class="box"  id="result">
          <div class="box-header with-border">
              <h3 class="box-title">Topics</h3>
              <div class="box-tools pull-right">
               <a href="courses.php" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a>
              </div>
           </div>
           <div class="box-body">
               <div class="col-sm-12">Create Chapter firstly....</div>
           </div>       
          </div><!-- /.box -->
        </section><!-- /.content -->
        </div>
      </div></div><!-- /.content-wrapper -->
      <?php footer();?>
    </div><!-- ./wrapper -->
   <?php jsfile();datatablejs();?>
   <script>
$('#data-table').dataTable({
     responsive: true,
     "dom": 'T<"clear">lfrtip',
	 "aaSorting": [],
	  "ordering": false,
	 "bFilter" : false,               
	"bLengthChange": false,
	"bInfo":false,
	"bPaginate":false,
     "tableTools": {
           "sSwfPath": "../apptheme/plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf",
		   "aButtons": [
            {
                "sExtends": "copy",
                "mColumns": [0]
            },
   			{
                "sExtends": "xls",
                 "mColumns": [0]
            },
                        {
                "sExtends": "pdf",
                 "mColumns": [0]
            },
        ]
      }
});
</script>
<script>
	$('.clickme').click(function(e) {
	var chapter_id=this.id;
	$(".clickme").removeClass("selected");
	$(this).addClass("selected");
	$.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(){
	var chapter_id=document.querySelector('.fisrt1').id
	$("#"+chapter_id).addClass("selected");
	$.ajax({
	   type:'POST',
	   url:'get-topic-ajax.php',
	   data:{'chapter_id':chapter_id,'subid':<?php echo $subid;?>},
	   success: function(data)
	   {
		 	$("#result").html(data);
	   }
    }) 
})
</script>
<script>
function deletetopic(deleteid,chapter_id,subid){
    if (confirm("Are you sure you want to Delete ?")) {
   	$.ajax({
	   type:'POST',
	   url:'topic_delete_ajax.php',
	   data:{'deleteid':deleteid},
	   success: function(data)
	   {
		 	afterdelte(chapter_id,subid);
	   }
    }) 
   }
 }
function afterdelte(chapter_id,subid){
	$(".clickme").removeClass("selected");
	$("#"+chapter_id).addClass("selected");
	$.ajax({
	   type:'POST',
	   url:'get-topic-ajax.php',
	   data:{'chapter_id':chapter_id,'subid':subid},
	   success: function(data)
	   {
		 	$("#result").html(data);
	   }
    }) 
}
 </script>

  </body>
</html>

Zerion Mini Shell 1.0