<?php 	include_once('../../config.php');
		 
?>  
<?php  include ABS_PATH.'/admin/header.php';	?>  

<script>
function del_record(val)
{

	var r = confirm("Do you really want to delete record !");
	if (r == true) {    
	$.ajax({
	type: 'POST',
	url: "../ajax/default.php",
	//async: false,			 
	data: {delLive:1,val:val},	  
	success: function(ajaxresult){	     
		location.reload();	 	
	},
	error: function(XMLHttpRequest, textStatus, errorThrown) { 
	alert('Error');
	}
	});
	
	}	
	
}

</script>
		 
		<div class="col-md-10">  
  			<div class="content-box-large">
  				<div class="panel-heading">
					<div class="panel-title"><h3> Live Results</h3></div>
					
					<div align="right">  <input type="button"    class="btn btn-warning" name="btnback" id="btnback" value=" Add New Result " onClick="javascript:location.href='add.php';" />
					</div> 
					
				</div>
				
  				<div class="panel-body">
  					<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
						<thead>
							<tr>
								<th>Sr</th>  
								<th>Name</th> 
								<th>Disply Time</th>
								<th>System  Time</th> 
								<th>Action</th> 
								 
							</tr>
						</thead>
						<tbody>
							<?php
							
						          $type = $_SESSION['type'];
			                      $adminId = $_SESSION['adminId'];
								  $result = mysql_query("select * from live_result where is_active=1 order by priority");
								   
								  $sr=1;
								  while($row = mysql_fetch_object($result))
								  {
								      
								      
								      $openTT=explode(":",$row->open_time);
								      $openTT1=sprintf("%02d", $openTT[0]);
								      $openTT2=sprintf("%02d", $openTT[1]);
								      $final_openTime=$openTT1.":".$openTT2;
								      
								      $closeTT=explode(":",$row->close_time);
								      $closeTT1=sprintf("%02d", $closeTT[0]);
								      $closeTT2=sprintf("%02d", $closeTT[1]);
								      $final_closeTime=$closeTT1.":".$closeTT2;
								      
								      if($row->sactive==1) 
								      {
    								      $sOpentTT=explode(":",$row->sOpent); 
    								      $sOpent1=sprintf("%02d", $sOpentTT[0]);
    								      $sOpent2=sprintf("%02d", $sOpentTT[1]);
    								      $sOpent=$sOpent1.":".$sOpent2;
    								      
    								      $scloseTT=explode(":",$row->sCloset);
    								      $scloseTT1=sprintf("%02d", $scloseTT[0]);
    								      $scloseTT2=sprintf("%02d", $scloseTT[1]);
    								      $sCloset=$scloseTT1.":".$scloseTT2;
								      }else {
								        $sOpent = '';
								        $sCloset = '';
								      }
								      
								      
							?>
							<tr class="odd gradeX">
								<td><?php echo $sr++;?> </td>  
								<td><?php echo  $row->name;?> </td> 
								<td><?php echo  $row->tim;?> </td> 
								<td><?php echo  $final_openTime." & ".$final_closeTime;//$row->open_time." & ".$row->close_time;?> </td>
								 
							
								<td class="center" ><a   href="edit.php?id=<?php echo $row->id;?>"> <img src="<?php echo ADMINPATH;?>/images/edit_detail.jpg" title="Edit Record"/></a>  <a   href="javascript:void(0)" onclick="del_record(<?php echo $row->id;?>)"> <img src="<?php echo ADMINPATH;?>/images/delete_icon.png" title="Delete Record"/></a></td> 
							</tr>  
							<?php } ?>
						</tbody>
					</table>
  				</div>
  			</div>



		  </div>
		</div>
    </div>  
<?php  include ABS_PATH.'/admin/footer.php';	?>    