<?php 
$this->load->view('header_front');
$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 = 15;

$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);
?>

<div class="container main-content">
  <div class="row">
    <div class="col-xs-12 col-sm-12 col-md-8">
      <h1 itemprop="name">Saved Jobs </h1>
      <div class="panel panel-default">
        <div class="panel-body">
          
		  <?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);
$currency_value=$fetch_jobs_data['currency'];
if($fetch_jobs_data['perday']==1)
{
$perday='Per Day';
}
if($fetch_jobs_data['perday']==2)
{
$perday='Per Week';
}
if($fetch_jobs_data['perday']==3)
{
$perday='Per Annum';
}
$sle_currency=mysql_query("select * from currency where skill_id='".$currency_value."'");
$rowcurrency=mysql_fetch_array($sle_currency);
$currency=$rowcurrency['skill_code'];
?>
		  <div class="jobs" style="position: relative; height: 301px;">
		  
		  
		  
		  <a href="<?php echo base_url();?>front_end/jobdetails?job_id=<?php echo $fetch_jobs_data['job_id'];?>" class="ad-detail-link adbox" data-job-id="605028" target="_blank" data-offset="-1" data-source="web-jobfeed" style="position: absolute; left: 0px; top: 0px;">
            <div class="job-post">
              <div class="row">
                <div class="col-sm-2 hidden-xs"><img src="<?php echo base_url();?>assets/upload/<?php echo $fetch_jobs_data['comapny_image'];?>" alt="<?php echo $fetch_jobs_data['company_name']; ?>" class="img-coylogo img-responsive">
				
									    
				</div>
                <div class="col-xs-12 col-sm-10">
                  <h2 class="hidden-xs"><?php echo $fetch_jobs_data['job_title'];?></h2>
			   <h2 class="hidden-xs" style="font-size:15px;font-weight: normal;"><?php
									  $fulldet=strip_tags($fetch_jobs_data['job_des']);
									  $desvarib=substr($fulldet,0,200);
									  echo $desvarib;
										?></h2>
              <h2 class="visible-xs"> <?php echo $fetch_jobs_data['job_title'];?></h2>
              <p class="visible-xs"><?php
									  $fulldet=strip_tags($fetch_jobs_data['job_des']);
									  $desvarib=substr($fulldet,0,200);
									  echo $desvarib;
										?></p>
                  <ul class="list-unstyled job-tag">
                    <li><span class="glyphicon glyphicon-map-marker"></span>&nbsp; 
                              <?php

echo $fetch_jobs_data['job_location_id'].' '."-".' '.$fetch_jobs_data['city'];
?></li>
                    <li><span class="glyphicon glyphicon-tags"></span>&nbsp; <?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']==7){ echo "Permanent";}?>
												<?php if($fetch_jobs_data['job_type']==6){ echo "Other";}?>  </li>
                    <li class="hidden-xs"><span class="glyphicon glyphicon-calendar"></span>&nbsp; 				   <?php 

if($fetch_jobs_data['job_shift']==1 && $fetch_jobs_data['job_shift']!=0)
{
echo "First Shift (Day)";
}
if($fetch_jobs_data['job_shift']==2 && $fetch_jobs_data['job_shift']!=0)
{
echo "Night Shift (Night)";
}
?> </li>
                  </ul>
                  <div class="row jobcoy">
                    <div class="col-xs-3 visible-xs">
                      <div class="coylogo-holder"><img src="<?php echo base_url();?>assets/upload/<?php echo $fetch_jobs_data['comapny_image'];?>" alt="<?php echo $fetch_jobs_data['company_name']; ?>" class="img-coylogo img-responsive"></div>
                    </div>
                    <div class="col-xs-9 col-sm-9">
                      <p class="coyinfo"><span class="visible-xs"><span class="glyphicon glyphicon-usd"></span>&nbsp; <span class="salmin"><?php echo 'From:'.' '.$currency.' '.$fetch_jobs_data['job_salary_from'].' ,'.' '.'To:'.' '.$currency.' '.$fetch_jobs_data['job_salary_to'].' '.$perday;?> </span><span class="hidden-xs"><span class="glyphicon glyphicon-user"></span>&nbsp; <strong><?php echo $fetch_jobs_data['company_name']; ?></strong></span><span class="visible-xs"><span class="glyphicon glyphicon-user"></span>&nbsp; <strong><?php echo $fetch_jobs_data['company_name']; ?></strong></span><br class="hidden-xs">
                        <span class="glyphicon glyphicon-time"></span>&nbsp; 
                        Posted On <?php 
								$date_get=$fetch_jobs_data['date'];
								$datearray=explode("-", $date_get);
								$year=$datearray[0];
								$month=$datearray[1];
								$day=$datearray[2];
								$orginal_date=$month."-".$day."-".$year;
								echo $orginal_date;
			 				  ?>  </p>
                    </div>
                    <div class="col-sm-3 col-md-3 job-salary hidden-xs" style="width:67%"><span class="salmin"><?php echo 'From:'.' '.$currency.' '.$fetch_jobs_data['job_salary_from'].' ,'.' '.'To:'.' '.$currency.' '.$fetch_jobs_data['job_salary_to'].' '.$perday;?></span></div>
                  </div>
                </div>
              </div>
            </div>
            </a>
			
			<br /><br />
				<button style="color:#000000;    position: relative;
    top: 77px;" class="btn btn-transparent remove-experience" onclick="var tmp=confirm('Are you sure you want to remove this?'); if (tmp){window.location='<?php echo base_url();?>front_end/delete_shortlistjob?id=<?php echo $fetch_jobs_data['job_id'];?>';}"><span class="glyphicon glyphicon-trash"></span>&nbsp; remove</button><br /><br />
				
				<button style="color:#000000;position: relative;top: 71px;" class="btn btn-transparent remove-experience" onclick="var tmp=confirm('Are you sure you want to apply for this job?'); if (tmp){window.location='<?php echo base_url();?>front_end/appl_job1?job_id=<?php echo $fetch_jobs_data['job_id'];?>';}"><span class="glyphicon"></span>&nbsp; Apply Now</button>
			
            
          </div>
		  
		   <?php }
									  
									  }

	 else
	 {?>
	  <p style="font-size:11px; font-family:Segoe UI;width: 23%;">
	  <h3 style="color:#aeaeae;font-size: 18px;">No jobs found.</h3></p>
	 <?php }
	 ?>
       <?=$pagination?>  
        </div>
      </div>
      <br>
	  
    </div>
    <!-- sidebar -->
    
	<?php $this->load->view('frontleftbar'); ?>
    <!-- /.sidebar -->
  </div>
</div>

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