<?php


         error_reporting(E_ALL);
         ini_set('display_errors', 1);
        
         include('../../../config/config.php');
        
        
         $campus = $_POST['campus'];
         $userID = $_POST['userID'];
         $usertype = $_POST['usertype'];
         
         if($usertype == 'student')
         {
                     
                     
                     
                     $prosselectstudentinstitutid = mysqli_query($link, "SELECT * FROM `campus`  WHERE CampusID='$campus'");
                     $prosselectstudentinstitutidrow = mysqli_num_rows($prosselectstudentinstitutid);
                     $prosselectstudentinstitutidcnt = mysqli_fetch_assoc($prosselectstudentinstitutid);
                     
                     $InstitutionID =  $prosselectstudentinstitutidcnt['InstitutionID'];
                     
                     
             
             
             
         }else
         {
             
             
             $InstitutionID = $campus;
                                 
             
         }
         

         
         
     
         
         $proslectcalenar = mysqli_query($link," SELECT * FROM `calender` INNER JOIN `calender_purpose` ON `calender`.`Purpose_ID` = `calender_purpose`.`sn`  
         WHERE `calender`.InstitutionID='$InstitutionID'");
         $proslectcalenarcnt = mysqli_num_rows($proslectcalenar);
         $proslectcalenarcntrow = mysqli_fetch_assoc($proslectcalenar);
         

          
          
          if($proslectcalenarcnt > 0)
          {
              
              
                       $proscheckstudentcount = 0;
              
                  do{
                      
                      
                      
                         $Session =  $proslectcalenarcntrow['Session'];
                         $Title =  $proslectcalenarcntrow['Title'];
                         $End_Date =  $proslectcalenarcntrow['End_Date'];
                         $Start_Date =  $proslectcalenarcntrow['Start_Date'];
                         $Purpose =  $proslectcalenarcntrow['Purpose'];
                         
                         

                         $finaldate = date('jS', strtotime($End_Date));
                      
                         $proscheckstudentcount++;
                        
                         if($proscheckstudentcount == '1')
                         {
                             
                             $prosactiveclass = 'active';
                             
                         }else
                         {
                             $prosactiveclass = ''; 
                         }
                      
                      
                                 echo '<div class="carousel-item '.$prosactiveclass.'">
                                
                                        <div class="row">
                                            <div class="col-2">
                                                <div style="border-radius: 50%; padding: 6px 8px 6px 8px; background-color: #0066ff;">
                                                    <span style="font-size: 11px; font-weight: 600; color: #ffffff;;"> 
                                                        '.$finaldate.'
                                                    </span>
                                                </div>
                                            </div>
                                            <div class="col-10">
                                            
                                                <strong>'.$Title.'</strong>
                                                <br>
                                                <span>'.$Purpose.'</span>
                                            </div>
                                        </div>
                                </div>';
                               
                      
                  }while($proslectcalenarcntrow = mysqli_fetch_assoc($proslectcalenar));
              
          }else
          {
              
          }
          
          
         
         
         
         
         
?>