<?php 
if (! defined('BASEPATH')) exit('No direct script access allowed');
class front_end extends CI_Controller 
{
public function __construct()
{
parent::__construct();
$this->load->model('front_model');
$this->load->helper('date');
$this->load->library('Datatables');
$this->load->library('table');
$this->load->database();
$this->load->library('form_validation');
 $this->load->library("pagination");
 $this->load->helper('download');
 $this->load->library('email');
}
	 public function index()
	{
		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
        //code for to get jobs categories or jobs inducteries
		$get_jobs=$this->akrsp_model1->read_jobscategory_record();
        $data['jobscategory'] = $get_jobs;
		//code to get the home page conetent about jbn 
        $pas=array('id'=>2);
        $get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
		$data['aboutconent'] = $get_homepage_conetnt;
		//code for to show he team on home page
		$team_get=$this->akrsp_model1->read_team_record();
		$data['teamlist'] = $team_get;
		//code for to get companies logos
		$get_company=$this->akrsp_model1->read_viewjob_record();
		$data['comapnylist'] = $get_company;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//case for to show values image
	if($this->session->userdata('user_type')==1)
	{	
	    $id=$this->session->userdata('user_id');
        $pas=array('candidate_id'=>$id);
        $get_pr_data=$this->akrsp_model1->read_profile_record($pas);
		$data['footer_data1'] = $get_pr_data;
	}
	else
	{
	$id=$this->session->userdata('user_id');
	$pas=array('employee_id'=>$id);
	$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
	$data['footer_data1'] = $get_pr_data;
	
	}	
		$this->load->view('index',$data);
	  
	}
	public function viewjobreport()
  {
   if($this->session->userdata('user_type')==1)
   {
    redirect('front_end/myaccount?myprofile_data=myprofile_data');
    exit;
   }

  $this->load->model('akrsp_model1');
  //code for to get website setting data
  $result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
  //code for to get banner image
   $data['querybaneer'] = $result;
  //code for to get footer content
  $get_web_setting=$this->akrsp_model1->read_website_record();
  $data['footer_data'] = $get_web_setting;
  //code for to get continue profile information
  if($this->session->userdata('user_type')==1)
  { 
   $id=$this->session->userdata('user_id');
   $pas=array('candidate_id'=>$id);
   $get_pr_data=$this->akrsp_model1->read_profile_record($pas);
   $data['footer_data1'] = $get_pr_data;
  }
  else
  {
  $id=$this->session->userdata('user_id');
  $pas=array('employee_id'=>$id);
  $get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
  $data['footer_data1'] = $get_pr_data;
  
  }
  //email,address,phone code
  $user_id=array('user_id'=>$id);
  $get_address_email=$this->akrsp_model1->read_adress_email($user_id);
  $data['profile'] = $get_address_email;
  //get locations for cand_dahaboard
  $candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
  $data['get_can_locations'] = $get_can_locations;
    //code for to show job types on listing page
     $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
  $data['get_job_types'] = $get_job_type;
  //get sectors for cand_dahaboard
  $candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
  $data['get_can_sectors'] = $get_can_sectors;
  //code for to show work history in grid table
  $get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
  $data['work_history'] = $get_work_history_data; 
  //code for to show qualificatins data  in grid table
  $get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
  $data['qualifications_data'] = $get_qualifications_data;
  //code for to show skills
  $get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
  $data['skilss_data'] = $get_skills_data;
  
  $get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
  $data['license_data'] = $get_license_data;
  //get langusges
  $candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
  $data['get_can_languages'] = $get_can_languages;
  //get data of job listing page
  $get_jobdetails_data=$this->akrsp_model1->read_viewjobsdeatilss_record1($id);
  $data['query_jobdestils']=$get_jobdetails_data;
  
 if($this->session->userdata('logged')!=true)
 {
 
  $this->success_page();
 }
 else
 {
 //code to show the edit page
 $idrec=$this->input->get('id');
$idrec=array('job_id'=>$idrec);
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->read_jobedit_record($idrec);
if($result)
{
$data['query']=$this->akrsp_model1->read_jobedit_record($idrec);
$this->load->view('viewjobreport',$data);
}  
 }    
  
}
public function blog()
{
	$this->load->model('akrsp_model1');
	//code for to get website setting data
	$result=$this->akrsp_model1->read_website_record();
	$data['querywebsetting'] = $result;
	//code for to get banner image
	$data['querybaneer'] = $result;
	//code for to get footer content
	$get_web_setting=$this->akrsp_model1->read_website_record();
	$data['footer_data'] = $get_web_setting;
	if($this->session->userdata('user_type')==1)
	{	
		$id=$this->session->userdata('user_id');
		$pas=array('candidate_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
		$data['footer_data1'] = $get_pr_data;
	}
	else
	{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
	}
	
	if (($this->input->get('blogs_cat_id'))=='')
	{
		$pas=array('id'=>12);
		$get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
		$data['aboutconent'] = $get_homepage_conetnt;
		$get_blog_cat=$this->akrsp_model1->read_blog_cat_record();
		$data['blogscategory'] = $get_blog_cat;
		$get_blog=$this->akrsp_model1->read_blog_record();
		$data['blogs'] = $get_blog;
		$this->load->view('frontend_blog', $data);
	}
	if (($this->input->get('blogs_cat_id'))!='')
	{
		$pas=array('id'=>12);
		$get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
		$data['aboutconent'] = $get_homepage_conetnt;
		$get_blog_cat=$this->akrsp_model1->read_blog_cat_record();
		$data['blogscategory'] = $get_blog_cat;
		/*$get_blog=$this->akrsp_model1->read_blog_record();
		$data['blogs'] = $get_blog;*/
		$blog_cat = $this->input->get('blogs_cat_id');
		$get_blog_by_cat = $this->akrsp_model1->read_blog_record_by_cat($blog_cat);
		$data['blogs'] = $get_blog_by_cat;
		$this->load->view('frontend_blog', $data);
	}


}	


public function blog_post()
{
	$this->load->model('akrsp_model1');
	//code for to get website setting data
	$result=$this->akrsp_model1->read_website_record();
	$data['querywebsetting'] = $result;
	//code for to get banner image
	 $data['querybaneer'] = $result;
	//code for to get footer content
	$get_web_setting=$this->akrsp_model1->read_website_record();
	$data['footer_data'] = $get_web_setting;
	//case for to show values image
	if($this->session->userdata('user_type')==1)
	{	
		$id=$this->session->userdata('user_id');
		$pas=array('candidate_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
		$data['footer_data1'] = $get_pr_data;
	}
	else
	{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
	
	}
	$get_blog_cat=$this->akrsp_model1->read_blog_cat_record();
	$data['blogscategory'] = $get_blog_cat;
	$blog_id = $this->input->get('blog_id');
	$get_blog_by_id = $this->akrsp_model1->read_blog_by_id($blog_id);
	$data['blogs'] = $get_blog_by_id;
	/*echo '<pre';
	print_r($data['datapage']);*/
	$this->load->view('blogpost', $data);
}	
	public function login_user()
	{
		
		$login=array('email'=>$this->input->post('email'),
					'password'=>md5($this->input->post('password'))
					);
					
					$this->load->model('akrsp_model1');
					$result=$this->akrsp_model1->user_login($login);
					if($result)
					{
						foreach($result as $var)
							{
								$data = array(
       									 'email' => $var->email,
										 'user_id'=> $var->user_id,
										 'userloginid'=> $var->user_id,
										 'user_type'=> $var->user_type,
										 'fname'=> $var->fname,
										 'lname'=> $var->lname,
      									  'logged' => true      
        );
								$this->session->set_userdata($data);
								if($var->user_type==1)
								{
							/*redirect('front_end/candidate_dashboard');*/
							echo "1";
							}
							else
							{
							/*redirect('front_end/employee_dashboard');*/
							echo "2";
							}
							}
					}
					else
					{

					echo "3";
						
					}
		
	}
	public function welcome_page()
	{
		if($this->session->userdata('logged'))
		{
		$this->load->view('welcome_message');
		}
		else
		{
			$this->success_page();
		}
		
	}
	public function jobdetails()
	{
	$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//case for to show values image
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		/****************************************************************************/
		//code to get images for advertisements
		$position_right = '2';
		$position_left = '1';
		$data['img_right'] = $this->akrsp_model1->get_image_name($position_right);
		$data['img_left'] = $this->akrsp_model1->get_image_name($position_left);
		/****************************************************************************/
		$get_jobs=$this->akrsp_model1->read_jobscategory_record();
        $data['jobscategory'] = $get_jobs;
		$this->db->where('job_id',$this->input->get('job_id'));
        $config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
		$this->db->where('job_id',$this->input->get('job_id'));
		$query = $this->db->get('njobn_jobdetails');
        $data['joblist'] = $query->result();
		$data['count_number']=$config['total_rows'];
		$this->load->view('jobdetails',$data);
		}
	public function shortlist()
	{
	   //code for check if employee
	   if($this->session->userdata('user_type')==2)
		{
		redirect('front_end/myaccount?myprofile_data=myprofile_data');
		exit;
		}
	   
	   $this->load->model('akrsp_model1');
	   $this->load->model('akrsp_model1');
	
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		
		if($this->session->userdata('logged')!=true)
	{
		$this->success_page();
		
		}
		else
		{
		$this->load->view('shortlist',$data);
		}
		}
	//browse candidates
		public function browse_candidates()
	{
	 if($this->session->userdata('user_type')==1)
		{
		redirect('front_end/myaccount?myprofile_data=myprofile_data');
		exit;
		}
	$this->load->model('akrsp_model1');
		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		
		if($this->session->userdata('logged')!=true)
	{
		$this->success_page();
		
		}
		else
		{
		$this->load->view('browse_candidates',$data);
		}
		}
	
		
	public function myapplication()
	{
	 if($this->session->userdata('user_type')==2)
		{
		redirect('front_end/myaccount?myprofile_data=myprofile_data');
		exit;
		}
	$this->load->model('akrsp_model1');
		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		
		if($this->session->userdata('logged')!=true)
	{
		$this->success_page();
		
		}
		else
		{
		$this->load->view('myapplication',$data);
		}
		}
		//view application
		public function viewapplication()
	{
	 if($this->session->userdata('user_type')==1)
		{
		redirect('front_end/myaccount?myprofile_data=myprofile_data');
		exit;
		}
	$this->load->model('akrsp_model1');
		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		
		if($this->session->userdata('logged')!=true)
	{
		$this->success_page();
		
		}
		else
		{
		$this->load->view('viewapplication',$data);
		}
		}
	public function joblisting()
	{
	$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		 /****************************************************************************/
			//code to get images for advertisements -Hamza
			$position_right = '2';
			$position_left = '1';
			$data['img_right'] = $this->akrsp_model1->get_image_name($position_right);
			$data['img_left'] = $this->akrsp_model1->get_image_name($position_left);
			/****************************************************************************/
		//code for to get footer content
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		$get_jobs=$this->akrsp_model1->read_jobscategory_record();
        $data['jobscategory'] = $get_jobs;
		//code for to get job id
if($this->input->get('job_id')!='')
{		
$job_id=$this->input->get('job_id');
//code for to get city
$seect_city=mysql_query("select * from cities where name='".$this->input->post('city_state')."'");
$fethc_city=mysql_fetch_array($seect_city);
$city_state=$fethc_city['id'];
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
 $this->db->where("(job_id='".$job_id."' OR city='".$city_state."')");
 $this->db->where('job_status',1);
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 15;
$this->pagination->initialize($config);
 $this->db->where("(job_id='".$job_id."' OR city='".$city_state."')");
 $this->db->where('job_status',1);
 $query = $this->db->get('njobn_jobdetails',$config['per_page'], $this->uri->segment(3));
 $data['joblist'] = $query->result();
 
		/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
		$data['joblist'] = $get_jobs_search;*/

		 $data['count_number']=$config['total_rows'];
		$this->load->view('joblisting',$data);
}

else if($this->input->get('permanent')==1 || $this->input->get('contract')==2 || $this->input->get('temporary')==3  || $this->input->get('parttime')==4 || $this->input->get('fulltime')==5)
{

/*echo '<pre>';
echo $job_id;*/
//$job_id=$fethc_jobs_indus['job_id'];
$this->load->library('pagination');
$permanent=$this->input->get('permanent');
$contract=$this->input->get('contract');
$temporary=$this->input->get('temporary');
$parttime=$this->input->get('parttime');
$fulltime=$this->input->get('fulltime');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
$industeries_id=$this->input->get('job_cat');
$this->db->where("(job_type='".$permanent."' OR job_type='".$contract."' OR job_type='".$temporary."' OR job_type='".$parttime."' OR job_type='".$fulltime."')");
$this->db->where('job_status',1);
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 15;
$this->pagination->initialize($config); 
$this->db->where("(job_type='".$permanent."' OR job_type='".$contract."' OR job_type='".$temporary."' OR job_type='".$parttime."' OR job_type='".$fulltime."')");
$this->db->where('job_status',1);
$query = $this->db->get('njobn_jobdetails',$config['per_page'], $this->uri->segment(3)); 
$data['joblist'] = $query->result();
$data['count_number']=$config['total_rows'];		
$this->load->view('joblisting',$data);
}
else if($this->input->get('exp')!='')
{

/*echo '<pre>';
echo $job_id;*/
//$job_id=$fethc_jobs_indus['job_id'];
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
$industeries_id=$this->input->get('job_cat');
$this->db->where('exp',$this->input->get('exp'));
$this->db->where('job_status',1);
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 15;
$this->pagination->initialize($config); 
$this->db->where('exp',$this->input->get('exp'));
$this->db->where('job_status',1);
$query = $this->db->get('njobn_jobdetails',$config['per_page'], $this->uri->segment(3)); 

 /*echo'<pre>';
 print_r($data);*/
 
/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
$data['joblist'] = $get_jobs_search;*/
 $data['joblist'] = $query->result();
 $data['count_number']=	$config['total_rows'];	
$this->load->view('joblisting',$data);
}
else if($this->input->get('job_order')==1 && $this->input->get('search_titl')=='')
{

/*echo '<pre>';
echo $job_id;*/
//$job_id=$fethc_jobs_indus['job_id'];
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
$industeries_id=$this->input->get('job_cat');
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 30;
$this->pagination->initialize($config); 
$this->db->where('job_status',1);
 $query = $this->db->get('njobn_jobdetails',$config['per_page'], $this->uri->segment(3)); 

 /*echo'<pre>';
 print_r($data);*/
 
/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
$data['joblist'] = $get_jobs_search;*/
 $data['joblist'] = $query->result();	
  $data['count_number']=$config['total_rows'];	
$this->load->view('joblisting',$data);
}
else if($this->input->get('job_order')==1 && $this->input->get('salary_from')!='')
{

/*echo '<pre>';
echo $job_id;*/
//$job_id=$fethc_jobs_indus['job_id'];
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
$industeries_id=$this->input->get('job_cat');
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 30;
$this->pagination->initialize($config); 
$this->db->where('job_salary_from >=', $this->input->get('salary_from'));
$this->db->where('job_salary_to <=', $this->input->get('salary_to'));
$this->db->where('job_status',1);
 $query = $this->db->get('njobn_jobdetails',$config['per_page'], $this->uri->segment(3)); 

 /*echo'<pre>';
 print_r($data);*/
 
/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
$data['joblist'] = $get_jobs_search;*/
 $data['joblist'] = $query->result();	
  $data['count_number']=$config['total_rows'];	
$this->load->view('joblisting',$data);
}
else if($this->input->get('salary_from')!='')
{

/*echo '<pre>';
echo $job_id;*/
//$job_id=$fethc_jobs_indus['job_id'];
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
$industeries_id=$this->input->get('job_cat');
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 30;
$this->pagination->initialize($config); 
$this->db->where('job_salary_from >=', $this->input->get('salary_from'));
$this->db->where('job_salary_to <=', $this->input->get('salary_to'));
$this->db->where('job_status',1);
 $query = $this->db->get('njobn_jobdetails',$config['per_page'], $this->uri->segment(3)); 

 /*echo'<pre>';
 print_r($data);*/
 
/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
$data['joblist'] = $get_jobs_search;*/
 $data['joblist'] = $query->result();	
  $data['count_number']=$config['total_rows'];	
$this->load->view('joblisting',$data);
}
else if($this->input->get('job_order')==2)
{

/*echo '<pre>';
echo $job_id;*/
//$job_id=$fethc_jobs_indus['job_id'];
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
$industeries_id=$this->input->get('job_cat');
$this->db->where('job_status',1);
$this->db->order_by('date', 'Desc');
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 15;
$this->pagination->initialize($config);
$this->db->where('job_status',1);
$this->db->order_by('date', 'Desc'); 
 $query = $this->db->get('njobn_jobdetails',$config['per_page'], $this->uri->segment(3)); 

 /*echo'<pre>';
 print_r($data);*/
 
/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
$data['joblist'] = $get_jobs_search;*/
 $data['joblist'] = $query->result();
  $data['count_number']=$config['total_rows'];
$this->load->view('joblisting',$data);
}

else if($this->input->get('job_cat')!='')
{

/*echo '<pre>';
echo $job_id;*/
//$job_id=$fethc_jobs_indus['job_id'];
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
$industeries_id=$this->input->get('job_cat');
$this->db->join("njobn_industeries","njobn_industeries.job_id =njobn_jobdetails.job_id","inner");
$this->db->where('njobn_industeries.industeries_id',$industeries_id);
$this->db->where('job_status',1);
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 15;
$this->pagination->initialize($config);
$this->db->join("njobn_industeries","njobn_industeries.job_id =njobn_jobdetails.job_id","inner");
$this->db->where('njobn_industeries.industeries_id',$industeries_id);
$this->db->where('job_status',1);
 $query = $this->db->get('njobn_jobdetails',$config['per_page'], $this->uri->segment(3)); 

 /*echo'<pre>';
 print_r($data);*/
 
/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
$data['joblist'] = $get_jobs_search;*/
 $data['joblist'] = $query->result();
  $data['count_number']=$config['total_rows'];
$this->load->view('joblisting',$data);
}
else if($this->input->get('job_titlesearch')!='' && $this->input->get('job_order')==1)
{

//code for to get city
/*$seect_city=mysql_query("select * from cities where name='".$this->input->post('city_state')."'");
$fethc_city=mysql_fetch_array($seect_city);
$city_state=$fethc_city['id'];*/
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
 /*$this->db->where("(job_id='".$job_id."' OR city='".$city_state."')");*/
   $criteria=$this->input->get('job_titlesearch');
  $this->db->like('job_title', $criteria);
 $this->db->where('job_status',1);
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 15;
$this->pagination->initialize($config);
 /*$this->db->where("(job_id='".$job_id."' OR city='".$city_state."')");*/
 $this->db->like('job_title', $criteria);
 $this->db->where('job_status',1);
 $query = $this->db->get('njobn_jobdetails');
 $data['joblist'] = $query->result();
		/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
		$data['joblist'] = $get_jobs_search;*/
		
		$this->load->view('joblisting',$data);

}
else if($this->input->get('job_titlesearch')!='')
{

//code for to get city
/*$seect_city=mysql_query("select * from cities where name='".$this->input->post('city_state')."'");
$fethc_city=mysql_fetch_array($seect_city);
$city_state=$fethc_city['id'];*/
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
 /*$this->db->where("(job_id='".$job_id."' OR city='".$city_state."')");*/
 $criteria=$this->input->get('job_titlesearch');
  $this->db->like('job_title', $criteria);
   $this->db->where('job_status',1);
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 15;
$this->pagination->initialize($config);
 /*$this->db->where("(job_id='".$job_id."' OR city='".$city_state."')");*/
$this->db->like('job_title', $criteria);
 $this->db->where('job_status',1);
 $query = $this->db->get('njobn_jobdetails');
 $data['joblist'] = $query->result();
		/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
		$data['joblist'] = $get_jobs_search;*/
		$this->load->view('joblisting',$data);

}
else
{
//code which not match
$seect_city=mysql_query("select * from cities where name='".$this->input->post('city_state')."' AND name!=''");
$fethc_city=mysql_fetch_array($seect_city);
$city_state=$fethc_city['id'];
if(mysql_num_rows($seect_city) !=1 && $this->input->post('job_title')!='')
{
$this->search_jobtitle();
}
else
{
//code for to get city
$job_title=$this->input->post('job_title');
$this->load->library('pagination');
$config['base_url'] = 'http://cybervision.com.pk/jobnjob/front_end/joblisting';
 $this->db->where("(job_title like '%".$job_title."%' AND city='".$city_state."')");
  /*$this->db->where('city',$city_state);*/
 $this->db->where('job_status',1);
$config['total_rows'] = $this->db->get('njobn_jobdetails')->num_rows();
$config['per_page'] = 20;
$this->pagination->initialize($config);
$this->db->where("(job_title like '%".$job_title."%' AND city='".$city_state."')");
/* $this->db->where('city',$city_state);*/
 $this->db->where('job_status',1);
 $query = $this->db->get('njobn_jobdetails');
 $data['joblist'] = $query->result();
		/*$get_jobs_search=$this->akrsp_model1->read_jobs($job_id,$city_state,$config['per_page'],$sement_code);
		$data['joblist'] = $get_jobs_search;*/
		$this->load->view('joblisting',$data);
		}
		}
	}
public function search_jobtitle()
{
$this->load->model('akrsp_model1');
//code for to get website setting data
$result=$this->akrsp_model1->read_website_record();
$data['querywebsetting'] = $result;
//code for to get banner image
$data['querybaneer'] = $result;
/****************************************************************************/
//code to get images for advertisements -Hamza
$position_right = '2';
$position_left = '1';
$data['img_right'] = $this->akrsp_model1->get_image_name($position_right);
$data['img_left'] = $this->akrsp_model1->get_image_name($position_left);
/****************************************************************************/
//code for to get footer content
if($this->session->userdata('user_type')==1)
{	
$id=$this->session->userdata('user_id');
$pas=array('candidate_id'=>$id);
$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
$data['footer_data1'] = $get_pr_data;
}
else
{
$id=$this->session->userdata('user_id');
$pas=array('employee_id'=>$id);
$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
$data['footer_data1'] = $get_pr_data;
}
$get_web_setting=$this->akrsp_model1->read_website_record();
$data['footer_data'] = $get_web_setting;
$get_jobs=$this->akrsp_model1->read_jobscategory_record();
$data['jobscategory'] = $get_jobs;
$criteria=$this->input->post('job_title');
$this->db->like('job_title', $criteria);
$this->db->where('job_status',1);
$query = $this->db->get('njobn_jobdetails');
$data['joblist'] = $query->result();
 /****************************************************************************/
 $data['search_string'] = $this->input->post('job_title'); //pass search string to webpage
 /****************************************************************************/
$this->load->view('joblisting',$data);
}	
	public function user_logout()
	{
		if($this->session->userdata('logged'))
		{
	$this->session->sess_destroy();
	redirect('front_end/index');
		}
	}
	//forgot password
public function register()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		
		$this->load->view('register',$data);		
}

public function register1()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		
		$this->load->view('register1',$data);		
}
public function success_page()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		
		$this->load->view('success_page',$data);		
}
public function success_page1()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		
		$this->load->view('success_page1',$data);		
}


