<?php  session_start(); ob_start(); 

if(empty($_SESSION['LOGINID']) && empty($_SESSION['LOGINNM']) ){

	header("Location:login.php");
}
include_once("../header.php");

 ?>
 
 
 <?php if (isset($_GET['pr'])) { 
           $ev_id=intval($_GET['ev_id']);
		   $ev_status = mysqli_query($connection, "SELECT * FROM `events` where id='$ev_id' ");
           $ev_status  = mysqli_fetch_object($ev_status );
           $ev_status = $ev_status ->pr_calendar;
		   if($ev_status==0){$new_ev_status=1;}
		   if($ev_status==1){$new_ev_status=0;}
		   $qry = mysqli_query($connection, "UPDATE `events` SET `pr_calendar` = '$new_ev_status' WHERE `events`.`id` = '$ev_id'; ");
		   if($new_ev_status==1){           ?>
			   
			   <a class="btn btn-success waves-effect waves-light btn-sm m-b-5 btn-rounded" href="#" onclick="calendar(<?php echo $ev_id;  ?>);" style="padding: 0px 5px">Calender Done</a>
			   
			   
	<?php	   }
	        else {   ?>
				<a class="btn btn-danger waves-effect waves-light btn-sm m-b-5 btn-rounded" href="#" onclick="calendar(<?php echo $ev_id;  ?>);" style="padding: 0px 5px">Calender Pending</a>
		<?php	}
		   
		   
 }
 
 
 ?>
 <?php if (isset($_GET['sp'])) { 
           $ev_id=intval($_GET['ev_id']);
		   $ev_status = mysqli_query($connection, "SELECT * FROM `events` where id='$ev_id' ");
           $ev_status  = mysqli_fetch_object($ev_status );
           $ev_status = $ev_status ->sp_calendar;
		   if($ev_status==0){$new_ev_status=1;}
		   if($ev_status==1){$new_ev_status=0;}
		   $qry = mysqli_query($connection, "UPDATE `events` SET `sp_calendar` = '$new_ev_status' WHERE `events`.`id` = '$ev_id'; ");
		   if($new_ev_status==1){           ?>
			   
			   <a class="btn btn-success waves-effect waves-light btn-sm m-b-5 btn-rounded" href="#" onclick="calendar(<?php echo $ev_id;  ?>);" style="padding: 0px 5px">Calender Done</a>
			   
			   
	<?php	   }
	        else {   ?>
				<a class="btn btn-danger waves-effect waves-light btn-sm m-b-5 btn-rounded" href="#" onclick="calendar(<?php echo $ev_id;  ?>);" style="padding: 0px 5px">Calender Pending</a>
		<?php	}
		   
		   
 }
 
 
 ?>
 
 