<?php $this->load->view('header_frontinner');
 $this->load->view('security_front'); 
//code for to get web logo			
//error_reporting(0);
$can_id=$this->session->userdata('user_id');
$tbl_name="shot_listjob";	
$adjacents = 10;
$query = mysql_query("SELECT  * FROM $tbl_name where candidate_id='".$can_id."' AND apply_status=0 ORDER BY exp_date asc");
$total_pages = mysql_num_rows($query);
$targetpage = "shortlist"; 	//your file name  (the name of this file)
$limit = 15; 
if(isset($_GET['page'])!='')
{								//how many items to show per page
$page = $_GET['page'];
}
else
{
$page = 0;
}
if($page) 
{
$start = ($page - 1) * $limit; 			//first item to display on this page
}
else
{
$start = 0;								//if no page var is given, set start to 0
}
$sql = "SELECT * FROM $tbl_name where candidate_id='".$can_id."' AND apply_status=0 ORDER BY exp_date asc LIMIT $start, $limit";
$result = mysql_query($sql);
if ($page == 0) $page = 1;					//if no page var is given, default to 1.
$prev = $page - 1;							//previous page is page - 1
$next = $page + 1;							//next page is page + 1
$lastpage = ceil($total_pages/$limit);		//lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1;						//last page minus 1
$pagination = "";
if($lastpage > 1)
{	
$pagination .= "<div class=\"pagination\">";
if ($page > 1) 
$pagination.= "<ul>
                    	<li><a href=\"$targetpage?page=$prev\"> Previous</a></li>";
else
$pagination.= "<li><a href=\"$targetpage?page=$prev\">Previous</a></li>";	
if ($lastpage < 7 + ($adjacents * 2))	//not enough pages to bother breaking it up
{	
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</a></li>";
else
$pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</a></li>";					
}
}
elseif($lastpage > 5 + ($adjacents * 2))	//enough pages to hide some
{
if($page < 1 + ($adjacents * 2))		
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</a></li>";
else
$pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</a></li>";					
}
$pagination.= "<li><a href=\"$targetpage?page=$lpm1\">$lpm1</a><li>";
$pagination.= "<li><a href=\"$targetpage?page=$lastpage\">$lastpage</a></li>";		
}
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<li><a href=\"$targetpage?page=1\">1</a></li>";
$pagination.= "<li><a href=\"$targetpage?page=2\">2</a></li>";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</li></a>";
else
$pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</a></li>";					
}
$pagination.= "<li><a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
$pagination.= "<li><a href=\"$targetpage?page=$lastpage\">$lastpage</a></li>";		
}
else
{
$pagination.= "<li><a href=\"$targetpage?page=1\">1</a></li>";
$pagination.= "<li><a href=\"$targetpage?page=2\">2</a></li>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</a></li>";
else
$pagination.= "<li><a href=\"$targetpage?page=$counter\">$counter</a></li>";					
}
}
}
if ($page < $counter - 1) 
$pagination.= "<li><a href=\"$targetpage?page=$next\">Next</a></li>";
else
$pagination.= "<li><a href=\"$targetpage?page=$next\">Next</a></li>";
$pagination.= "</ul></div>\n";		
}
$number_wew=mysql_num_rows($result);
?>
<form name="job_order_from" method="request" action="<?php echo base_url();?>front_end/joblisting"> 
<div class="inner-cntnts">
            	<div class="container">
				<div class="section-welcome nav-welcome">
                    <a class="menubtn" href="#"><i class="fa fa-bars"></i></a>
                </div>
                    <div class="profile-wrap margin-top-30">
                        <div class="row">
                        <div class="col-sm-12" >
                                <div class="tab-content">
								
								<div class="table-responsive">
								<p style="color:#FF0000;"> <?php echo $this->session->flashdata('short_list');?></p> 
          <table id="datatable-responsive" style="width: 100%;">
         <tbody>
		 <tr>
		   <td height="45" nowrap="" style="font-size:11px; font-family:Segoe UI;"><h3>You Have <?php echo $number_wew;?> Short List Jobs</h3></td>
		   <td align="center" style="width: 23%;"><strong>Exp Date</strong></td>
		   <td align="center">&nbsp;</td>
		   <td align="center">&nbsp;</td>
		   </tr>
		 <?php
