<? include("si_confi.php"); ?>
<? include("ad_head.php"); ?>
  <div class="container">
<? include("mn_option.php");


if($_REQUEST['action']=='trsh')
{
	$get_emp_id=base64_decode($_REQUEST['isd']);
	$get_filename=base64_decode($_REQUEST['flname']);
	unlink("$get_filename");
	
	mysql_query("delete from `certificate_mng` where `id`='$get_emp_id'");
	?><script>window.location="viw_certfi.php?del=suc";</script><?
}
 ?>

<? if($_REQUEST['ed']=='suc'){ ?>
  <div class="success" style="width:92%;margin:0 auto;margin-top:9px;">Changes saved successfully.</div><? } ?>
  <? if($_REQUEST['del']=='suc'){ ?>
  <div class="error" style="width:92%;margin:0 auto;margin-top:9px;">One Details Deleted successfully.</div><? } ?>
  
  
<?
$select_count_emp=mysql_query("select count(*) as num from `certificate_mng`");
$fetch_count_emp=mysql_fetch_array($select_count_emp);
$total_emp_result=$fetch_count_emp['num'];
 ?>
   <div style="border:groove;margin-top:10px;border-width:thin;padding:20px;border-radius:4px;border-color:#cccccc;box-shadow: 10px 9px 90px #000;">
   <h2>View Certificates&nbsp;&nbsp;&nbsp;(Total&nbsp;:&nbsp;<? echo $total_emp_result; ?>)</h2>
   
  
    <table width="100%" cellpadding="9" cellspacing="0" border="1">
  <tr bgcolor="#CCCCCC">
  <td>EMP ID</td>
  <td>EMP Name</td>
  <td>File</td>
  <td>Title</td>
  <td>Edit</td>
  <td>Delete</td>
  </tr>
  <? $select_employee_details=mysql_query("select * from `certificate_mng`");
  while($fetch_employee_details=mysql_fetch_array($select_employee_details)){
	  
	  $empid_id=$fetch_employee_details['emp_id'];
	  
	  $select_empname=mysql_query("select * from `employee_mng` where `emp_id`='$empid_id'");
	  $fetchemployeename=mysql_fetch_array($select_empname); ?>
  <tr bgcolor="#FFFFFF">
  <td><? echo ucwords($fetch_employee_details['emp_id']); ?></td>
  <td><? echo ucwords($fetchemployeename['name']); ?></td>
  <td><a href="<? echo $fetch_employee_details['filen'] ?>" target="_blank"><img src="ad_img/pdf-icon.png"></a></td>
  <td><? echo ucwords($fetch_employee_details['title']); ?></td>
  <td><a href="edit_certfi.php?isd=<? echo base64_encode($fetch_employee_details['id']); ?>"><img src="ad_img/edit-male-user-icon.png" width="40"></a></td>
  <td><a href="viw_certfi.php?isd=<? echo base64_encode($fetch_employee_details['id']); ?>&&action=trsh&&flname=<? echo base64_encode($fetch_employee_details['filen']) ?>" onClick="return confirm('Are you sure you want to confirm delete?');"><img src="ad_img/Remove-Male-User.png" width="40"></a></td>
  </tr>
  <? } ?>
  <script type="text/javascript">
function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=580,width=700,left=140,top=60,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
  </table>  
  </div>
</div><!-- container -->
  </body>
</html>