<?php
session_start();
	include("connect.php");
	include("connectp.php");
	ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}

	date_default_timezone_set("Asia/Singapore");
	$mdate= date('Y-m-d H:i:s');
	$mdate3= strtotime($mdate."+1 day");
	$mdate1= date('Y-m-d');
	$mdate2= date('d-m-Y' );
	
	$usermid = $_SESSION['linkariseumid'];
	$par1 = $_SESSION['linkariseufullname'];
	
	$ipaddress = "";

	if (getenv('HTTP_CLIENT_IP'))
		$ipaddress = getenv('HTTP_CLIENT_IP');
	else if(getenv('HTTP_X_FORWARDED_FOR'))
		$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
	else if(getenv('HTTP_X_FORWARDED'))
		$ipaddress = getenv('HTTP_X_FORWARDED');
	else if(getenv('HTTP_FORWARDED_FOR'))
		$ipaddress = getenv('HTTP_FORWARDED_FOR');
	else if(getenv('HTTP_FORWARDED'))
		$ipaddress = getenv('HTTP_FORWARDED');
	else if(getenv('REMOTE_ADDR'))
		$ipaddress = getenv('REMOTE_ADDR');
	else
		$ipaddress = 'UNKNOWN';
	$userserver=$_SERVER['HTTP_USER_AGENT'];

	
	/* $sql = "select taskmsceduledatetime from res_task_master where taskmstatus='Pending'";
	$stmt = $db7->prepare($sql);
	 $stmt->execute();
	 if ($stmt->rowCount() > 0)
     {
		$i=1;
      while($rt3 = $stmt->fetch(PDO::FETCH_ASSOC))
       {
		   $taskmsceduledatetime=strtotime($rt3['taskmsceduledatetime']);
		   if($taskmsceduledatetime < $mdate3)
		   {
			   $sql2 = "update res_task_master set taskmstatus='Overdue' ";
			   $stmt2 = $db7->prepare($sql2);
				$stmt2->execute();
		   }
	   }
	 } */
	 
	 if(isset($_POST['usermid'])){
		 $usermid1=$_POST['usermid'];
	 }else{
		 if($_SESSION['usermtype'] == 'Staff')
		 {
			$usermid1=$usermid; 
		 }
	 }
	