if(mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_array($result))
{	

$sle_jobs=mysql_query("select * from njobn_jobdetails where job_id='".$row['job_id']."'");
$fetch_jobs_data=mysql_fetch_array($sle_jobs);	
	?>
<tr style="border-bottom:1px solid gray;">
         <td width="522" height="93" nowrap="" style="font-size:11px; font-family:Segoe UI;">
		  <div class="customer-service-section">
         <h4><i class="fa fa-star" aria-hidden="true"></i><a style="color:#cd0329;margin-left: 13px;" href="<?php echo base_url();?>front_end/jobdetails?job_id=<?php echo $fetch_jobs_data['job_id'];?>"><?php echo $fetch_jobs_data['job_title'];?></a> <a href="<?php echo base_url();?>front_end/delete_shortlistjob?id=<?php echo $fetch_jobs_data['job_id'];?>" class="link" onclick="return confirm('Are you sure?');" style="font-size: 14px;" ><i style="color:#CCCCCC!important;font-size:16px;" class="fa fa-trash-o" aria-hidden="true"></i></a></h4> 
		<span style="margin:2px 33px;color: #757575;"><?php
	$sel_cities=mysql_query("select * from cities where id='".$fetch_jobs_data['city']."'");
	$fethch_cities=mysql_fetch_array($sel_cities);
	echo $fethch_cities['name']
	?></span> </div> 
		<ul class="Permanent-section margin-top-45" style="margin-top: -3px !important;">
        <li style="margin:2px 33px;"><i class="fa fa-clock-o" aria-hidden="true"></i><?php if($fetch_jobs_data['job_type']==1){ echo "Permanent";}?>
								                 <?php if($fetch_jobs_data['job_type']==2){ echo "Contract";}?>
												 <?php if($fetch_jobs_data['job_type']==3){ echo "Temporary";}?>
												 <?php if($fetch_jobs_data['job_type']==4){ echo "Part Time";}
												 if($fetch_jobs_data['job_type']==5){ echo "Full Time";}?></li>
        </ul></td>
         <td width="38" align="center"><?php echo $row['exp_date'];?></td>
      <td width="96" align="center">&nbsp;</td>
      <td width="179" align="center">
	  						<?php
$sqlquery=mysql_query("SELECT * FROM  candidate_listjobs WHERE candidate_id='".$can_id."' and  job_id='".$fetch_jobs_data['job_id']."'");
											$count=mysql_num_rows($sqlquery);
											if($count > 0)
											{?>
											 <span>Applied for Job</span>
											<?php }
											else
											{
											?>
	  <div class="butten-bg margin-top-30 mobile-space"> <a href="<?php echo base_url();?>front_end/appl_job1?job_id=<?php echo $fetch_jobs_data['job_id'];?>" style="width: 171px;"><i class="fa" aria-hidden="true"></i>Apply Now</a>                        </div>
															<?php }?>	 </td>
      </tr>
     <?php }
	 }
	 else
	 {?>
	  <tr style="border-bottom:1px solid gray;">
		   <td height="45" colspan="4" nowrap="" style="font-size:11px; font-family:Segoe UI;"><h3 style="color:#FF0000;">No Jobs Founds</h3></td>
		   </tr>
	 <?php }
	 ?>
	  <tr>
      <td height="28" colspan="4"><?=$pagination?></td>
      </tr>
      </tbody></table>
	  </div>
                            </div>
                        </div>
                    </div>
                    
                </div>
            </div>
        </div>

         
					</form>
        </div>
<?php $this->load->view('footer_front'); ?>