//code for to diplay login page
public function login()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		
		$this->load->view('login',$data);		
}
public function candidate_dashboard()
{
 if($this->session->userdata('user_type')==2)
		{
		redirect('front_end/myaccount?myprofile_data=myprofile_data');
		exit;
		}
		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('candidate_dashboard',$data);
	}		
}
public function viewcandidate_dashboard()
{
		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		
		
		//code for to get continue profile information
			
			$id=$this->input->get('cand_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
			
			
	
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('viewcandidate_dashboard',$data);
	}		
}
public function employee_dashboard()
{
if($this->session->userdata('user_type')==1)
{
redirect('front_end/myaccount?myprofile_data=myprofile_data');
exit;
}


		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		//get data of job listing page
		$get_jobdetails_data=$this->akrsp_model1->read_viewjobsdeatilss_record1($id);
		$data['query_jobdestils']=$get_jobdetails_data;
		
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('employee_dashboard',$data);
	}		
}
public function addjob()
{
if($this->session->userdata('user_type')==1)
{
redirect('front_end/myaccount?myprofile_data=myprofile_data');
exit;
}

		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		//get data of job listing page
		$get_jobdetails_data=$this->akrsp_model1->read_viewjobsdeatilss_record1($id);
		$data['query_jobdestils']=$get_jobdetails_data;
		
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('addjob',$data);
	}		
}
public function recruiters()
{

if($this->session->userdata('user_type')==1)
{
redirect('front_end/myaccount?myprofile_data=myprofile_data');
exit;
}

		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		//get data of job listing page
		$get_jobdetails_data=$this->akrsp_model1->read_viewjobsdeatilss_record1($id);
		$data['query_jobdestils']=$get_jobdetails_data;
		
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('recruiters',$data);
	}		
}
//code fro reports
public function reports()
{
if($this->session->userdata('user_type')==1)
{
redirect('front_end/myaccount?myprofile_data=myprofile_data');
exit;
}
		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		//get data of job listing page
		$get_jobdetails_data=$this->akrsp_model1->read_viewjobsdeatilss_record1($id);
		$data['query_jobdestils']=$get_jobdetails_data;
		$data['query_date_reports']=$this->akrsp_model1->read_viewjob_recordrep($id);
		$get_userslist=$this->akrsp_model1->get_users_cv_down($id);
		$data['get_users_cvrecords']=$get_userslist;
		//code to show the cv views and downloads
		$get_cvdoenloadsusers=$this->akrsp_model1->get_cvdowloads($id);
		$data['showcvdownloadslist']=$get_cvdoenloadsusers;
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('reports',$data);
	}		
}
public function manage_users()
{

		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		//get data of job listing page
		$get_jobdetails_data=$this->akrsp_model1->read_viewjobsdeatilss_record1($id);
		$data['query_jobdestils']=$get_jobdetails_data;
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
	if($this->session->userdata('user_type')==2)
		{	
		$this->load->view('manage_users',$data);
		}
	}		
}
public function myaccount()
{

		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
	if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('myaccount',$data);
	}		
}