?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
    <!--<![endif]-->
    <!-- BEGIN HEAD -->

    <head>
        <meta charset="utf-8" />
        <title>Dashboard | Admin Panel</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta content="width=device-width, initial-scale=1" name="viewport" />
        <meta content="" name="description" />
        <meta content="" name="author" />
        <!-- BEGIN GLOBAL MANDATORY STYLES -->
        <link href="../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css" />
        <link href="../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
        <!-- END GLOBAL MANDATORY STYLES -->
        <!-- BEGIN THEME GLOBAL STYLES -->
        <link href="../assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
        <link href="../assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
        <!-- END THEME GLOBAL STYLES -->
        <!-- BEGIN THEME LAYOUT STYLES -->
        <link href="../assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/layouts/layout/css/themes/darkblue.min.css" rel="stylesheet" type="text/css" id="style_color" />
        <link href="../assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
        <!-- END THEME LAYOUT STYLES -->
		<link href="../assets/global/plugins/bootstrap-toastr/toastr.min.css" rel="stylesheet" type="text/css" />

		 <link href="../assets/global/plugins/fullcalendar/fullcalendar.min.css" rel="stylesheet" type="text/css" />
		 <link href="../assets/global/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
        <link href="../assets/global/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
		<link rel="shortcut icon" href="favicon.ico" /> 
	</head>
    <!-- END HEAD -->

	<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
        <!-- BEGIN HEADER -->
        <div class="page-header navbar navbar-fixed-top">
            <!-- BEGIN HEADER INNER -->
            <div class="page-header-inner ">
                <!-- BEGIN LOGO -->
                <div class="page-logo">
                    <a href="dashboard.php">
                        <img src="../assets/layouts/layout/img/logo.png" alt="logo" class="logo-default" /> </a>
                    <div class="menu-toggler sidebar-toggler"> </div>
                </div>
                <!-- END LOGO -->
				
				<!-- BEGIN MEGA MENU -->
                <!-- DOC: Remove "hor-menu-light" class to have a horizontal menu with theme background instead of white background -->
                <!-- DOC: This is desktop version of the horizontal menu. The mobile version is defined(duplicated) in the responsive menu below along with sidebar menu. So the horizontal menu has 2 seperate versions -->
				
				
				<!-- END MEGA MENU -->
                
				<!-- BEGIN RESPONSIVE MENU TOGGLER -->
                <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse"> </a>
                <!-- END RESPONSIVE MENU TOGGLER -->
                <!-- BEGIN TOP NAVIGATION MENU -->
                <div class="top-menu">
                    <ul class="nav navbar-nav pull-right">
                        <!-- BEGIN NOTIFICATION DROPDOWN -->
                        <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->

					<?php require ('header.php'); ?>

                    </ul>
                </div>
                <!-- END TOP NAVIGATION MENU -->
            </div>
            <!-- END HEADER INNER -->
        </div>
        <!-- END HEADER -->
        <!-- BEGIN HEADER & CONTENT DIVIDER -->
        <div class="clearfix"> </div>
        <!-- END HEADER & CONTENT DIVIDER -->
        <!-- BEGIN CONTAINER -->
        <div class="page-container">
            <!-- BEGIN SIDEBAR -->
			<?php
            require ('sidebar.php');
			?>
            <!-- END SIDEBAR -->
            <!-- BEGIN CONTENT -->
            <div class="page-content-wrapper">
                <!-- BEGIN CONTENT BODY -->
                <div class="page-content">
                    <!-- BEGIN PAGE HEADER-->
                    <!-- BEGIN THEME PANEL -->

                    <!-- END THEME PANEL -->
                    <!-- BEGIN PAGE BAR -->

                    <!-- END PAGE BAR -->
                    <!-- BEGIN PAGE TITLE-->




                    <!-- END PAGE TITLE-->
                    <!-- END PAGE HEADER-->
					
					
					<?php if($_SESSION['linkariseutype'] != 'Staff'){?>
					
					<div class="row">
						
						
						
						<div class="col-md-12 ">
						<form action="" method="POST"  class="form-horizontal" enctype="multipart/form-data" id="myForm">
					
					<div class="form-body">
					<div class="form-group" >
								<label class="col-md-3 control-label">User<span class="required">*</span></label>
								<div class="col-md-5">
									<select class="form-control select2" name="usermid"  id="usermid" onchange="usermid"required>
									   
										
										<?php
										$eve_main = "select * from res_user_master where utype='Admin' and utatus='Active'";
										$re_main = mysqli_query($conn, $eve_main);
										while($rt_main = mysqli_fetch_assoc($re_main))
										{

											$usermid2=$rt_main['umid'];
											$usermfullname=$rt_main['uname'];
									
											
											if($usermid2 == $usermid1)
											{
												echo "<option value='$usermid2' selected>$usermfullname</option>";

											}else
											{
											 echo "<option value='$usermid2' >$usermfullname</option>";
											}

										}
									?>
									</select>
								</div>
								</div>
								
								
								<div class="form-actions">
									<div class="row">
										<div class="col-md-offset-3 col-md-9">
											<button type="submit" class="btn  green"><i class="fa fa-check"></i> Submit</button>
											
										</div>
									</div>
								</div>
								</div>
								</div>
								</div>
								
					<?php }else { ?>
					<div class="row">
						
						
						
						<div class="col-md-9 ">
						<form action="" method="POST"  class="form-horizontal" enctype="multipart/form-data" id="myForm">
					
					<div class="form-body">
					<div class="form-group" >
								<label class="col-md-3 control-label">User<span class="required">*</span></label>
								<div class="col-md-5">
									<select class="form-control select2" name="usermid"  id="usermid" onchange="usermid"required>
									<option value='<?php echo $usermid; ?>' selected>My Calendar</option>
										
										<?php
										$eve_main = "select * from res_user_master where umid='$usermid' and ustatus='Active'";
										$re_main = mysqli_query($conn, $eve_main);
										while($rt_main = mysqli_fetch_assoc($re_main))
										{

											$usermid2=$rt_main['usermid'];
											$usermfullname=$rt_main['usermfullname'];
											$userdworkingtime=$rt_main['userdworkingtime'];
											$workinghours=floor($userdworkingtime/60);
							                $workingminutes=($userdworkingtime%60);
											
											if($usermid2 == $usermid1)
											{
												echo "<option value='$usermid2' selected>$usermfullname</option>";

											}else
											{
											 echo "<option value='$usermid2' >$usermfullname</option>";
											}

										}
									?>
									</select>
								</div>
								</div>
								
								
								<div class="form-actions">
									<div class="row">
										<div class="col-md-offset-3 col-md-9">
											<button type="submit" class="btn  green"><i class="fa fa-check"></i> Submit</button>
											
										</div>
									</div>
								</div>
								</div>
								
								</div>
								
								<div class="col-md-1">
								<span class="badge badge-warning badge-roundless">Holidays </span>
								<div>
								</div>
								</div>
					<?php } ?>
					<!----End Row---------->
					
					<!----Start Row-------->
					
					<div class="row">
						<!-------Top Customer-------->
						
						
						<div class="col-md-12 ">
						<!------------Start portlet----------------->
							
							<div class="row">
			<div class="col-md-12">
			<div class="portlet light portlet-fit bordered calendar">
			<div class="portlet-title">
			<div class="caption">
				<i class=" icon-layers font-green"></i>
				<span class="caption-subject font-green sbold uppercase">Calendar</span>
			</div>
			</div>
			<div class="portlet-body">
			<div class="row">

				<div class=" col-sm-12">
						<div id="calendar" class="has-toolbar"> </div>
				</div>
			</div>
			</div>
			</div>
			</div>
			</div>
			</div>
			</div>
			</div>
			</div>
			
						<!------------end portlet----------------->
						</div>	
						
						<!-------Top Customer-------->
						
						<!-------Top Supplier-------->
						<!-------Top Supplier-------->
					</div>
					<!----End Row---------->
					
					<!----Start Row---------->
					<!----End Row---------->
					
		 </div>
        <!-- END CONTAINER -->
		</div>
        <!-- BEGIN FOOTER -->
         <div class="page-footer">
            <div class="page-footer">
            <div class="page-footer-inner">&copy; Arth Technology

            </div>
            <div class="scroll-to-top">
                <i class="icon-arrow-up"></i>
            </div>
        </div>
        </div>
        <!-- END FOOTER -->
        <!--[if lt IE 9]>
