<?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="candidate_listjobs";	
$adjacents = 10;
$query = mysql_query("SELECT  * FROM $tbl_name where candidate_id='".$can_id."'");
$total_pages = mysql_num_rows($query);
$targetpage = "myapplication"; 	//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."' 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">
				<?php /*added breadcrumbs*/ ?>
                <div class="section-welcome nav-welcome" style="margin-bottom:0px;">
                	<ol class="breadcrumb">
                      <li><a href="<?php echo base_url();?>front_end/candidate_dashboard?looking_for_data=looking_for_data">Dashboard</a></li>
                      <li><a href="<?php echo base_url();?>front_end/myapplication">My Applications</a></li>
                    </ol>
                    <a class="menubtn" href="#"><i class="fa fa-bars"></i></a>
                </div>
                    <div class="profile-wrap margin-top-30" style="margin-top:0px !important;">
                        <div class="row">
                        <div class="col-sm-12" >
                                <div class="tab-content" style="padding-left:0px;">

								<div class="table-responsive" style="overflow:hidden;">
								<p style="color:#FF0000;"> <?php echo $this->session->flashdata('short_list');?></p>
                                	<div class="activity-reports-section recruiters" style="margin-bottom:20px;">
                    	<h3>You have <?php echo $number_wew;?> job application(s)</h3>
                    </div>
		   <div class="tab-recruiter margin-top-45 mobile-space" style="margin-top: 0px !important;">
                            <table width="100%" class="table">
                                  <thead>
                                    <tr>
                                      <th style="width: 280px;text-align:center;">Job Details</th>
                                     <th style="text-align:center;">Job Location</th>
									 <th style="text-align:center;">Job Type</th>
									 <th style="text-align:center;">Date</th>
                                    </tr>
                                  </thead>
                                  <tbody>

<?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);
$sle_currency=mysql_query("select * from currency where skill_id='".$currency_valu."'");
$rowcurrency=mysql_fetch_array($sle_currency);
$currency=$rowcurrency['skill_code'];
	?>
<tr>
<td style="width: 26%;">
<a style="color:#cd0329;" 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>
<td style="text-align:center;">
<?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']
	?>
	</td>
	<td style="text-align:center;">
	<?php if($fetch_jobs_data['job_type']==5){ echo "Full Time";}?>
		 <?php if($fetch_jobs_data['job_type']==4){ echo "Part Time";}?>
		 <?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']==1){ echo "Volunteer";}?>
		 <?php if($fetch_jobs_data['job_type']==1){ echo "Permanent";}?>
		<?php if($fetch_jobs_data['job_type']==6){ echo "Other";}?>
                                      </td>
									  
                                      <td style="text-align:center;">
									    <?php 
								$date_get=$row['date'];
								$datearray=explode("-", $date_get);
								$year=$datearray[0];
								$month=$datearray[1];
								$day=$datearray[2];
								$orginal_date=$month."-".$day."-".$year;
								echo $orginal_date;
			 				  ?>
									  
									  </td>
                                      
                                    </tr>
									  <?php }
									  
									  }

	 else
	 {?>
	  <tr>
	  <td style="font-size:11px; font-family:Segoe UI;width: 23%;">
	  <h3 style="color:#aeaeae;    font-size: 18px;">No jobs found.</h3></td>
	  <td></td>
	  <td></td>
	<td></td>
		   </tr>
	 <?php }
	 ?>
	   <tr>
      <td height="28" colspan="4"><?=$pagination?></td></tr>
                                  </tbody>
                            </table>

                        </div>



	  </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>

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