<?php
	include "db_connection/db_connection.php";
	include "config/config.php";
	
	if($_SESSION['admin_login_id'] == '')
	{
		echo "<script>window.location='index.php';</script>";
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title><?php echo $PROJECT_TITLE ?></title>

<script type="text/javascript" src="js/party_add_JS.js"></script>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<!--[if IE]> <link href="css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>

<script type="text/javascript" src="js/plugins/forms/ui.spinner.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.mousewheel.js"></script>
 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

<script type="text/javascript" src="js/plugins/charts/excanvas.min.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.orderBars.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.pie.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.resize.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.sparkline.min.js"></script>

<script type="text/javascript" src="js/plugins/tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/plugins/tables/jquery.sortable.js"></script>
<script type="text/javascript" src="js/plugins/tables/jquery.resizable.js"></script>

<script type="text/javascript" src="js/plugins/forms/autogrowtextarea.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.uniform.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.inputlimiter.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.maskedinput.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.autotab.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.chosen.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.dualListBox.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.cleditor.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.ibutton.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validationEngine.js"></script>

<script type="text/javascript" src="js/plugins/uploader/plupload.js"></script>
<script type="text/javascript" src="js/plugins/uploader/plupload.html4.js"></script>
<script type="text/javascript" src="js/plugins/uploader/plupload.html5.js"></script>
<script type="text/javascript" src="js/plugins/uploader/jquery.plupload.queue.js"></script>

<script type="text/javascript" src="js/plugins/wizards/jquery.form.wizard.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.validate.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.form.js"></script>

<script type="text/javascript" src="js/plugins/ui/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.breadcrumbs.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.tipsy.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.progress.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.colorpicker.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.jgrowl.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fancybox.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fileTree.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.sourcerer.js"></script>

<script type="text/javascript" src="js/plugins/others/jquery.fullcalendar.js"></script>
<script type="text/javascript" src="js/plugins/others/jquery.elfinder.js"></script>

<script type="text/javascript" src="js/plugins/ui/jquery.easytabs.min.js"></script>
<script type="text/javascript" src="js/files/bootstrap.js"></script>
<script type="text/javascript" src="js/files/functions.js"></script>

<script type="text/javascript" src="js/charts/chart.js"></script>
<script type="text/javascript" src="js/charts/hBar_side.js"></script>

<!-- Shared on MafiaShare.net  --><!-- Shared on MafiaShare.net  --></head>

<body onload="document.getElementById('listpage').focus();">

<!-- Top line begins -->
<?php include "header_footer/header.php"; ?>
<!-- Top line ends -->


<!-- Sidebar begins -->
<?php include "menus/left_menu.php"; ?>
<!-- Sidebar ends -->
    
    
<!-- Content begins -->
<div id="content">
    
<?php include "menus/top_menu.php"; ?>    
    <!-- Breadcrumbs line -->
    <div class="breadLine">
        <div class="bc">
            <ul id="breadcrumbs" class="breadcrumbs">
                <li><a href="#">Dashboard</a></li>
                <li><a href="javascript:">Login Details</a></li>
                <li><a href="javascript:">Employee Log List</a></li>    
            </ul>
        </div>
	<?php include "menus/top_left_menu.php"; ?>            
        
    </div>
    
    <!-- Main content -->
    <div class="wrapper">
    
        <ul class="middleNavR">
            <!--<li><a href="#" title="Add an article" class="tipN"><img src="images/icons/middlenav/create.png" alt="" /></a></li>
            <li><a href="#" title="Upload files" class="tipN"><img src="images/icons/middlenav/upload.png" alt="" /></a></li>-->  
       		<!--<li><a href="party_add.php" title="Add Party" id="addpage" class="tipN"><img src="images/icons/middlenav/add.png" alt="" /></a></li>-->
            <!--<li><a href="#" title="Messages" class="tipN"><img src="images/icons/middlenav/dialogs.png" alt="" /></a><strong>8</strong></li>
            <li><a href="#" title="Check statistics" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>-->
            <!--<li><a href="login_det_list.php" id="listpage" title="List Login Details" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>-->
             <li><a href="login_det_list.php" title="Login Deatails List" id="addpage" class="tipN"><img src="images/new_login.png" alt="" style="margin-top:-20px" /></a></li>
          <li><a href="login_det_pwd_change.php" title="Change Password" id="addpage" class="tipN"><img src="images/chng_pwd.png" style="margin-top:-20px" /></a></li>
		  <li><a href="login_log_list.php" title="Client & Admin Log List" id="addpage" class="tipN"><img src="images/icons/mainnav/log_list.png" /></a></li>
		  <li><a href="guest_login_log_list.php" title="Guest Log List" id="addpage" class="tipN"><img src="images/icons/mainnav/guest_user.png" /></a></li>
          <li><a href="emp_login_log_list.php" title="Employee Log List" id="addpage" class="tipN"><img src="images/icons/mainnav/emp_hk.png" style="margin-top:-20px" /></a></li>
    	</ul>            
    
    	<!-- Chart --><!-- 6 + 6 -->

    	<div class="widget"> <!--style="width:600px; margin-left:150px;"-->
        <div class="whead"><h6>Employee Log List</h6><div class="clear"></div></div>
        <div id="dyn" class="hiddenpars">
        	<a href="javascript:0" id="searchlink" onfocus="foc(this.id)" onblur="stnon(this.id)" class="tOptions" title="Options"><img src="images/icons/options.png" alt="" /></a>
            <table width="819" border="0" cellpadding="0" cellspacing="0" class="dTable" id="dynamic">
                <thead>
                    <tr>
                        <th width="30">S.No<span class="sorting" style="display: block;"></span></th>
                        <th width="68">Emp Status </th>
                        <th width="130">Employee Name</th>
                        <th width="121">Login Time</th>
                        <th width="91">Logout Time</th>
                        <th width="86">Total Time</th>
                    </tr>
                </thead>
            <tbody>
            <?php
			$SLCT = "SELECT * FROM login_log WHERE designation='employee' ORDER BY login_log_id DESC";
			//echo $SLCT;
			$QURY = mysqli_query($connect,$SLCT);
			$loop=1;
			if(mysqli_num_rows($QURY)>0)
			{			
			while($FTCH = mysqli_fetch_object($QURY))
			{
				$sts = ($FTCH->update_dt=='0000-00-00 00:00:00')?"<b><font color='#00CC00'>Online</font></b>":"Offline"; 
				
				$now = new DateTime($FTCH->post_dt);
				$ref = new DateTime($FTCH->update_dt);
				$diff = $now->diff($ref);
				
				$SLCTp = "SELECT * FROM login_details,emp_det WHERE emp_det.emp_det_id = login_details.emp_det_id AND login_details.admin_id = '$FTCH->admin_id'";				
				$QURYp = mysqli_query($connect,$SLCTp);
				$FTCHp = mysqli_fetch_object($QURYp);
				
				if($loop%2 != "0")
					$bg = "gradeX";
				else
					$bg = "class='gradeC'";
				?>
				<tr <?php echo $bg ?>>
				<td align="center"><?php echo $loop ?></td>
				<td align="center"><?php echo $sts; ?></td>
				<td align="center"><?php echo $FTCHp->name; ?></td>
				<td align="center"><?php echo $FTCH->post_dt; ?></td>
				<td class="center"><?php echo $FTCH->update_dt; ?></td>
				<td class="center" align="center"><?php if($FTCH->update_dt=="0000-00-00 00:00:00"){ echo "Till Now"; }else{ printf('%d Hrs ,%d Mts', $diff->h, $diff->i); } ?></td>
				</tr>            
            	<?php
				$loop ++;
			 }
			 }
			 ?>
            </tbody>
          </table> 
        </div>
        </div>    
        
        <div class="fluid"><!-- Media table --></div>
        
        
        
    </div>
    <!-- Main content ends -->
    
</div>
<!-- Content ends -->
<?php /*?><?php include "header_footer/footer.php"; ?><?php */?>
</body>
</html>