<script src="../assets/global/plugins/respond.min.js"></script>
<script src="../assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
        <!-- BEGIN CORE PLUGINS -->
        <script src="../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
		<script src="../assets/global/plugins/counterup/jquery.counterup.min.js" type="text/javascript"></script>
        <!-- END CORE PLUGINS -->
        <!-- BEGIN THEME GLOBAL SCRIPTS -->
        <script src="../assets/global/scripts/app.min.js" type="text/javascript"></script>
        <!-- END THEME GLOBAL SCRIPTS -->


		  <script src="../assets/global/plugins/moment.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/morris/morris.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/morris/raphael-min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/counterup/jquery.waypoints.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/counterup/jquery.counterup.min.js" type="text/javascript"></script>


		<!-- ************************** -->


        <script src="../assets/global/plugins/flot/jquery.flot.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/flot/jquery.flot.resize.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/flot/jquery.flot.categories.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/jquery-easypiechart/jquery.easypiechart.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/jquery.sparkline.min.js" type="text/javascript"></script>
		<script src="../assets/pages/scripts/ui-toastr.min.js" type="text/javascript"></script>
		<script src="../assets/global/plugins/bootstrap-toastr/toastr.min.js" type="text/javascript"></script>

		 <!-- BEGIN PAGE LEVEL SCRIPTS -->
        <script src="../assets/pages/scripts/dashboard123.js" type="text/javascript"></script>
        <!-- END PAGE LEVEL SCRIPTS -->
        <!-- BEGIN THEME LAYOUT SCRIPTS -->
        <script src="../assets/layouts/layout/scripts/layout.min.js" type="text/javascript"></script>
        <script src="../assets/layouts/layout/scripts/demo.min.js" type="text/javascript"></script>
        <script src="../assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
        <!-- END THEME LAYOUT SCRIPTS -->
		<script type="text/javascript" src="js/notification.js"/></script>
		<script src="./fullcalendar.js" type="text/javascript"></script>
		<script src="../assets/global/plugins/select2/js/select2.full.min.js" type="text/javascript"></script>
		 
		<script src="../assets/pages/scripts/components-select2.min.js" type="text/javascript"></script>
