Current File : /home/inlingua/www/sensoriumpsychologists.com/backup/student/study_case_update.php
<?php 

include_once("common/head_links.php");

include_once("../classes/config.php");

?>

<body class="hold-transition skin-blue sidebar-mini">

    <div class="wrapper">

<?php include_once("common/header.php");?>

<?php include_once("common/left_side_bar.php");?>

      <!-- Content Wrapper. Contains page content -->

      <div class="content-wrapper">

        <!-- Content Header (Page header) -->

        <section class="content-header">

          <h1>

            Assessment Files Update

          </h1>

        
<?php
if(isset($_POST) && !empty( $_POST )){
$allowedExts = array("pdf");
$temp = explode(".", $_FILES["pdf_file"]["name"]);
$extension = end($temp);

if ($_FILES['pdf_file']['type'] == "application/pdf") 
{
$random_digit=rand(0000,9999);
$case_id=$_POST['case_id'];
$created_by=$session_row['student_id'];
$_FILES['pdf_file']['name']=$random_digit.'-'.$case_id.'-'.$created_by.'.'.$extension;
$upload_pdf=$_FILES["pdf_file"]["name"];
$sql="SELECT * FROM `shristi_case_study_add` where case_id='".$case_id."' and created_by='".$session_row['student_id']."' ";
$result_assign=$conn->query($sql);
$case=$result_assign->fetch_assoc();
if($case['case_id']>0)
{
	echo '<h3>';
	echo "This Case Already Uploaded !!";
	echo '</h3>';
}else {	

move_uploaded_file($_FILES["pdf_file"]["tmp_name"],"../uploads/study_case_add/" . $_FILES["pdf_file"]["name"]);
$add_date=date('Y-m-d');
$data['case_id']=$case_id;
$data['file']=$upload_pdf;
$data['created_by']=$created_by;
$data['add_date']=$add_date;

$sql=$query->qry_insert('shristi_case_study_add',$data );

if($sql){
	echo '<h3>';
	echo "Case Submit Successfully";
	echo '</h3>';
}
else{ echo '<h3>';
	echo "Case Submit Error!!";
	echo '</h3>';
}
}
}else {
	echo '<h3>';
		if ( $_FILES['pdf_file']['type'] != "application/pdf") {
			print "Error occured while uploading file : ".$_FILES['pdf_file']['name']."<br/>";
			print "Invalid  file extension, should be pdf !!"."<br/>";
			print "Error Code : ".$_FILES['pdf_file']['error']."<br/>";
		}
	 echo '</h3>';	
     }
}


?>

</section>



        <!-- Main content -->



        <section class="content">



          <!-- Info boxes -->          



         <div class="row">
<div class="col-md-1"></div>
<div class="col-md-5 col-sm-5 col-xs-5">



<center>

<h3>Case File 1</h3>

<p> Upload Case 1 Only PDF File</p></br>
<form action="#" method="POST" enctype="multipart/form-data">
 <input type="hidden" name="case_id" value="1">
 
 <div class="col-md-8 col-sm-8 col-xs-8" >
 <input type="file" style="float:right" name="pdf_file" id="pdf" accept="application/pdf">
 </div>
 <div class="col-md-4 col-sm-4 col-xs-4">
 <input type="submit" value="Submit" name="submit" style="float:left;">
 </div>
 </form>

</center>
</div>
<div class="col-md-5 col-sm-5 col-xs-5">

<center>

<h3>Case File 2</h3>

<p> Upload Case 2 Only PDF File</p></br>
<form action="#" method="POST" enctype="multipart/form-data">
 <input type="hidden" name="case_id" value="2">
 
 <div class="col-md-8 col-sm-8 col-xs-8" >
 <input type="file" style="float:right" name="pdf_file" id="pdf" accept="application/pdf">
 </div>
 <div class="col-md-4 col-sm-4 col-xs-4">
 <input type="submit" value="Submit" name="submit" style="float:left;">
 </div>
 </form>

</center>
	</div>	

		

          </div>

         

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


<section class="content">
<?php
 $id=$session_row['student_id'];
 $result=$query->select_where('shristi_case_study_add','created_by',$id); 
 //echo "tt->".$total=$result->mysql_num_rows();
 
 ?>
          <!-- Info boxes -->          
         <div class="row">
	<div class="col-md-1"></div>
          	<div class="col-md-10 col-sm-8 col-xs-8">
  <table class="student table table-striped">
  <tr> 
<td colspan="11"> <h1>Update Case Details</h1></td></tr>
<tr>
	<th>S. No.</th>
    <th>Case</th>
	<th>Update File</th>
    <th>Add Date</th>
    <th>Status</th>
    
	
</tr>
<?php $i=1; while ($row=$result->fetch_assoc()){ ?>
<tr>
  
  <td><?php echo  $i;?></td>
  <td><?php echo  $row['case_id'];?></td>
  <td><a href="../uploads/study_case_add/<?php echo $row['file'];?>" target="_blank" >View File </a> </td>
  <td><?php echo  $row['add_date'];?></td>
  
  <td><?php if ($row['status']=='0') { 
  echo  'Approval Pending'; } ?>
  <?php if ($row['status']=='1') { 
  echo  'Approved'; } ?>
  </td>
  
</tr>	  
  <?php $i++; }?>		  
</table>
                
           </div>


<div class="col-md-1"></div>
          </div>
         
        </section>

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

      <?php include_once("common/footer.php");?>

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

<?php include_once("common/footer_links.php");?>

</body>

</html>