<?php

     include('../../config/config.php');

  
      $campusID = $_POST['campusID'];
      
      
      $prosgetsessioncontent = mysqli_query($link,"SELECT * FROM `session` WHERE `sessionStatus`='1'");
      $prosgetsessioncontentrows = mysqli_num_rows($prosgetsessioncontent);
      $prosgetsessioncontentrows_cnt = mysqli_fetch_assoc($prosgetsessioncontent);
      
     
      $currentsession =  $prosgetsessioncontentrows_cnt['sessionName'];
      
          

        $student =  mysqli_query($link,"SELECT DISTINCT(student.StudentID),student.StudentFirstName,student.StudentLastName,student.StudentMiddleName,student.StudentPhoto FROM `student` 
        INNER JOIN `classordepartmentstudentallocation` ON `student`.`StudentID`  = `classordepartmentstudentallocation`.`StudentID` 
         WHERE `student`.`CampusID`='$campusID' AND `classordepartmentstudentallocation`.`Session`='$currentsession' AND `student`.`StudentTrashStatus`='0' ORDER BY student.StudentLastName ASC");
       $student_num = mysqli_num_rows($student);
       $student_fetch = mysqli_fetch_assoc($student);
       
       
                        
    if($student_num > 0){
       
        do{
            
            
            
                $fisrtname = $student_fetch['StudentFirstName'];
                $lastname = $student_fetch['StudentLastName'];
                $middlename = $student_fetch['StudentMiddleName'];
                $studentID = $student_fetch['StudentID'];
                $studentPhoto = $student_fetch['StudentPhoto'];
                
           
                 echo '<label class="custom_check justify-content-center w-100">
                        <input type="checkbox"  data-id="'.$studentID.'" class="prosloastudentforeit" name="group" value="'.$lastname.' '.$fisrtname.' '.$middlename.'" class="X">
                        <img width = "40" src="'.$studentPhoto.'" class="" id="tari-img" style="border-radius:20px;">
                        <span class="checkmark"></span> '.$lastname.' '.$middlename.' '.$fisrtname.' 
                    </label> ';
               
        }while ($student_fetch = mysqli_fetch_assoc($student));
       
    }
    else{
        
        
        echo '   <div class="row justify-content-center">
                    <img width = "100" src="../assets/images/student.png" class="" id="tari-img"">
                </div>
                <div class="row justify-content-center">
                    <p style="color:red;">Hey! No Student Available</p>
                </div>
                ';
                
                
    }
           
        
        
        
        
            
?>