<?php

if(isset($_SESSION['msg']))
{
	$tt = $_SESSION['msg'];
	echo "<input type=\"hidden\" id=\"mymsg\" value=\"$tt\"/>";
	unset($_SESSION['msg']);


?>

		<script lang="javascript">

var a = [
    function () {


		var mymsg = document.getElementById("mymsg").value;
		toastr.info(mymsg, "")

    },
    function () {
        $('span').show();
    },
    function () {
        $('p').fadeIn(100);
    }
];


a[0]();
</script>

<?php

}
?>
<script>
	$(document).ready(function(){

		$(document).on('click', '#getUser', function(e){

			e.preventDefault();

			var uid = $(this).data('id');   // it will get id of clicked row

			$('#dynamic-content').html(''); // leave it blank before ajax call
			$('#modal-loader').show();      // load ajax loader

			$.ajax({
				url: 'rejectremark.php',
				type: 'POST',
				data: 'id='+uid,
				dataType: 'html'
			})
			.done(function(data){
				console.log(data);
				$('#dynamic-content').html('');
				$('#dynamic-content').html(data); // load response
				$('#modal-loader').hide();		  // hide ajax loader
			})
			.fail(function(){
				$('#dynamic-content').html('<i class="glyphicon glyphicon-info-sign"></i> Something went wrong, Please try again...');
				$('#modal-loader').hide();
			});

		});

	});

