Mini Shell

Direktori : /home/rizant5/www/admin/
Upload File :
Current File : /home/rizant5/www/admin/courses.php

<?php 

require_once("../config.php");

require_once("function-file.php");

require_once("function-menu.php");

cookiecheck();

if((!empty($_GET['action']))&&($_GET['action']=='courese')){

	$course_id=$_GET['course_id'];

	$conn->exec("delete from courses where course_id='$course_id'");

	header("location:courses.php");

}?>

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Courses</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;}</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">Courses</h3>

              <div class="box-tools pull-right">

                <a href="course-new.php" class="btn btn-primary btn-sm" ><i class="fa fa-plus"></i> Add New Course</a>

              </div>

            </div>

            <div class="box-body">

              <table class="table table-bordered table-striped dataTable" id="data-table">

                <thead><tr><th>Courses Name</th><th>Action</th></tr></thead>

                 <tbody>

                 	<?php  $data=$conn->prepare("select * from courses where course_status='0'");

					$data->execute();$result=$data->fetchall();$i=1;

					foreach($result as $row){

						echo "<tr>";

						echo "<td><a class='clickme fisrt$i' id='$row[course_id]'>$row[course_name]</a></td>";

						echo "<td><a href='course-edit.php?courseid=$row[course_id]' title='Edit Subject' class='btn btn-info btn-xs'>Edit</a>&nbsp;&nbsp;";?><a href='courses.php?action=courese&course_id=<?php echo $row['course_id'];?>' 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><!-- /.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',

	 "ordering": false,

	"aaSorting": [],

	 "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 course_id=this.id;

	$(".clickme").removeClass("selected");

	$(this).addClass("selected");

	$.ajax({

	   type:'POST',

	   url:'get-subject-ajax.php',

	   data:{'course_id':course_id},

	   success: function(data)

	   {

		 	$("#result").html(data);

	   }

    }) 

});

$(document).ready(function(){

	var course_id=document.querySelector('.fisrt1').id

	$("#"+course_id).addClass("selected");

	$.ajax({

	   type:'POST',

	   url:'get-subject-ajax.php',

	   data:{'course_id':course_id},

	   success: function(data)

	   {

		 	$("#result").html(data);

	   }

    }) 

})

</script>

<script>

function deletetopic(subject_id,course_id){

    if (confirm("Are you sure you want to Delete ?")) {

   	$.ajax({

	   type:'POST',

	   url:'subject_delete_ajax.php',

	   data:{'subject_id':subject_id},

	   success: function(data)

	   {

		 	afterdelte(course_id);

	   }

    }) 

   }

 }

function afterdelte(course_id){

	$(".clickme").removeClass("selected");

	$("#"+course_id).addClass("selected");

	$.ajax({

	   type:'POST',

	   url:'get-subject-ajax.php',

	   data:{'course_id':course_id},

	   success: function(data)

	   {

		 	$("#result").html(data);

	   }

    }) 

}

 </script>

  </body>

</html>


Zerion Mini Shell 1.0