<?php ini_set('display_errors', 0); ?>
<div class="header">
        <div class="pull-left">
            <div class="logo"> <img src='assets/images/logo.png' height='40'/></div>
            <div class="hamburger sidebar-toggle">
                <span class="line"></span>
                <span class="line"></span>
                <span class="line"></span>
            </div>
        </div>
        <div class="pull-right p-r-15">
            <ul>
			  <?php if ($user_type==1){ ?>
				  <li class="header-icon dib"><a href="#search"><i class="ti-search"></i></a></li>
				  <li class="header-icon dib"><a href="logs.php"><i class="ti-star"></i></a></li>
				  <li class="header-icon dib"><a href="delivery_status.php?mode=booking"><i class="ti-package"></i></a></li>
				   <li class="header-icon dib"><a href="pr_meeting.php"> <i class="ti-alarm-clock"></i> </a></li>
				    <li class="header-icon dib"><a href="pr_events.php?type=export"> <i class="ti-pinterest"></i> </a></li> 
				<li class="header-icon dib"><a href="sp_meeting.php">  <i class="ti-write"></i> </a></li>
				    <li class="header-icon dib"><a href="sp_events.php?type=export"> <i class="ti-skype"></i> </a></li> 
					<li class="header-icon dib"><a href="add_approx_event.php"> <i class="ti-layout-grid3"></i> </a></li>
					
			  <?php } ?>
				
				
				
				
				<?php
				
				
				if ($user_type==3){ 
				
				$notiSQL = mysqli_query($connection, "SELECT t1.*,t2.diary_of FROM vd_edit as t1 left join events as t2 on t1.event_id=t2.id WHERE t1.editor ='$ad_id' AND t1.status!='checked' order by t1.date desc limit 1 ");
$notiSQL = mysqli_fetch_object($notiSQL);
				
				
				$noti_date = $notiSQL->date;
				 $noti_title = $notiSQL->diary_of;
				 $noti_sub = $notiSQL->remarks;
				
				$notiSQL = mysqli_query($connection, "SELECT count(t1.id) as pending FROM vd_edit as t1 left join events as t2 on t1.event_id=t2.id WHERE t1.editor ='$ad_id' AND t1.status!='checked' order by t1.date desc ");
$notiSQL = mysqli_fetch_object($notiSQL);

				
				$number=$notiSQL->pending;
				$notification=$number." pending video";
				$link="assignments_video.php";
				}
				
				if ($user_type==2){ 
				
				$notiSQL = mysqli_query($connection, "SELECT t1.*,t2.diary_of FROM photo_edit as t1 left join events as t2 on t1.event_id=t2.id WHERE (t1.status!='checked' OR t1.ph_sp_status!='checked') AND ( t1.editor='$ad_id' OR t1.sp_editor='$ad_id' ) order by t1.date desc limit 1 ");
$notiSQL = mysqli_fetch_object($notiSQL);
				
				
				$noti_date = $notiSQL->date;
				 $noti_title = $notiSQL->diary_of;
				 $noti_sub = $notiSQL->remarks;
				
				$notiSQL = mysqli_query($connection, "SELECT count(t1.id) as pending FROM photo_edit as t1 left join events as t2 on t1.event_id=t2.id WHERE t1.status!='checked'  AND t1.editor='$ad_id' order by t1.date desc ");
$notiSQL = mysqli_fetch_object($notiSQL);
				$number=$notiSQL->pending;
				
				$notiSQL = mysqli_query($connection, "SELECT count(t1.id) as pending FROM photo_edit as t1 left join events as t2 on t1.event_id=t2.id WHERE  t1.ph_sp_status!='checked' AND t1.sp_editor='$ad_id' order by t1.date desc ");
$notiSQL = mysqli_fetch_object($notiSQL);
				$number1=$notiSQL->pending;
				$number=$number+$number1;
				$notification=$number." pending project";
				$link="assignments_photo.php";
				}
				
				if ($user_type==1){
$first_day_this_month = date('m-01-Y');
$notiSQL = mysqli_query($connection, "SELECT * FROM `notifications` where status=1 order by added_at desc limit 1 ");
$notiSQL = mysqli_fetch_object($notiSQL);
				
				
				$noti_date = $notiSQL->added_at;
				 $noti_title = $notiSQL->details;
				 $noti_sub = "Mark Read Now";

				
				$notiSQL = mysqli_query($connection, " SELECT count(id) unread FROM `notifications` where status=1");
$notiSQL = mysqli_fetch_object($notiSQL);

		$unread=$notiSQL->unread;
				
				
				
				$number=$unread;
				
				$notification=$number." notification unread";
				$link="notifications.php";
				
				}
				?>
				
				
				
				
				
				<?php if ($user_type!=4){ ?>
				
				
                <li class="header-icon dib"><i class="ti-bell"></i><span class="badge badge-warning"><?php echo $number; ?></span> 
                    <div class="drop-down">
                        <div class="dropdown-content-heading">
                            <span class="text-left"><?php echo $notification; ?></span>
                        </div>
                        <div class="dropdown-content-body">
                            <ul>
                                <li>
                                    <a href="<?php echo $link; ?>">
                                     
                                        <div class="notification-content">
										
										
                                            <small class="notification-timestamp pull-right"><?php echo $noti_date; ?></small>
                                            <div class="notification-heading"><?php echo $noti_title; ?></div>
                                            <div class="notification-text"><?php echo $noti_sub; ?> </div>
                                        
										
										
										</div>
                                    </a>
                                </li>
                               
                                <li class="text-center">
                                    <a href="<?php echo $link; ?>" class="more-link">See All</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </li>
			
				<?php } ?>
                <li class="header-icon dib"><?php echo $row->email; ?> <i class="ti-angle-down f-s-10"></i></span>
                    <div class="drop-down dropdown-profile">
                        <div class="dropdown-content-body">
                            <ul>
                                  <li><a href="change_pass.php"><i class="ti-settings"></i> <span>Change Password</span></a></li>
                                <li><a href="logout.php"><i class="ti-power-off"></i> <span>SignOut</span></a></li>
                            </ul>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>