</script>
<script>
 $(document).ready(function() {

			//alert("hi");


           // var date = new Date();
           // var d = date.getDate();
            //var m = date.getMonth();
			//var y = date.getFullYear();




			//alert("hi");


            var date = new Date();
            var d = date.getDate();
            var m = date.getMonth();
            var y = date.getFullYear();

            var h = {};

            if ($('#calendar').width() <= 400) {
                $('#calendar').addClass("mobile");
                h = {
                    left: 'title, prev, next',
                    center: '',
                    right: 'today,month,agendaWeek,agendaDay'
                };
            } else {
                $('#calendar').removeClass("mobile");
                if (App.isRTL()) {
                    h = {
                        right: 'title',
                        center: '',
                        left: 'prev,next,today,month,agendaWeek,agendaDay'
                    };
                } else {
                    h = {
                        left: 'title',
                        center: '',
                        right: 'prev,next,today,month,agendaWeek,agendaDay'
                    };
                }
            }




           // $('#calendar').fullCalendar('destroy'); // destroy the calendar
            $('#calendar').fullCalendar({ //re-initialize the calendar
                disableDragging: false,
                header: h,
                editable: true,
                events: [
				<?php
				if($_SESSION['usermtype'] == 'Staff'){
				$eve18 = "select * from res_task_master where  taskmid in (select taskmid from res_taskallocation_detail where allocatedtostaff='$usermid1') and taskmstatus != 'Pending for Acception' and  taskmstatus != 'Rejected'";
				}else{
					 $eve18 = "select * from res_task_master where  taskmid in (select taskmid from res_taskallocation_detail where allocatedtostaff='$usermid1') and taskmstatus != 'Pending for Acception' and  taskmstatus != 'Rejected' ";
				}
				$re18 = mysqli_query($conn, $eve18);
				while($rt18=mysqli_fetch_assoc($re18))
				{
					$taskmid=$rt18['taskmid'];
					$taskmcolorcoding=$rt18['taskmcolorcoding'];
					$taskmriority=$rt18['taskmriority'];
					$taskmcolorcoding1=strtolower($rt18['taskmcolorcoding']);
					$taskmtitle=$rt18['taskmtitle'];
					$taskmtasktypename=$rt18['taskmtasktypename'];
					$taskmstatus=$rt18['taskmstatus'];
                $taskmsceduledatetime=date("d-m-Y",strtotime($rt18['taskmsceduledatetime']));
					//$customer1="";

					//$tdesc=$rt14['tdesc'];
					//$ttitle=$rt14['ttitle'];
					//$tmstartdate=$rt14['tmstartdate'];
					//$tmenddate=$rt14['tmenddate'];

					
					//$time = date('g:i a', strtotime($hbookdattime));

				$d= date('d', strtotime($taskmsceduledatetime));
				$m= date('m', strtotime($taskmsceduledatetime));
				$y= date('Y', strtotime($taskmsceduledatetime));

				$fdate=implode('-', array_reverse(explode('-', $taskmsceduledatetime)));

				?>
				{
                    title: '<?php echo $taskmtitle; ?>',
                    start: new Date(<?php echo $y; ?>, <?php echo $m-1; ?>, <?php echo $d; ?>),
					
                    //backgroundColor: App.getBrandColor('<?php echo $taskmcolorcoding1; ?>'),
					<?php  if($taskmtasktypename == 'Meeting') { ?>
					 backgroundColor: '#702963',
					<?php } else if($taskmstatus == 'Overdue') { ?>
					 backgroundColor: '#C0C0C0',
					<?php  }else if($taskmstatus == 'Completed') { ?>
					 backgroundColor: 'green',
					<?php }else if($taskmriority == 1) {?>
                    backgroundColor: 'red',
				<?php }else if($taskmriority == 2) { ?>
					 backgroundColor: '#00008b',
				<?php }else if($taskmriority == 3) { ?>
					 backgroundColor: 'blue',
				<?php }else if($taskmriority == 4) { ?>
					 backgroundColor: '#E4D00A',
				<?php }else if($taskmriority == 5) { ?>
					 backgroundColor: '#e75480',
				<?php }else if($taskmriority == 6) { ?>
					 backgroundColor: 'pink',
				
				<?php } ?>
					 url: 'taskdetail.php?id=<?php echo $taskmid ?>&from=mytask'
				
										
                },
				<?php } ?>


				<?php
				
				$eve21 = "select * from res_holidays_master";
				$re21 = mysqli_query($conn, $eve21);
				while($rt21=mysqli_fetch_assoc($re21))
				{
					$holidaymid=$rt21['holidaymid'];
					$holidaymname=$rt21['holidaymname'];
					$holidaymdate=$rt21['holidaymdate'];

					//$tdesc=$rt14['tdesc'];
					//$ttitle=$rt14['ttitle'];
					//$tmstartdate=$rt14['tmstartdate'];
					//$tmenddate=$rt14['tmenddate'];

					$date1 = date('Y-m-d', strtotime($holidaymdate));
					$time1 = date('g:i a', strtotime($holidaymdate));

				$d= date('d', strtotime($date1));
				$m= date('m', strtotime($date1));
				$y= date('Y', strtotime($date1));



				?>
				{
										title: '<?php echo $holidaymname; ?>',
										start: new Date(<?php echo $y; ?>, <?php echo $m-1; ?>, <?php echo $d; ?>),
										backgroundColor: '#e56717',
										url: 'holidaylist.php'
								},
				<?php  }?>
				
				<?php
				if($_SESSION['usermtype'] == 'Staff'){
				$eve22 = "select * from res_leave_master where lmaddedby='$usermid1'";
				}else{
				$eve22 = "select * from res_leave_master where lmaddedby='$usermid1'";	
				}
				$re22 = mysqli_query($conn, $eve22);
				while($rt22=mysqli_fetch_assoc($re22))
				{
					$lmid=$rt22['lmid'];
					$usermid2=$rt22['lmaddedby'];
					$lmtype=$rt22['lmtype'];
					$query2 = "select usermfullname from res_user_master where usermid=:usermid1";
                $stmt2 = $db7->prepare($query2);
                $stmt2->bindValue(':usermid1', "$usermid2");
                $stmt2->execute();
                $usermfullname="";
                if ($stmt2->rowCount() > 0)
                {
                    while($rt3 = $stmt2->fetch(PDO::FETCH_ASSOC))
                    {
						 $usermfullname=$rt3['usermfullname'];
                    }
                }
					$lmdate=$rt22['lmdate'];

					//$tdesc=$rt14['tdesc'];
					//$ttitle=$rt14['ttitle'];
					//$tmstartdate=$rt14['tmstartdate'];
					//$tmenddate=$rt14['tmenddate'];

					$date2 = date('Y-m-d', strtotime($lmdate));
					$time2 = date('g:i a', strtotime($lmdate));

				$d= date('d', strtotime($date2));
				$m= date('m', strtotime($date2));
				$y= date('Y', strtotime($date2));



				?>
				{
										<?php if($lmtype == 0){ ?>
										title: 'On Leave',
										<?php }else if($lmtype == 0){ ?>
										title: 'First Half  Leave',
										<?php }else{ ?>
										title: 'Second Half Leave',
										<?php } ?>
										start: new Date(<?php echo $y; ?>, <?php echo $m-1; ?>, <?php echo $d; ?>),
										backgroundColor: 'maroon',
										 <?php if($_SESSION['usermtype'] == 'Staff') {?>
										   url: 'requestforleave.php'
										   
											
										<?php }else{?>
											url: 'requestedleavelist.php'
										<?php } ?> 
										
								},
				<?php  }?>

				<?php
				if($_SESSION['usermtype'] == 'Staff'){
				$eve23 = "select * from res_rejectedtask_master where rejectedby ='$usermid1'";
				}else{
				$eve23 = "select * from res_rejectedtask_master where rejectedby ='$usermid1'";	
				}
				$re23 = mysqli_query($conn, $eve23);
				while($rt23=mysqli_fetch_assoc($re23))
				{
					$taskmid=$rt23['taskmid'];
					$rejectedby =$rt23['rejectedby'];
					
					$query3 = "select taskmtitle,taskmsceduledatetime from res_task_master where taskmid=:taskmid";
                $stmt3 = $db7->prepare($query3);
                $stmt3->bindValue(':taskmid', "$taskmid");
                $stmt3->execute();
                $taskmtitle="";
                if ($stmt3->rowCount() > 0)
                {
                    while($rt3 = $stmt3->fetch(PDO::FETCH_ASSOC))
                    {
						 $taskmtitle=$rt3['taskmtitle'];
						 $taskmsceduledatetime=$rt3['taskmsceduledatetime'];
                    }
                }
					$rejecteddate =$rt23['rejecteddate'];

					//$tdesc=$rt14['tdesc'];
					//$ttitle=$rt14['ttitle'];
					//$tmstartdate=$rt14['tmstartdate'];
					//$tmenddate=$rt14['tmenddate'];

					$date2 = date('Y-m-d', strtotime($taskmsceduledatetime));
					$time2 = date('g:i a', strtotime($taskmsceduledatetime));

				$d= date('d', strtotime($date2));
				$m= date('m', strtotime($date2));
				$y= date('Y', strtotime($date2));



				?>
				{
										
										title: '<?php echo $taskmtitle; ?>',
										
										start: new Date(<?php echo $y; ?>, <?php echo $m-1; ?>, <?php echo $d; ?>),
										backgroundColor: '#26734d',
										 
										   url: 'taskdetail.php?id=<?php echo $taskmid ?>'
										   
											
										
										
								},
				<?php  }?>






				{
                    title: 'a',
                    start: new Date(1984, 1, 1),
                    end: new Date(1984, 1, 1),
                    backgroundColor: App.getBrandColor('yellow'),
                    url: 'http://google.com/'
                }]
            });


});
</script>		

<?php mysqli_close($conn); ?>
</body>
</html>