//code for to get work location add lacotion
function get_work_location()
{
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_location_name($q);
}
}
function get_language()
{
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_language_name($q);
}
}
//code for to get work location for update locataon
function get_work_location_update()
{
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_location_name($q);
}
}
//code for to show langues on update page
function get_work_language_update()
{
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_language_name($q);
}
}
//c ode for to get job title
function get_job_title()
{
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_job_title($q);
}
}
//get job title reters serch
function get_job_titlerec()
{
$user_id=$this->session->userdata('user_id');
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_job_titlerec($q,$user_id);
}
}
function get_job_title1()
{
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_job_title($q);
}
}
//code for to get city
function get_city_state()
{
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
if (strlen($_GET['term']) < 4) 
{
break;
}
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_city_state1($q);
}
}
function get_job_skills()
{
$this->load->model('akrsp_model1');
if (isset($_GET['term']))
{
$q = strtolower($_GET['term']);
$this->akrsp_model1->get_job_skills($q);
}
}
function insert_regestartion()
{
error_reporting(0);
$this->form_validation->set_rules('recfname', 'First Name', 'required');
$this->form_validation->set_rules('reclname', 'Last Name', 'required');
$this->form_validation->set_rules('recphone', 'Phone', 'required');
$this->form_validation->set_rules('reccname', 'Company Name', 'required');
$this->form_validation->set_rules('recemail', 'Email', 'required');
$this->form_validation->set_rules('recemail', 'Email', 'required|valid_email');
$this->form_validation->set_rules('rec1password', 'Password', 'required');
if ($this->form_validation->run() == FALSE)
{
echo "4";
}
else
{
//code for insertion
//email already exit
$email=$this->input->post('recemail');
$this->db->where('email',$email);
$query = $this->db->get('njobn_webusers');
if($query->num_rows() > 0)
{
echo "5";
exit;
/*echo "<script>alert('Email Address Already Exist');</script>";	 			  							
echo '<script type="text/javascript">' . "\n";
echo 'window.location="index";';
echo '</script>';
exit; */
}
$record=array('user_type'=>2,
'fname'=>$this->input->post('recfname'),
'lname'=>$this->input->post('reclname'),
'email'=>$this->input->post('recemail'),
'phone'=>$this->input->post('recphone'),
'emp_satus'=>1,
'cname'=>$this->input->post('reccname'),
'created_by'=>$this->session->userdata('user_id'),
'user_satus'=>1,
'password'=>md5($this->input->post('rec1password')),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_webuser_record($record);
$insert_id = $this->db->insert_id();
$result=$data['query'];
$insert_product=mysql_query("insert into njobn_employee set  employee_id='".$insert_id."',date='".date("Y/m/d")."'");
//code for email
$sel_admin_data=mysql_query("select * from njobn_users where group_id=9");
$fetach_admin_data=mysql_fetch_array($sel_admin_data);
$from=$fetach_admin_data['email'];
$pass=$this->input->post('rec1password');
$name=$this->input->post('recfname');
$to =trim($this->input->post('recemail'));
/*$config = array(
					'wordwrap' => TRUE,
					'mailtype' => 'html'
					);
					$this->load->library('email', $config);
					$this->email->from($from,'JOB-N-JOB');
					$this->email->to($to); 
					$this->email->subject('JOB-N-JOB User Regesration Information.');
					$this->email->message("<strong>Dear ".$name.",</strong><br><br>
Thank you for regestration on JOB-N-JOB <br>
Your username/email is.<br>
".$to."<br>
Your password is.<br>
".$pass."<br>
<strong>Best Regards,</strong><br>
<strong>JOB-N-JOB</strong>");	
					$email=$this->email->send();
					if($email==1)
					{*/
$subject="Job N Job User Registration";					
$body = "Dear $name<br>".
"Thank you for registering at Job N Job.<br>".
"Your username/email is: $to <br>".
"Your password is: $pass <br>".
"Best Regards<br>".
"Job N Job<br>";	
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail=mail($to, $subject, $body,$headers);	
if($mail)
{					
echo "1";
}
}
}

function insert_regestartionbyrecter()
{
error_reporting(0);
$this->form_validation->set_rules('recfname', 'First Name', 'required');
$this->form_validation->set_rules('reclname', 'Last Name', 'required');
$this->form_validation->set_rules('recphone', 'Phone', 'required');
$this->form_validation->set_rules('reccname', 'Company Name', 'required');
$this->form_validation->set_rules('recemail', 'Email', 'required');
$this->form_validation->set_rules('recemail', 'Email', 'required|valid_email');
$this->form_validation->set_rules('rec1password', 'Password', 'required');
if ($this->form_validation->run() == FALSE)
{
echo "4";
}
else
{
//code for insertion
//email already exit
$email=$this->input->post('recemail');
$this->db->where('email',$email);
$query = $this->db->get('njobn_webusers');
if($query->num_rows() > 0)
{
echo "5";
exit;
/*echo "<script>alert('Email Address Already Exist');</script>";	 			  							
echo '<script type="text/javascript">' . "\n";
echo 'window.location="index";';
echo '</script>';
exit; */
}
$record=array('user_type'=>2,
'fname'=>$this->input->post('recfname'),
'lname'=>$this->input->post('reclname'),
'email'=>$this->input->post('recemail'),
'phone'=>$this->input->post('recphone'),
'cname'=>$this->input->post('reccname'),
'created_by'=>$this->session->userdata('user_id'),
'user_satus'=>$this->input->post('user_satus'),
'standard_jobs'=>$this->input->post('standard_jobs'),
'featured_jobs'=>$this->input->post('featured_jobs'),
'premium_jobs'=>$this->input->post('premium_jobs'),
'licences_jobs'=>$this->input->post('licences_jobs'),
'email_jobs'=>$this->input->post('email_jobs'),
'match_jobs'=>$this->input->post('match_jobs'),
'password'=>md5($this->input->post('rec1password')),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_webuser_record($record);
$insert_id = $this->db->insert_id();
$result=$data['query'];
$insert_product=mysql_query("insert into njobn_employee set  employee_id='".$insert_id."',date='".date("Y/m/d")."'");
//code for email
$sel_admin_data=mysql_query("select * from njobn_users where group_id=9");
$fetach_admin_data=mysql_fetch_array($sel_admin_data);
$from=$fetach_admin_data['email'];
$pass=$this->input->post('rec1password');
$name=$this->input->post('recfname');
$to =trim($this->input->post('recemail'));
/*$config = array(
					'wordwrap' => TRUE,
					'mailtype' => 'html'
					);
					$this->load->library('email', $config);
					$this->email->from($from,'JOB-N-JOB');
					$this->email->to($to); 
					$this->email->subject('JOB-N-JOB User Regesration Information.');
					$this->email->message("<strong>Dear ".$name.",</strong><br><br>
Thank you for regestration on JOB-N-JOB <br>
Your username/email is.<br>
".$to."<br>
Your password is.<br>
".$pass."<br>
<strong>Best Regards,</strong><br>
<strong>JOB-N-JOB</strong>");	
					$email=$this->email->send();
					if($email==1)
					{*/
$subject="Job N Job User Registration";					
$body = "Dear $name<br>".
"Thank you for registering at Job N Job.<br>".
"Your username/email is: $to <br>".
"Your password is: $pass <br>".
"Best Regards<br>".
"Job N Job<br>";
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail=mail($to, $subject, $body,$headers);	
if($mail)
{					
echo "1";
}
}
}
//code for to update users
function update_recuter_users()
{
error_reporting(0);
$this->form_validation->set_rules('recfname', 'First Name', 'required');
$this->form_validation->set_rules('reclname', 'Last Name', 'required');
$this->form_validation->set_rules('recphone', 'Phone', 'required');
$this->form_validation->set_rules('reccname', 'Company Name', 'required');
$this->form_validation->set_rules('recemail', 'Email', 'required');
$this->form_validation->set_rules('recemail', 'Email', 'required|valid_email');
$this->form_validation->set_rules('rec1password', 'Password', 'required');
if ($this->form_validation->run() == FALSE)
{
echo "4";
}
else
{
//code for insertion
//email already exit
$id=$this->input->post('user_id');
$record=array('user_type'=>2,
'fname'=>$this->input->post('recfname'),
'lname'=>$this->input->post('reclname'),
'email'=>$this->input->post('recemail'),
'phone'=>$this->input->post('recphone'),
'cname'=>$this->input->post('reccname'),
'created_by'=>$this->session->userdata('user_id'),
'user_satus'=>$this->input->post('user_satus'),
'standard_jobs'=>$this->input->post('standard_jobs'),
'featured_jobs'=>$this->input->post('featured_jobs'),
'premium_jobs'=>$this->input->post('premium_jobs'),
'licences_jobs'=>$this->input->post('licences_jobs'),
'email_jobs'=>$this->input->post('email_jobs'),
'match_jobs'=>$this->input->post('match_jobs'),
'password'=>md5($this->input->post('rec1password')),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_usersprofile($id,$record);
$insert_id = $this->db->insert_id();
$result=$data['query'];
//code for email
$sel_admin_data=mysql_query("select * from njobn_users where group_id=9");
$fetach_admin_data=mysql_fetch_array($sel_admin_data);
$from=$fetach_admin_data['email'];
$pass=$this->input->post('rec1password');
$name=$this->input->post('recfname');
$to =trim($this->input->post('recemail'));
/*$config = array(
					'wordwrap' => TRUE,
					'mailtype' => 'html'
					);
					$this->load->library('email', $config);
					$this->email->from($from,'JOB-N-JOB');
					$this->email->to($to); 
					$this->email->subject('JOB-N-JOB User Regesration Information.');
					$this->email->message("<strong>Dear ".$name.",</strong><br><br>
Thank you for regestration on JOB-N-JOB <br>
Your username/email is.<br>
".$to."<br>
Your password is.<br>
".$pass."<br>
<strong>Best Regards,</strong><br>
<strong>JOB-N-JOB</strong>");	
					$email=$this->email->send();
					if($email==1)
					{*/
$subject="Job N Job User Registration Information Updated";					
$body = "Dear $name<br>".
"Your account information is updated.<br>".
"Your username/email is: $to <br>".
"Your password is: $pass <br>".
"Best Regards<br>".
"Job N Job<br>";	
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail=mail($to, $subject, $body,$headers);	
if($mail)
{					
echo "1";
}
}
}

//signup code for employee
function insert_regestartion1()
{
error_reporting(0);
$this->form_validation->set_rules('fname', 'First Name', 'required');
$this->form_validation->set_rules('lname', 'Last Name', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_message('is_unique', 'The %s is already taken');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('p_location', 'Preferred work location', 'required');
$this->form_validation->set_rules('job_title', 'Job Title', 'required');
if ($this->form_validation->run() == FALSE)
{
echo "4";
}
else
{
$email=$this->input->post('email');
$this->db->where('email',$email);
$query = $this->db->get('njobn_webusers');
if($query->num_rows() > 0)
{
echo "5";
exit;
/*echo "<script>alert('Email Address Already Exist');</script>";	 			  							
echo '<script type="text/javascript">' . "\n";
echo 'window.location="index";';
echo '</script>';
exit; */
}
//code for insertion
//code for to get p_location 
$seect_p_location=mysql_query("select * from countries where name='".$this->input->post('p_location')."'");
$fethc_p_location=mysql_fetch_array($seect_p_location);
$p_location=$fethc_p_location['id'];
//code for to get job id 
$seect_jobs=mysql_query("select * from njobn_jobdetails where job_title='".$this->input->post('job_title')."'");
$fethc_jobs=mysql_fetch_array($seect_jobs);
$job_id=$fethc_jobs['job_id'];
$record=array('user_type'=>1,
'fname'=>$this->input->post('fname'),
'lname'=>$this->input->post('lname'),
'email'=>$this->input->post('email'),
'gre_job'=>$this->input->post('gre_job'),
'job_id'=>$job_id,
'password'=>md5($this->input->post('password')),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_webuser_record($record);
$insert_id=$this->db->insert_id();
$result=$data['query'];
//code for to add locatins id
$insert_lcoations=mysql_query("insert into candidate_locations set  candidate_id='".$insert_id."',
                                                                    location_id='".$p_location."',
																	date='".date("Y/m/d")."'");
$insert_product=mysql_query("insert into njobn_candidate set  candidate_id='".$insert_id."',date='".date("Y/m/d")."'");
//code for to add job type
error_reporting(0);
foreach ($_POST['job_type'] as $selectedOption)
{
if($selectedOption!=0)
{

$sql_insert=mysql_query("insert into job_type set cand_id='".$insert_id."',
						                                      date='".date("Y/m/d")."',
						                                      job_type_id='".$selectedOption."'");
}
}
//email sendig code
//get email address for admin
$sel_admin_data=mysql_query("select * from njobn_users where group_id=9");
$fetach_admin_data=mysql_fetch_array($sel_admin_data);
$from=$fetach_admin_data['email'];
$pass=$this->input->post('password');
$name=$this->input->post('fname');
$to =trim($this->input->post('email'));
/*$config = array(
'wordwrap' => TRUE,
'mailtype' => 'html'
);
$this->load->library('email', $config);
$this->email->from($from,'JOB-N-JOB');
$this->email->to($to); 
$this->email->subject('JOB-N-JOB User Regesration Information.');
$this->email->message("<strong>Dear ".$name.",</strong><br><br>
Thank you for regestration on JOB-N-JOB <br>
Your username/email is.<br>
".$to."<br>
Your password is.<br>
".$pass."<br>
<strong>Best Regards,</strong><br>
<strong>JOB-N-JOB</strong>");	
$email=$this->email->send();
if($email==1)
{*/
$subject="Job N Job User Registration";					
$body = "Dear $name<br>".
"Thank you for registering at Job N Job.<br>".
"Your username/email is: $to <br>".
"Your password is: $pass <br>".
"Best Regards<br>".
"Job N Job<br>";
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail=mail($to, $subject, $body,$headers);	
if($mail)
{
echo "1";
}
}
}
function upload()
{
$randumtime=time();
$upload_image_file = trim(addslashes($_FILES['image']['name']));
$upload_image_file = str_replace(' ', '_', $upload_image_file);
$config['upload_path'] = './assets/upload/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '20000';
$config['max_width'] = '0';
$config['max_height'] = '0';
$config['file_name'] = $randumtime.$upload_image_file;
$this->load->library('upload');
$this->upload->initialize($config);
if (isset($_FILES['image']['name'])) {
$this->upload->do_upload('image');
}
$upload_data = $this->upload->data();
}
//uplod profile image code
function upload_imageprofile()
{
$this->load->model('akrsp_model1');
if($this->input->post('oldimageprofile')!='')
{
$oldfile=$this->input->post('oldimageprofile');
$vair=unlink( './assets/upload/'.$oldfile);
}
$this->upload();
$randumtime=time();
$field_name=trim(addslashes($_FILES['image']['name']));
$field_name= str_replace(' ', '_', $field_name);
$field_name=$randumtime.$field_name;
$id=$this->session->userdata('user_id');
$record=array('image'=>$field_name);
$result=$this->akrsp_model1->upload_profile_image($id,$record);
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
//upload company lgo
function upload_companlogo()
{
$this->load->model('akrsp_model1');
$this->upload();
$field_name=$_FILES['image']['name'];
$id=$this->session->userdata('user_id');
$record=array('image'=>$field_name);
$result=$this->akrsp_model1->upload_profile_imageemp($id,$record);
redirect('front_end/employee_dashboard');
}
//code for to update address
function update_address()
{
$this->form_validation->set_rules('address', 'Address', 'required');
$this->form_validation->set_rules('phone', 'phone', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
if ($this->form_validation->run() == FALSE)
{
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
else
{
$id=$this->session->userdata('user_id');
$record=array(
'address'=>$this->input->post('address'),
'phone'=>$this->input->post('phone'),
'email'=>$this->input->post('email'));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_address_can($id,$record);
$result=$data['query'];
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
}
//check email ajax function
public function email_check()
    {
        // allow only Ajax request    
        if($this->input->is_ajax_request()) 
		{
        // grab the email value from the post variable.
        $email = $this->input->post('email');
        // check in database - table name : tbl_users  , Field name in the table : email
        if(!$this->form_validation->is_unique($email, 'njobn_webusers.email')) 
		{
        // set the json object as output                  
         $this->output->set_content_type('application/json')->set_output(json_encode(array('message' => 'The email is already taken, choose another one')));
            }
        }
    }
	
public function email_check_rec()
    {
        // allow only Ajax request    
        if($this->input->is_ajax_request()) 
		{
        // grab the email value from the post variable.
        $email = $this->input->post('email');
        // check in database - table name : tbl_users  , Field name in the table : email
        if(!$this->form_validation->is_unique($email, 'njobn_webusers.email')) 
		{
        // set the json object as output                  
         $this->output->set_content_type('application/json')->set_output(json_encode(array('recmessage' => 'The email is already taken, choose another one')));
            }
        }
    }	
//add can location
public function add_can_location()
{
//code for to get locations id
$seect_p_location=mysql_query("select * from countries where name='".$this->input->post('p_location')."'");
$fethc_p_location=mysql_fetch_array($seect_p_location);
$p_location=$fethc_p_location['id'];
$candidate_id=$this->session->userdata('user_id');
//code for to check 5 loactions
$this->db->where('candidate_id',$candidate_id);
$query = $this->db->get('candidate_locations');
if($query->num_rows() > 4)
{
$this->session->set_flashdata('mesage', 'you have only add up to 5 locations');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
//second check for laready exit
$sql=mysql_query("SELECT * FROM  candidate_locations WHERE candidate_id='".$candidate_id."' and  location_id='".$p_location."'");
$count=mysql_num_rows($sql);
if($count > 0)
{
$this->session->set_flashdata('mesage', 'This Location is already in use');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
//code for to add can location
$record=array('candidate_id'=>$candidate_id,
'location_id'=>$p_location,
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_can_locations($record);
$this->session->set_flashdata('mesage', 'Locations Added Successfully');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');											  
}	
//delete location
public function delete_location()
{
$id=$this->input->get('id');
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->delete_job_locatoion($id);
$this->session->set_flashdata('mesage', 'Location Deleted Successfully');	
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
//delete short list job
public function delete_shortlistjob()
{
$id=$this->input->get('id');
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->delete_shortlisjob($id);
$this->session->set_flashdata('short_list', 'Short List Job Deleted Successfully');	
redirect('front_end/shortlist');
}
//delete_language
public function delete_language()
{
$id=$this->input->get('id');
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->delete_language1($id);
$this->session->set_flashdata('languages_for_data', 'Language Deleted Successfully');	
redirect('front_end/candidate_dashboard?languages_for_data=languages_for_data');
}
//code for to delete sector
public function delete_sector()
{
$id=$this->input->get('id');
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->delete_sector($id);
$this->session->set_flashdata('mesage1', 'Sector Deleted Successfully');	
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
//code to show the data on edit page

public  function edit_location()
{		
$id=$this->input->get('id');
$can_id=$this->session->userdata('user_id');
$pas=array('id'=>$id);
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->read_joblocation_record($pas);
if($result)
{
$data['query']=$this->akrsp_model1->read_joblocation_record($pas);
if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('edit_location',$data);
	}

}   
}

//code for to update location
public  function edit_can_location()
{
//code for to update location
//code for to get locations id
$seect_p_location=mysql_query("select * from countries where name='".$this->input->post('p_location')."'");
$fethc_p_location=mysql_fetch_array($seect_p_location);
$p_location=$fethc_p_location['id'];
$candidate_id=$this->session->userdata('user_id');
$location_table_id=$this->input->post('location_table_id');

//second check for laready exit
$sql=mysql_query("SELECT * FROM  candidate_locations WHERE candidate_id='".$candidate_id."' and  location_id='".$p_location."'");
$count=mysql_num_rows($sql);
if($count > 0)
{
$this->session->set_flashdata('mesage', 'This Location is already in use');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
//code for to add can location
$record=array('candidate_id'=>$candidate_id,
'location_id'=>$p_location,
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_can_locations($location_table_id,$record);
$this->session->set_flashdata('mesage', 'Locations Updated Successfully');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');  
}
// add looking for form data in dah board
function add_looking_for()
{
$this->form_validation->set_rules('salary_from', 'Salary From', 'required');
$this->form_validation->set_rules('salary_to', 'Salary To', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->session->set_flashdata('looking_for_message', 'Some fields are empty');	
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
}
else
{
//code for to get job id 
//code for add job industeries
$counter_secters=count($_POST['secters']);
if($this->input->post('sectors_counter')==3 && $counter_secters >0)
{
$this->session->set_flashdata('looking_for_message', 'You have only add up to 3 sectors');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
exit;
}

$counter_job_type=count($_POST['job_type']);
if($counter_job_type ==0)
{
$this->session->set_flashdata('looking_for_message', 'must select only one option for the job type');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
exit;
}
$candidate_id=$this->session->userdata('user_id');
$record=array('candidate_id'=>$candidate_id,
'salary_from'=>$this->input->post('salary_from'),
'currency'=>$this->input->post('currency'),
'salary_to'=>$this->input->post('salary_to'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_can_prfile_data($candidate_id,$record);
$insert_product=mysql_query("update njobn_webusers set gre_job='".$this->input->post('gre_job')."' where user_id='".$candidate_id."'");
//code for to update job type
$delet_job=mysql_query("Delete from job_type where cand_id='".$candidate_id."'");
foreach ($_POST['job_type'] as $selectedOption)
{
if($selectedOption!=0)
{
if($delet_job)
{
$sql_update=mysql_query("insert into job_type set cand_id='".$candidate_id."',
						                     date='".date("Y/m/d")."',
						                     job_type_id='".$selectedOption."'");

}
}
}
//check for up to 3
foreach ($_POST['secters'] as $selectedOption1)
{
if($selectedOption1!=0)
{
//add induteries
$sqlsectors=mysql_query("SELECT * FROM  candidate_industeries WHERE candidate_id='".$candidate_id."' and  industeries_id='".$selectedOption1."'");
$countsectord=mysql_num_rows($sqlsectors);
if($countsectord > 0)
{
$this->session->set_flashdata('looking_for_message', 'This Sector is already in use');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');
exit;
}
$sql_update_indueries=mysql_query("insert into candidate_industeries set 
                                             candidate_id='".$candidate_id."',
						                     date='".date("Y/m/d")."',
						                     industeries_id='".$selectedOption1."'");
}
}
$this->session->set_flashdata('looking_for_message', 'Information Updated Successfully');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');	
}
}
//edit sectors
public  function edit_sectors()
{		
$id=$this->input->get('id');
$can_id=$this->session->userdata('user_id');
$pas=array('id'=>$id);
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->read_sector_record($pas);
if($result)
{
$data['query']=$this->akrsp_model1->read_sector_record($pas);
$this->load->view('edit_sectors',$data);
}   
}
//edit personal information
public  function edit_personalinfo()
{		
$can_id=$this->session->userdata('user_id');
$pas=array('user_id'=>$can_id);
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->read_personalinfo($pas);
if($result)
{
$data['query']=$this->akrsp_model1->read_personalinfo($pas);
if($this->session->userdata('logged')!=true)
{
$this->success_page();
}
else
{
$this->load->view('edit_personalinfo',$data);
}
}   
}
//code for to update personal nformation
public  function edit_can_personal()
{
$can_id=$this->session->userdata('user_id');
$record=array('summery'=>$this->input->post('summery'));
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->update_personal_record($can_id,$record);
if($result)
{
$this->session->set_flashdata('mesage_personalnfo', 'Personal Information Updated Successfully');			
redirect('front_end/candidate_dashboard?looking_for_data=looking_for_data');						
}	
}
//code to show the contact us page
public function contactus()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		$this->load->view('contactus',$data);		
}
//code to send email contact us
public function contact_us()
{
$this->form_validation->set_rules('name', 'Name', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('category', 'Category', 'required');
$this->form_validation->set_rules('subject', 'Subject', 'required');
$this->form_validation->set_rules('message', 'Message', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->contactus();
}
else
{
//code for to send email
$name=$this->input->post('name');
$email=$this->input->post('email');
$category=$this->input->post('category');
$subject=$this->input->post('subject');
$message=$this->input->post('message');
$this->load->model('akrsp_model1');
$sendemail=$this->akrsp_model1->send_contact_email($name,$email,$category,$subject,$message);
if($sendemail)
{
$this->session->set_flashdata('mesage_contactus', 'Message send successfully');			
redirect('front_end/contactus');		
}
}
}
//code for view cv

public function viewcvcand()
{

$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to show the aboout us page conent
		$pas=array('id'=>7);
        $get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
		$data['aboutconent'] = $get_homepage_conetnt;
		if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('viewcvcand',$data);
	}	
		
}
//code for to show about us page
public function aboutus()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to show the aboout us page conent
		$pas=array('id'=>7);
        $get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
		$data['aboutconent'] = $get_homepage_conetnt;
		
		$this->load->view('aboutus',$data);		
}
public function salary_calculator()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to show the aboout us page conent
		$pas=array('id'=>7);
        $get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
		$data['aboutconent'] = $get_homepage_conetnt;
		
		$this->load->view('salary_calculator',$data);		
}
//code fro page cv build
public function cvbuild()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to show the aboout us page conent
		$pas=array('id'=>11);
        $get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
		$data['cvbuilding'] = $get_homepage_conetnt;
		
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
				
/*	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{*/
		$this->load->view('cvbuild',$data);
	/*}*/	

}

//code for to show team page 
public function team_page()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		//code for to show the aboout us page conent
		$pas=array('id'=>10);
        $get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
		$data['aboutconent'] = $get_homepage_conetnt;
		$team_get=$this->akrsp_model1->read_team_record();
		$data['teamlist'] = $team_get;
		$this->load->view('team_page',$data);		
}
//tema deatils page
public function team_detail()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		
		$this->load->view('team_detail',$data);		
}
//code for to show testimonials
public function testimonials_candidate()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		
		
		$this->load->view('testimonials_candidate',$data);		
}
public function testimonials_employee()
{
$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		
		$this->load->view('testimonials_employee',$data);		
}
public function your_cv()
{
	    
		//code for to get website setting data
		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		 
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;				
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('your_cv',$data);
	}	

}
//upload cv code 
function uploadcvcand()
{
$randumtime=time();
$upload_image_file = trim(addslashes($_FILES['image']['name']));
$upload_image_file = str_replace(' ', '_', $upload_image_file);
$config['upload_path'] = './assets/upload/';
$config['allowed_types'] = 'doc|docx|pdf|rtf|txt';
$config['max_size'] = '20000';
$config['max_width'] = '0';
$config['max_height'] = '0';
$config['file_name'] =$randumtime.$upload_image_file;
$this->load->library('upload');
$this->upload->initialize($config);
if (isset($_FILES['image']['name'])) {
$this->upload->do_upload('image');
}
$upload_data = $this->upload->data();
}
function upload_cv()
{
if ($_FILES["image"]["size"] > 1024000) 
{
$this->session->set_flashdata('mesage_file_upoad', 'Max File size is 1MB');			
redirect('front_end/your_cv');
}

else
{
//cv upload code
if($_FILES['image']['name'] =='')
{
$field_name=$this->input->post('cv_file'); 
}
else
{
if($this->input->post('cv_file')!='')
{
$oldfile=$this->input->post('cv_file');
//echo './assets/upload/'.$oldfile;
//exit;
$vair=unlink( './assets/upload/'.$oldfile);
}
$this->uploadcvcand();
$randumtime=time();
$field_name=trim(addslashes($_FILES['image']['name']));
$field_name= str_replace(' ', '_', $field_name);
$field_name=$randumtime.$field_name;
}

$record=array('cv_file'=>$field_name);
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_file_record($record);
$this->session->set_flashdata('mesage_file_upoad', 'CV uploaded successfully');			
redirect('front_end/your_cv');
}
}
//cv download code 
function download_cv()
{
$field_name=$this->input->get('document');
$image_path ='./assets/upload/'.$field_name;
$data = file_get_contents($image_path); // Read the file's contents
force_download($field_name, $data);
redirect('front_end/your_cv');
}
function download_cv_by_recuerts()
{
$cahnge_the_status=mysql_query("update cv_counters set download_by='".$this->session->userdata('user_id')."' where candidate_id='".$_GET['cand_id']."'");
$field_name=$this->input->get('document');
$image_path ='./assets/upload/'.$field_name;
$data = file_get_contents($image_path); // Read the file's contents
force_download($field_name, $data);
redirect('front_end/viewcandidate_dashboard?cand_id='.$_GET['cand_id']);
}
//code for add cover latter infoormatoon 

function upload_cover_latter()
{
$record=array('cover_info'=>$this->input->post('cover_information'));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_cover_record($record);
$this->session->set_flashdata('mesage_cover_latter', 'Information updated successfully');			
redirect('front_end/your_cv');
}
//code for to add work hostory
function add_work_hostory()
{


$this->form_validation->set_rules('job_title', 'Job Title', 'required');
$this->form_validation->set_rules('cname', 'Comapny Name', 'required');
if($this->input->post('currently') !=1)
{
$this->form_validation->set_rules('fmonth', 'From Month', 'required');
$this->form_validation->set_rules('fyear', 'From Year', 'required');
$this->form_validation->set_rules('tmonth', 'To Month', 'required');
$this->form_validation->set_rules('tyear', 'To Year', 'required');
}
$this->form_validation->set_rules('details', 'Details', 'required');

if ($this->form_validation->run() == FALSE)
{
$this->candidate_dashboard();
}
else
{
$record=array(
'candidate_id'=>$this->session->userdata('user_id'),
'job_title'=>$this->input->post('job_title'),
'cname'=>$this->input->post('cname'),
'details'=>$this->input->post('details'),
'fmonth'=>$this->input->post('fmonth'),
'fyear'=>$this->input->post('fyear'),
'tmonth'=>$this->input->post('tmonth'),
'tyear'=>$this->input->post('tyear'),
'currently'=>$this->input->post('currently'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_workhostrt_record($record);
$this->session->set_flashdata('mesage_work_history', 'Information Added successfully');
redirect('front_end/candidate_dashboard?work_history_data=work_history_data');
}
}
//delete work history
public function delete_workhistory()
{
$id=$this->input->get('id');
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->delete_work_history($id);
$this->session->set_flashdata('mesage_work_history', 'Work History Information Deleted Successfully');	
redirect('front_end/candidate_dashboard?work_history_data=work_history_data');
}
//code for to update work history
public  function edit_workhistory()
{		
$id=$this->input->get('id');
$can_id=$this->session->userdata('user_id');
$pas=array('work_id'=>$id);
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->read_workhistory_record($pas);
if($result)
{
$data['query']=$this->akrsp_model1->read_workhistory_record($pas);
if($this->session->userdata('logged')!=true)
	{
	$this->success_page();
	}
	else
	{
		$this->load->view('edit_workhistory',$data);
	}

}   
}
//update work hiostory
function update_work_hostory()
{
$this->form_validation->set_rules('job_title', 'Job Title', 'required');
$this->form_validation->set_rules('cname', 'Comapny Name', 'required');
if($this->input->post('currently') !=1)
{
$this->form_validation->set_rules('fmonth', 'From Month', 'required');
$this->form_validation->set_rules('fyear', 'From Year', 'required');
$this->form_validation->set_rules('tmonth', 'To Month', 'required');
$this->form_validation->set_rules('tyear', 'To Year', 'required');
}
$this->form_validation->set_rules('details', 'Details', 'required');

if ($this->form_validation->run() == FALSE)
{
$this->session->set_flashdata('mesage_work_history', 'Some fields are empty');	
redirect('front_end/candidate_dashboard?work_history_data=work_history_data');
}
else
{
$work_id=$this->input->post('work_id');
$record=array(
'candidate_id'=>$this->session->userdata('user_id'),
'job_title'=>$this->input->post('job_title'),
'cname'=>$this->input->post('cname'),
'details'=>$this->input->post('details'),
'fmonth'=>$this->input->post('fmonth'),
'fyear'=>$this->input->post('fyear'),
'tmonth'=>$this->input->post('tmonth'),
'tyear'=>$this->input->post('tyear'),
'currently'=>$this->input->post('currently'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_workhistory_record($record,$work_id);
$this->session->set_flashdata('mesage_work_history', 'Information Updated successfully');			
redirect('front_end/candidate_dashboard?work_history_data=work_history_data');
}
}
//add qulifications
function add_qualifications()
{
$this->form_validation->set_rules('type', 'Qualification Type', 'required');
$this->form_validation->set_rules('school_name', 'School / University Name', 'required');
$this->form_validation->set_rules('subject', 'Subject', 'required');
$this->form_validation->set_rules('qualifications_details', 'Details', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->session->set_flashdata('qualifications_secure_data', 'Some fields are empty');			
redirect('front_end/candidate_dashboard?qualifications_secure_data=qualifications_secure_data');
}
else
{
$record=array(
'candidate_id'=>$this->session->userdata('user_id'),
'type'=>$this->input->post('type'),
'school_name'=>$this->input->post('school_name'),
'qualifications_details'=>$this->input->post('qualifications_details'),
'fyear'=>$this->input->post('fyear'),
'tyear'=>$this->input->post('tyear'),
'subject'=>$this->input->post('subject'),
'grade'=>$this->input->post('grade'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->add_qualifications_record($record);
$this->session->set_flashdata('qualifications_secure_data', 'Information Added successfully');			
redirect('front_end/candidate_dashboard?qualifications_secure_data=qualifications_secure_data');
}
}
//delete work history
public function delete_qualifications()
{
$id=$this->input->get('id');
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->delete_qualifications_recorde($id);
$this->session->set_flashdata('qualifications_secure_data', 'Qualifications Information Deleted Successfully');			
redirect('front_end/candidate_dashboard?qualifications_secure_data=qualifications_secure_data');
}
//code to show the edit qualifications
public  function edit_qualifications()
{		
$id=$this->input->get('id');
$pas=array('qualifications_id'=>$id);
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->read_qualifications_record($pas);
if($result)
{
$data['query']=$this->akrsp_model1->read_qualifications_record($pas);
if($this->session->userdata('logged')!=true)
	{
	$this->success_page();
	}
	else
	{
		$this->load->view('edit_qualifications',$data);
	}

}   
}
//code to update qualifations data 
function update_qualifications()
{
$this->form_validation->set_rules('type', 'Qualification Type', 'required');
$this->form_validation->set_rules('school_name', 'School / University Name', 'required');
$this->form_validation->set_rules('subject', 'Subject', 'required');
$this->form_validation->set_rules('qualifications_details', 'Details', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->session->set_flashdata('qualifications_secure_data', 'Some fields are empty');			
redirect('front_end/candidate_dashboard?qualifications_secure_data=qualifications_secure_data');
}
else
{
$qualifications_id=$this->input->post('qualifications_id');
$record=array(
'candidate_id'=>$this->session->userdata('user_id'),
'type'=>$this->input->post('type'),
'school_name'=>$this->input->post('school_name'),
'qualifications_details'=>$this->input->post('qualifications_details'),
'fyear'=>$this->input->post('fyear'),
'tyear'=>$this->input->post('tyear'),
'subject'=>$this->input->post('subject'),
'grade'=>$this->input->post('grade'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_qualificationstable_record($record,$qualifications_id);		
$this->session->set_flashdata('qualifications_secure_data', 'Information Updated successfully');			
redirect('front_end/candidate_dashboard?qualifications_secure_data=qualifications_secure_data');
}
}
//code to add skills
function add_skillsdata()
{
$seect_p_skills=mysql_query("select * from skills where skill_name='".$this->input->post('job_skills')."'");
$fethc_p_skills=mysql_fetch_array($seect_p_skills);
$p_skills=$fethc_p_skills['skill_id'];
//code for to add locatins id
$this->db->where('skill_id',$p_skills);
$this->db->where('candidate_id',$this->session->userdata('user_id'));
$query = $this->db->get('candidate_skills');
if($query->num_rows() > 0)
{
$this->session->set_flashdata('mesage_skills', 'The skill which you entered already in use');			
redirect('front_end/candidate_dashboard?skill_data=skill_data');
exit;	
}

$insert_skills=mysql_query("insert into candidate_skills set  candidate_id='".$this->session->userdata('user_id')."',
                                                                    skill_id='".$p_skills."',
																	date='".date("Y/m/d")."'");
																	
$this->session->set_flashdata('mesage_skills', 'Skills Added successfully');			
redirect('front_end/candidate_dashboard?skill_data=skill_data');																	
}		
//add licenses
function license_data()
{
//code for to add locatins id
$this->db->where('candidate_id',$this->session->userdata('user_id'));
$query = $this->db->get('candidate_license');
if($query->num_rows() > 0)
{
$update_skills=mysql_query("update  candidate_license set    licensecheck1='".$this->input->post('licensecheck1')."',
                                                             carcheck1='".$this->input->post('carcheck1')."',
															 date='".date("Y/m/d")."'
															 where candidate_id='".$this->session->userdata('user_id')."'");
$this->session->set_flashdata('license_data_form', 'Information Saved successfully');			
redirect('front_end/candidate_dashboard?license_data_form=license_data_form');
exit;	
}
$insert_skills=mysql_query("insert into candidate_license set  licensecheck1='".$this->input->post('licensecheck1')."',
                                                             carcheck1='".$this->input->post('carcheck1')."',
															  date='".date("Y/m/d")."',
															   candidate_id='".$this->session->userdata('user_id')."'");
$this->session->set_flashdata('license_data_form', 'Information Saved successfully');			
redirect('front_end/candidate_dashboard?license_data_form=license_data_form');															
}	
//delete code for skill
//code for to delete sector
public function delete_skill()
{
$id=$this->input->get('id');
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->delete_skills($id);
$this->session->set_flashdata('mesage_skills', 'Skill Deleted Successfully');	
redirect('front_end/candidate_dashboard?skill_data=skill_data');
}	
public function add_language()
{

//code for to get locations id
$seect_p_language=mysql_query("select * from languages where language_name='".$this->input->post('p_language')."'");
$fethc_p_language=mysql_fetch_array($seect_p_language);
$p_language=$fethc_p_language['language_id'];
$candidate_id=$this->session->userdata('user_id');
//code for to check 5 loactions
$this->db->where('candidate_id',$candidate_id);
$query = $this->db->get('candidate_language');
if($query->num_rows() > 3)
{
$this->session->set_flashdata('languages_for_data', 'you have only add up to 3 Languages');			
redirect('front_end/candidate_dashboard?languages_for_data=languages_for_data');
}
//second check for laready exit
$sql=mysql_query("SELECT * FROM  candidate_language WHERE candidate_id='".$candidate_id."' and  language_id='".$p_language."'");
$count=mysql_num_rows($sql);
if($count > 0)
{
$this->session->set_flashdata('languages_for_data', 'This Languag is already in use');			
redirect('front_end/candidate_dashboard?languages_for_data=languages_for_data');
}
//code for to add can languages
$record=array('candidate_id'=>$candidate_id,
'language_id'=>$p_language,
'type'=>$this->input->post('type'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_can_languages($record);
$this->session->set_flashdata('languages_for_data', 'Languages Added Successfully');			
redirect('front_end/candidate_dashboard?languages_for_data=languages_for_data');											  
}	
//code to show the edit languages
public  function update_languages()
{		
$id=$this->input->get('id');
$can_id=$this->session->userdata('user_id');
$pas=array('language_id'=>$id);
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->read_joblanguages_record($pas);
if($result)
{
$data['query']=$this->akrsp_model1->read_joblanguages_record($pas);
if($this->session->userdata('logged')!=true)
	{
    $this->success_page();
	}
	else
	{
		$this->load->view('update_languages',$data);
	}

}   
}
//code for to update the languges
public  function edit_can_language()
{
//code for to get locations id
$seect_p_language=mysql_query("select * from languages where language_name='".$this->input->post('p_language')."'");
$fethc_p_language=mysql_fetch_array($seect_p_language);
$p_language=$fethc_p_language['language_id'];
$candidate_id=$this->session->userdata('user_id');
//code for to check 5 loactions
$this->db->where('candidate_id',$candidate_id);
$query = $this->db->get('candidate_language');
if($query->num_rows() > 3)
{
$this->session->set_flashdata('languages_for_data', 'you have only add up to 3 Languages');			
redirect('front_end/candidate_dashboard?languages_for_data=languages_for_data');
}
//second check for laready exit
$sql=mysql_query("SELECT * FROM  candidate_language WHERE candidate_id='".$candidate_id."' and  language_id='".$p_language."' AND type='".$this->input->post('type')."'");
$count=mysql_num_rows($sql);
if($count > 0)
{
$this->session->set_flashdata('languages_for_data', 'This Language is already in use');			
redirect('front_end/candidate_dashboard?languages_for_data=languages_for_data');
}
//code for to add can location
$language_table_id=$this->input->post('language_table_id');
$record=array('candidate_id'=>$candidate_id,
'language_id'=>$p_language,
'type'=>$this->input->post('type'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_can_languages($language_table_id,$record);
$this->session->set_flashdata('languages_for_data', 'Language Updated Successfully');			
redirect('front_end/candidate_dashboard?languages_for_data=languages_for_data');  
}	
public function add_personal_inforation()
{
$seect_jobs=mysql_query("select * from njobn_jobdetails where job_title='".$this->input->post('job_title')."'");
$fethc_jobs=mysql_fetch_array($seect_jobs);
$job_id=$fethc_jobs['job_id'];
$candidate_id=$this->session->userdata('user_id');
$record=array('job_id'=>$job_id,
'fname'=>$this->input->post('fname'),
'lname'=>$this->input->post('lname'),
'nationailty'=>$this->input->post('nationailty'),
'emp_satus'=>$this->input->post('emp_satus'),
'phone'=>$this->input->post('phone'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_per_info_cand($candidate_id,$record);
$this->session->set_flashdata('myprofile_data', 'Information Updated Successfully');			
redirect('front_end/myaccount?myprofile_data=myprofile_data');  
}
public function add_address	()
{
if($this->input->post('countryname')!='')
{
//get cpuntry id from counteriestable
$sel_countries1=mysql_query("select * from countries where name='".$this->input->post('countryname')."'");
$fethch_counries1=mysql_fetch_array($sel_countries1);
$country_id=$fethch_counries1['id'];
}
else
{
$country_id=$this->input->post('country');
}
$candidate_id=$this->session->userdata('user_id');
$record=array('address'=>$this->input->post('address'),
'city'=>$this->input->post('city'),
'postcode'=>$this->input->post('postcode'),
'country'=>$country_id,
'phone'=>$this->input->post('phone'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_per_info_cand($candidate_id,$record);
$this->session->set_flashdata('address_data', 'Information Updated Successfully');			
redirect('front_end/myaccount?address_data=address_data');  
}
public function change_email()
{

$candidate_id=$this->session->userdata('user_id');
$record=array('email'=>$this->input->post('email'));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_per_info_cand($candidate_id,$record);
//code for to send email
$sel_admin_data=mysql_query("select * from njobn_users where group_id=9");
$fetach_admin_data=mysql_fetch_array($sel_admin_data);
$fromemail=$fetach_admin_data['email'];
$name=$this->session->userdata('fname');
$emailnew=$this->input->post('email');
$to=$this->session->userdata('email');
					/*$config = array(
					'wordwrap' => TRUE,
					'mailtype' => 'html'
					);
					$this->load->library('email', $config);
					$this->email->from($fromemail,'JOB-N-JOB');
					$this->email->to($this->input->post('email')); 
					$this->email->subject('JOB-N-JOB change email address request.');
					$this->email->message("<strong>Dear ".$this->session->userdata('fname').",</strong><br><br>
Thank you for request on JOB-N-JOB <br>
Your new email address is.<br>
".$this->input->post('email')."<br>
<strong>Best Regards,</strong><br>
<strong>JOB-N-JOB</strong>");*/
$subject="Job N Job change email request";					
$body = "Dear $name<br>".
"Thank you for request at Job N Job.<br>".
"Your new email: $emailnew<br>".
"Best Regards<br>".
"Job N Job<br>";	
$headers = "From: " . strip_tags($fromemail) . "\r\n";
$headers .= "Reply-To: ". strip_tags($fromemail) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail=mail($to, $subject, $body,$headers);	
if($mail)
{
$this->session->set_flashdata('account_details', 'Email Updated Successfully');			
redirect('front_end/myaccount?account_details=account_details');  
}
}		
public function change_password()
{

$candidate_id=$this->session->userdata('user_id');
$record=array('password'=>md5($this->input->post('password')),
             'pass'=>$this->input->post('password'));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_per_info_cand($candidate_id,$record);
//code for to send email
$sel_admin_data=mysql_query("select * from njobn_users where group_id=9");
$fetach_admin_data=mysql_fetch_array($sel_admin_data);
$fromemail=$fetach_admin_data['email'];
$name=$this->session->userdata('fname');
$pass=$this->input->post('password');
$to=$this->session->userdata('email');
					/*$config = array(
					'wordwrap' => TRUE,
					'mailtype' => 'html'
					);
					$this->load->library('email', $config);
					$this->email->from($fromemail,'JOB-N-JOB');
					$this->email->to($this->session->userdata('email')); 
					$this->email->subject('JOB-N-JOB change email password request.');
					$this->email->message("<strong>Dear ".$this->session->userdata('fname').",</strong><br><br>
Thank you for request on JOB-N-JOB <br>
Your new password is.<br>
".$this->input->post('password')."<br>
<strong>Best Regards,</strong><br>
<strong>JOB-N-JOB</strong>");*/
$subject="Job N Job change password request";					
$body = "Dear $name<br>".
"Thank you for request at Job N Job.<br>".
"Your new password: $pass <br>".
"Best Regards<br>".
"Job N Job<br>";	
$headers = "From: " . strip_tags($fromemail) . "\r\n";
$headers .= "Reply-To: ". strip_tags($fromemail) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail=mail($to, $subject, $body,$headers);	
if($mail)
{
$this->session->set_flashdata('account_details', 'Password Updated Successfully');			
redirect('front_end/myaccount?account_details=account_details');  
}
}
public function save_contact_alert()
{

$candidate_id=$this->session->userdata('user_id');
$record=array('alert_email'=>$this->input->post('alert_email'),
              'alert_my_account'=>$this->input->post('alert_my_account'),
			  'alert_products'=>$this->input->post('alert_products'),
			  'alert_therid_party'=>$this->input->post('alert_therid_party'),
			  'alert_my_profile'=>$this->input->post('alert_my_profile'));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_per_info_cand($candidate_id,$record);
$this->session->set_flashdata('contact_details', 'Contact Preferences saved successfully');			
redirect('front_end/myaccount?contact_details=contact_details'); 
 
}		
public function add_shortlist()
{
if($this->session->userdata('logged')!=true)
	{
		$this->success_page();
		}
		else
		{
$candidate_id=$this->session->userdata('user_id');
$job_id=$this->input->get('job_id');
$job_order=$this->input->get('job_order');
//second check for laready exit
$sql=mysql_query("SELECT * FROM  shot_listjob WHERE candidate_id='".$candidate_id."' and  job_id='".$job_id."'");
$count=mysql_num_rows($sql);
if($count > 0)
{
$this->session->set_flashdata('short_list', 'This Job is already in use');	
if($this->input->get('shortjoblist')=='shortjoblist')
{	
redirect('front_end/joblisting?job_order='.$job_order);
}
else
{
redirect('front_end/jobdetails?job_id='.$job_id);
}		
}
//code for to add can languages
$record=array('candidate_id'=>$candidate_id,
'job_id'=>$job_id,
'created_by'=>$candidate_id,
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_shortlistjob($record);
$this->session->set_flashdata('short_list', 'Job short listed Successfully');	
if($this->input->get('shortjoblist')=='shortjoblist')
{	
redirect('front_end/joblisting?job_order='.$job_order);
}
else
{
redirect('front_end/jobdetails?job_id='.$job_id);
}
}											  
}
public function appl_job()
{
if($this->session->userdata('user_type')==2)
{
redirect('front_end/myaccount?myprofile_data=myprofile_data');
exit;
}
if($this->session->userdata('logged')!=true)
{
$this->success_page();
}
else
{
$candidate_id=$this->session->userdata('user_id');
$job_id=$this->input->get('job_id');
//second check for laready exit
$sql=mysql_query("SELECT * FROM  candidate_listjobs WHERE candidate_id='".$candidate_id."' and  job_id='".$job_id."'");
$count=mysql_num_rows($sql);
if($count > 0)
{
$this->session->set_flashdata('job_list', 'This Job is already in use');			
redirect('front_end/jobdetails?job_id='.$job_id);
exit;
}
//code for to add can languages
$record=array('candidate_id'=>$candidate_id,
'job_id'=>$job_id,
'created_by'=>$candidate_id,
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->apply_job($record);
$this->session->set_flashdata('job_list', 'You have Successfully apply for the job');			
redirect('front_end/jobdetails?job_id='.$job_id);
}											  
}
public function appl_job1()
{
if($this->session->userdata('logged')!=true)
	{
		$this->success_page();
		}
		else
		{
$candidate_id=$this->session->userdata('user_id');
$job_id=$this->input->get('job_id');
//second check for laready exit
$sql=mysql_query("SELECT * FROM  candidate_listjobs WHERE candidate_id='".$candidate_id."' and  job_id='".$job_id."'");
$count=mysql_num_rows($sql);
if($count > 0)
{
$this->session->set_flashdata('short_list', 'This Job is already in use');			
redirect('front_end/shortlist');
exit;
}
//code for to add can languages
$record=array('candidate_id'=>$candidate_id,
'job_id'=>$job_id,
'created_by'=>$candidate_id,
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->apply_job($record);
$this->session->set_flashdata('short_list', 'You have Successfully apply for the job');			
redirect('front_end/shortlist');
}											  
}	
//code for to send email
public  function sendemail_to_users()
{		
$id=$this->input->get('job_id');
//code for to send email
$candidate_id=$this->session->userdata('user_id');	
$sel_users_email=mysql_query("select * from  njobn_webusers where user_id='".$candidate_id."'");
$sel_fetc_useremail=mysql_fetch_array($sel_users_email);
$from =$sel_fetc_useremail['email'];
$name=$sel_fetc_useremail['fname'];
$to =trim($this->input->post('email'));
$linkurl=$this->input->post('job_link');
$message=$this->input->post('message');
$subject="A job link has been shared with you from JOB-N-JOB";
$body = "$name has shared a review with you from JOB-N-JOB<br>".
"Job Link: $linkurl <br>".
"Message: $message\n";	
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if(mail($to, $subject,$body,$headers))
{
$this->session->set_flashdata('sendemail', 'Job link send successfully');			
//$this->load->view('sendemail');
redirect($linkurl);
}
	}

public  function sendemail()
{		
if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
		$this->load->view('sendemail');
	} 
}	
public function add_job_details()
{	
//error_reporting(0);
//auto number
$counter_secters=count($_POST['secters']);
if($counter_secters >2)
{
$this->session->set_flashdata('mesagejobpost', 'You have only add up to 2 sectors');			
redirect('front_end/recruiters');
exit;
}
$record=array('company_name'=>$this->input->post('company_name'),
'job_des'=>$this->input->post('job_des'),
'job_type'=>$this->input->post('job_type'),
'currency'=>$this->input->post('currency'),
'job_title'=>$this->input->post('job_title'),
'job_refernce'=>$this->input->post('job_refernce'),
'job_salary_from'=>$this->input->post('job_salary_from'),
'job_salary_to'=>$this->input->post('job_salary_to'),
'displaySalary'=>$this->input->post('displaySalary'),
'job_salary_info'=>$this->input->post('job_salary_info'),
'job_location_id'=>$this->input->post('job_location_id'),
'job_postalcode'=>$this->input->post('job_postalcode'),
'carLevel'=>$this->input->post('carLevel'),
'gender'=>$this->input->post('gender'),
'exp'=>$this->input->post('exp'),
'total_postions'=>$this->input->post('total_postions'),
'job_shift'=>$this->input->post('job_shift'),
'fage'=>$this->input->post('fage'),
'tage'=>$this->input->post('tage'),
'job_status'=>$this->input->post('job_status'),
'job_contact_fname'=>$this->input->post('job_contact_fname'),
'job_contact_lname'=>$this->input->post('job_contact_lname'),
'job_contact_email'=>$this->input->post('job_contact_email'),
'telephone'=>$this->input->post('telephone'),
'address'=>$this->input->post('address'),
'city'=>$this->input->post('city'),
'state'=>$this->input->post('state'),
'postcode'=>$this->input->post('postcode'),
'exp_date'=>$this->input->post('exp_date'),
'degreetitle'=>$this->input->post('degreetitle'),
'comapny_image'=>$this->input->post('image'),
'created_by'=>$this->session->userdata('user_id'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->insert_job_add_record($record);
$result=$data['query'];
//code for send email alert
//get the job id 
$criteria=$this->input->post('job_title');

$seect_jobs=mysql_query("SELECT * from njobn_jobdetails WHERE `job_title` LIKE '%$criteria%'");
while($fethc_jobs=mysql_fetch_array($seect_jobs))
{
$job_id=$fethc_jobs['job_id'];
//get the users who get job email alert
$sel_webusers=mysql_query("select * from njobn_webusers where job_id='".$job_id."' AND alert_email=1");
while ($fetch_useremails=mysql_fetch_array($sel_webusers))
{
$email_list.= $fetch_useremails['email'].",";
}
//mail($to,$subject, $body,$headers);
//echo $email_list;	
}
//get JOBnjob admin email
$job_title=$this->input->post('job_title');
$sel_admin_data=mysql_query("select * from njobn_users where group_id=9");
$fetach_admin_data=mysql_fetch_array($sel_admin_data);
$from=$fetach_admin_data['email'];
$email_list = rtrim($email_list,',');
//echo $email_list;
$subject="Job N Job alert";					
$body = "Dear Candidate<br>".
"A new job $job_title has been posted on Job N Job which match your profile.<br>".
"Please visit our job n job portal<br>".
"Best Regards<br>".
"Job N Job<br>";	
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail=mail($email_list, $subject, $body,$headers);	
if($mail)
{					
$this->session->set_flashdata('mesagejobpost', 'Job post added successfully');	
redirect('front_end/recruiters');
}
}	
//delete job post
public function delete_jobpost()
{
$id=$this->input->get('id');
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->delete_job_postdelete($id);
$this->session->set_flashdata('mesagejobpost', 'Job post deleted successfully');	
redirect('front_end/recruiters');
}		
//code to show the eidt job page post page
public  function editjob()
{
if($this->session->userdata('user_type')==1)
{
redirect('front_end/myaccount?myprofile_data=myprofile_data');
exit;
}

		$this->load->model('akrsp_model1');
		//code for to get website setting data
		$result=$this->akrsp_model1->read_website_record();
        $data['querywebsetting'] = $result;
		//code for to get banner image
		 $data['querybaneer'] = $result;
		//code for to get footer content
		$get_web_setting=$this->akrsp_model1->read_website_record();
		$data['footer_data'] = $get_web_setting;
		//code for to get continue profile information
		if($this->session->userdata('user_type')==1)
		{	
			$id=$this->session->userdata('user_id');
			$pas=array('candidate_id'=>$id);
			$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
			$data['footer_data1'] = $get_pr_data;
		}
		else
		{
		$id=$this->session->userdata('user_id');
		$pas=array('employee_id'=>$id);
		$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
		$data['footer_data1'] = $get_pr_data;
		
		}
		//email,address,phone code
		$user_id=array('user_id'=>$id);
		$get_address_email=$this->akrsp_model1->read_adress_email($user_id);
		$data['profile'] = $get_address_email;
		//get locations for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_locations=$this->akrsp_model1->get_can_locations($candidate_id);
		$data['get_can_locations'] = $get_can_locations;
	  	//code for to show job types on listing page
	    $candidate_id=array('cand_id'=>$id);
        $get_job_type=$this->akrsp_model1->get_job_typees($candidate_id);
		$data['get_job_types'] = $get_job_type;
		//get sectors for cand_dahaboard
		$candidate_id=array('candidate_id'=>$id);
        $get_can_sectors=$this->akrsp_model1->get_can_sectors($candidate_id);
		$data['get_can_sectors'] = $get_can_sectors;
		//code for to show work history in grid table
		$get_work_history_data=$this->akrsp_model1->read_work_history_data($id);
		$data['work_history'] = $get_work_history_data;	
		//code for to show qualificatins data  in grid table
		$get_qualifications_data=$this->akrsp_model1->qualificatins_grid_data($id);
		$data['qualifications_data'] = $get_qualifications_data;
		//code for to show skills
		$get_skills_data=$this->akrsp_model1->qualificatins_skills_data($id);
		$data['skilss_data'] = $get_skills_data;
		
		$get_license_data=$this->akrsp_model1->qualificatins_license_data($id);
		$data['license_data'] = $get_license_data;
		//get langusges
		$candidate_id=array('candidate_id'=>$id);
        $get_can_languages=$this->akrsp_model1->get_can_languages($candidate_id);
		$data['get_can_languages'] = $get_can_languages;
		//get data of job listing page
		$get_jobdetails_data=$this->akrsp_model1->read_viewjobsdeatilss_record1($id);
		$data['query_jobdestils']=$get_jobdetails_data;
		
	if($this->session->userdata('logged')!=true)
	{
	
		$this->success_page();
	}
	else
	{
	//code to show the edit page
	$idrec=$this->input->get('id');
$idrec=array('job_id'=>$idrec);
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->read_jobedit_record($idrec);
if($result)
{
$data['query']=$this->akrsp_model1->read_jobedit_record($idrec);
$this->load->view('editjob',$data);
} 	
	}				
  
}		
//code for to update jobdatils	
public function update_job_details()
{
$counter_secters=count($_POST['secters']);
if($counter_secters >2)
{
$this->session->set_flashdata('mesagejobpost', 'You have only add up to 2 sectors');			
redirect('front_end/recruiters');
exit;
}
$id=$this->input->post('job_id');
//auto number
$record=array('company_name'=>$this->input->post('company_name'),
'job_des'=>$this->input->post('job_des'),
'job_type'=>$this->input->post('job_type'),
'job_title'=>$this->input->post('job_title'),
'currency'=>$this->input->post('currency'),
'job_refernce'=>$this->input->post('job_refernce'),
'job_salary_from'=>$this->input->post('job_salary_from'),
'job_salary_to'=>$this->input->post('job_salary_to'),
'job_status'=>$this->input->post('job_status'),
'displaySalary'=>$this->input->post('displaySalary'),
'job_salary_info'=>$this->input->post('job_salary_info'),
'job_location_id'=>$this->input->post('job_location_id'),
'job_postalcode'=>$this->input->post('job_postalcode'),
'carLevel'=>$this->input->post('carLevel'),
'gender'=>$this->input->post('gender'),
'exp'=>$this->input->post('exp'),
'total_postions'=>$this->input->post('total_postions'),
'job_shift'=>$this->input->post('job_shift'),
'fage'=>$this->input->post('fage'),
'tage'=>$this->input->post('tage'),
'job_contact_fname'=>$this->input->post('job_contact_fname'),
'job_contact_lname'=>$this->input->post('job_contact_lname'),
'job_contact_email'=>$this->input->post('job_contact_email'),
'telephone'=>$this->input->post('telephone'),
'address'=>$this->input->post('address'),
'city'=>$this->input->post('city'),
'state'=>$this->input->post('state'),
'postcode'=>$this->input->post('postcode'),
'exp_date'=>$this->input->post('exp_date'),
'degreetitle'=>$this->input->post('degreetitle'),
'comapny_image'=>$this->input->post('image'),
'updated_by'=>$this->session->userdata('user_id'),
'date'=>date("Y/m/d"));
$this->load->model('akrsp_model1');
$result=$this->akrsp_model1->update_jobs_record($id,$record);
if($result)
{				
$this->session->set_flashdata('mesagejobpost', 'Job post updated successfully');	
redirect('front_end/recruiters');			
}	
}	
//code to show JNJ CAREER ADVICE page
		public function career_advice()
		{
			$this->load->model('akrsp_model1');
			//code for to get website setting data
			$result=$this->akrsp_model1->read_website_record();
			$data['querywebsetting'] = $result;
			//code for to get banner image
			$data['querybaneer'] = $result;
			//code for to get footer content
			$get_web_setting=$this->akrsp_model1->read_website_record();
			$data['footer_data'] = $get_web_setting;
			if($this->session->userdata('user_type')==1)
			{	
				$id=$this->session->userdata('user_id');
				$pas=array('candidate_id'=>$id);
				$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
				$data['footer_data1'] = $get_pr_data;
			}
			else
			{
				$id=$this->session->userdata('user_id');
				$pas=array('employee_id'=>$id);
				$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
				$data['footer_data1'] = $get_pr_data;
				
			}
			//code for to show the aboout us page conent
			$pas=array('id'=>12);
			$get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
			$data['aboutconent'] = $get_homepage_conetnt;
			$career_get=$this->akrsp_model1->read_team_record();
			$data['career'] = $career_get;
			$this->load->view('career_advice', $data);		
		}
		
		
		//code to show JNJ TRAINING COURSES page
		public function training_courses()
		{
			$this->load->model('akrsp_model1');
			//code for to get website setting data
			$result=$this->akrsp_model1->read_website_record();
			$data['querywebsetting'] = $result;
			//code for to get banner image
			$data['querybaneer'] = $result;
			//code for to get footer content
			$get_web_setting=$this->akrsp_model1->read_website_record();
			$data['footer_data'] = $get_web_setting;
			if($this->session->userdata('user_type')==1)
			{	
				$id=$this->session->userdata('user_id');
				$pas=array('candidate_id'=>$id);
				$get_pr_data=$this->akrsp_model1->read_profile_record($pas);
				$data['footer_data1'] = $get_pr_data;
			}
			else
			{
				$id=$this->session->userdata('user_id');
				$pas=array('employee_id'=>$id);
				$get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
				$data['footer_data1'] = $get_pr_data;
				
			}
			//code to show the aboout us page conent
			$pas=array('id'=>13);
			$get_homepage_conetnt=$this->akrsp_model1->read_editcmspage_record($pas);
			$data['aboutconent'] = $get_homepage_conetnt;
			$training_get=$this->akrsp_model1->read_team_record();
			$data['training'] = $training_get;
			$this->load->view('training_courses', $data);		
		}
// linkedin profile code
public function linkedin()
{
$candidate_id=$this->session->userdata('user_id');
$record=array('linkedin'=>$this->input->post('linkedin'));
$this->load->model('akrsp_model1');
$data['query']=$this->akrsp_model1->update_per_info_cand($candidate_id,$record);
$this->session->set_flashdata('account_details', 'LinkedIn Updated Successfully');	
redirect('front_end/myaccount?account_details=account_details');
}	
public function recover_password()
{ $this->load->model('akrsp_model1');
   //code for to get website setting data
   $result=$this->akrsp_model1->read_website_record();
   $data['querywebsetting'] = $result;
   //code for to get banner image
   $data['querybaneer'] = $result;
   //code for to get footer content
   $get_web_setting=$this->akrsp_model1->read_website_record();
   $data['footer_data'] = $get_web_setting;
   if($this->session->userdata('user_type')==1)
   { 
    $id=$this->session->userdata('user_id');
    $pas=array('candidate_id'=>$id);
    $get_pr_data=$this->akrsp_model1->read_profile_record($pas);
    $data['footer_data1'] = $get_pr_data;
   }
   else
   {
    $id=$this->session->userdata('user_id');
    $pas=array('employee_id'=>$id);
    $get_pr_data=$this->akrsp_model1->read_profile_recordemp($pas);
    $data['footer_data1'] = $get_pr_data;
    
   }
   
   $this->load->view('recover_password_frontend', $data);
}

public function forgot_password()
{
 $this->form_validation->set_rules('email', 'Email', 'required');
 $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
 if ($this->form_validation->run() == FALSE)
 { 
  $this->session->set_flashdata('error_msg', 'Enter valid Email');    
  redirect('front_end/recover_password');
  exit;
 }
 else
 {
  $email=$this->input->post('email');
  //get data from users tables
  $sel_user_data=mysql_query("select * from njobn_webusers where email='".$email."'");
  $fetach_user_data=mysql_fetch_array($sel_user_data);
  $fname=$fetach_user_data['fname'];
  $lname=$fetach_user_data['lname'];
  $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  $charactersLength = strlen($characters);
  $randomString = '';
  for ($i = 0; $i < 8; $i++) {
   $randomString .= $characters[rand(0, $charactersLength - 1)];
  }
  
  //get email address for admin
  $sel_admin_data=mysql_query("select * from njobn_users where group_id=9");
  $fetach_admin_data=mysql_fetch_array($sel_admin_data);
  $fromemail=$fetach_admin_data['email'];
  
  $this->db->where('email', $email);
  $query = $this->db->get('njobn_webusers');
  if($query->num_rows() != 1)
  {
   
   $this->session->set_flashdata('error_msg', 'Email Not Found');              
   redirect('front_end/recover_password');
   exit;
  }
  
  $candidate_id = $fetach_user_data['user_id'];
  $record = array('password'=>md5($randomString));
  $this->load->model('akrsp_model1');
  $data['query']=$this->akrsp_model1->update_per_info_cand($candidate_id, $record);
  $name = $fname." ".$lname;
  $password = $randomString;
  $to = $this->input->post('email');
  $subject="Job N Job change password request";     
  $body = "Dear $name<br>".
  "Your password at Job N Job has been reseted.<br>".
  "Your new password: $password <br>".
  "Best Regards<br>".
  "Job N Job<br>"; 
  $headers = "From: " . strip_tags($fromemail) . "\r\n";
  $headers .= "Reply-To: ". strip_tags($fromemail) . "\r\n";
  $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  $mail=mail($to, $subject, $body,$headers); 
  if($mail)
  {
   $this->session->set_flashdata('success_msg', 'Password Updated Successfully');   
   redirect('front_end/recover_password');  
  }
 
 }
 }
//ajax code for find location
public function find_loactions()
		{
		// Get the postcode from the request
$postcode = $_REQUEST['postcode'];

// Get the latitude & longitude of submitted postcode
$postcode = urlencode($postcode);
$query = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $postcode . '&sensor=false';

$result = json_decode(file_get_contents($query));
$lat = $result->results[0]->geometry->location->lat;
$lng = $result->results[0]->geometry->location->lng;

// Get the address based on returned lat & long
$address_url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' . $lat . ',' . $lng . '&sensor=false';
$address_json = json_decode(file_get_contents($address_url));
$address_data = $address_json->results[0]->address_components;
foreach($address_data as $data):
  $array[$data->types[0]] = $data->long_name;
endforeach;
echo json_encode($array);
		}			
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */