Mini Shell

Direktori : /home/rizant5/public_html-1210/student/
Upload File :
Current File : /home/rizant5/public_html-1210/student/read-topic.php

<?php 

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

require_once("function-file.php");

require_once("function-menu.php");

cookiecheck();

$topic_id=$_GET['topic_id'];

setcookie("topic_id",$topic_id, time() +86400);

$datas=$conn->prepare("select * from topics where topic_id='$topic_id'");

$datas->execute();$result=$datas->fetch();

?>

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

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

    <title><?php echo $result['topic_name'];?></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();?>

    <style>
      iframe{width: 100% !Important;}

      .skin-blue .wrapper{background-color:#f4f4f4;}

      .ex-title{font-size: 16px !important;    color: rgba(0, 115, 183, 0.74); font-weight: bold;}.ans-text{background-color: #f5f5f5;border: 1px solid #ccc;padding: 10px;}
      .box-body img{
        height: auto !important;
        max-width: 100%;
      }
      @media screen and (max-width: 768px){
        .iframe-comp{
          padding: 0px;
        }
        iframe{
          width: 100% !important;
          height: 200px !important;
        }
      }
     </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 -->

        <section class="content">

          <!-- Default box -->

          <div class="box">

            <div class="box-header with-border">

              <h3 class="box-title ex-title"><?php echo $result['topic_name'];?></h3>

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

              <?php $pdata=$conn->prepare("select * from practice where topic_id='$topic_id'");

			  $pdata->execute();$pnum=$pdata->rowcount();if($pnum>0){?>

               <a  href="practice.php?topic_id=<?php echo $topic_id;?>" class="btn btn-success btn-sm" > Practice <i class="fa fa-toggle-up"></i></a>

               &nbsp;&nbsp;&nbsp;<?php }?>

                <a  href="javascript:history.back()" class="btn btn-info btn-sm" ><i class="fa fa-angle-double-left"></i> Back</a>

              </div>

            </div>

            <div class="box-body">

              <div class="form-group">

              		<div class="col-sm-5 img-thumbnail col-xs-12"><?php echo $result['topic_desc'];?></div>

                    <div class="iframe-comp col-sm-6 img-thumbnail col-sm-offset-1 col-xs-12"><?php echo $result['video_url'];?></div>

              </div>

            </div><!-- /.box-body -->

          </div><!-- /.box -->

          <div class="box box-primary">

          	<div class="box-body">

           <form action="#" id="form" method="post">

           <input type="hidden" name="topic_id" value="<?php echo $topic_id;?>">

            		<div class="row form-group" style="padding: 10px 30px;"><div class="col-sm-12" align="center"><textarea name="question" class="form-control" id="ques" placeholder="Ask a question..." required></textarea></div></div>

                    <div class="row form-group"><div class="col-sm-12" align="center"><button type="submit" name="save" class="btn btn-success" >Post This Question</button></div></div></form>

               <hr>

              <div class="row form-group" id="questions">      

                    <div class="col-sm-12">

              <!-- The time line -->

              <ul class="timeline">

                <!-- timeline time label -->

                <?php $db=$conn->prepare("select * from question a inner join student_reg b on a.stu_id=b.stu_id where a.approve='1' and topic_id='$topic_id' order by datetime DESC");

				$db->execute();$results=$db->fetchall();

				foreach($results as $rows){?>

                <!-- timeline item -->

                <li>

                  <i class="fa fa-envelope bg-blue"></i>

                  <div class="timeline-item">

                    <span class="time "><?php echo date('d M. Y',strtotime($rows['datetime']));?> - <i class="fa fa-clock-o"></i>  <?php echo date('h:i A',strtotime($rows['datetime']));?></span>

                    <h3 class="timeline-header"><?php echo $rows['stu_name'];?></h3>

                    <div class="timeline-body">

                      <?php echo $rows['text'];?>

                    </div>

                    <?php $data=$conn->prepare("select * from answers where que_id='$rows[que_id]'");

					$data->execute();$result=$data->fetchall();$num=$data->rowcount();if($num>0){

						foreach($result as $row)?>

                    <div class="timeline-footer">

                    <span class="badge bg-green">Answer</span>

                     <p><div class='ans-text'><?php echo $row['text'];?></div></p>

                    </div><?php }?>

                  </div>

                </li>

                <!-- END timeline item -->

                <!-- timeline item -->

                <?php }?>

                <!-- END timeline item -->

               

              </ul>

              </div>

            </div>

            </div>

          </div><!-- /.box -->

        </section><!-- /.content -->

      </div></div><!-- /.content-wrapper -->

      <?php footer();?>

    </div><!-- ./wrapper -->

   <?php jsfile();?>

  <!-- Modal -->

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">

  <div class="modal-dialog" role="document">

    <div class="modal-content">

      <div class="modal-header" style="background-color:#0382a9;">

        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

        <h4 class="modal-title" id="myModalLabel" align="center" style="color:#fff;">Success</h4>

      </div>

      <div class="modal-body">

       <p align="center" style="font-size:16px;color:#0382a9;line-height:1.1;">Your comment has been succesfully submitted<br>

		We will attend to it as soon as possible</p>

      </div>

      <div class="modal-footer" style="display:none;">

        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

      </div>

    </div>

  </div>

</div>

<script>

$('#form').on('submit', function (e) {

	e.preventDefault();

	$.ajax({

		type: 'post',

		url: 'question-ajax.php',

		data: $('form').serialize(),

	  	success: function (data) {

			$("#ques").val('');

			$('#myModal').modal()  

        }

     });

});


//$("iframe").attr("height");
</script>

  </body>

</html>


Zerion Mini Shell 1.0