<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class IndexControllers extends CI_Controller {

//...............State construct............

	 	public function __construct(){
		parent::__construct();
		$this->load->model("IndexModel");
	  $this->load->model("SliderModel");
		  $this->load->model("CurrentUpdateModel");
			  $this->load->model("AboutModel");
				$this->load->model("EventModel");
					$this->load->model("VideoModel");



					$this->load->model("AdvertisementModel");



		$this->load->library("form_validation");


    }

    //...............End construct............

//...............State index function............



	public function index()
    	{

				$result['front_slide_all_info'] = $this->SliderModel->manageFrontSlidedInfo('slider_tb', array());
						$result['event_info'] = $this->EventModel->selectEventInfoLimit('event_table', array());
	$result['all_info'] = $this->AboutModel->selectInfoVishistsahyogiFront();
			$result['all_info_margdhrashan'] = $this->AboutModel->selectInfoMargdarshakFront();
				$result['all_info_add'] = $this->AdvertisementModel->manageFrontInfo(1);
					$result['all_info_add_top'] = $this->AdvertisementModel->manageFrontInfo(2);

				   	$result['all_info_video'] = $this->VideoModel->selectIndexInfo();

				 $this->load->view('frontheader',$result);
 			     $this->load->view('index',$result);
				$this->load->view('front_footer');

	}


	public function vichar_manch()
			{
				$result['all_info_add_top'] = $this->AdvertisementModel->manageFrontInfo(2);

		 	 $this->load->view('frontheader',$result);
			$this->load->view('vichar_manch');
				$this->load->view('front_footer');
	}


	public function thanks()
			{
				$result['all_info_add_top'] = $this->AdvertisementModel->manageFrontInfo(2);

				$this->load->view('frontheader',$result);
			$this->load->view('thanks');
				$this->load->view('front_footer');
	}




	public function contact()
			{
				$result['all_info_add_top'] = $this->AdvertisementModel->manageFrontInfo(2);

				$this->load->view('frontheader',$result);
			$this->load->view('contact');
				$this->load->view('front_footer');
	}

	//...............End index function............


	//...............State insert insertGalleryInfo............


		public function insertInfo(){
		$data = array(

			'POSITION' => $this->input->post('POSITION'),
			'specialization' => $this->input->post('specialization'),
			'qualification' => $this->input->post('qualification'),
			'post' => $this->input->post('post'),
				'DATE' => $this->input->post('DATE'),
				'scale' => $this->input->post('scale')

		);

    	$id = $this->CareerModel->insertInfo('career_tb', $data);
			if($id){
		$this->session->set_flashdata('msg', 'data inserted.');
		redirect("CareerControllers");
	}else{
		$this->session->set_flashdata('msg', 'error...');
		redirect("CareerControllers");
	}

	}

	//...............End insert insertGalleryInfo............


	//...............State Manage Subgallerty............



		//...............End Manage Subgallerty............

			//...............State Get ID Wise Subgallery Info ............


    			//...............End Get ID Wise Subgallery Info ............

    			//...............State Update Subgallery By ID ............


       function updateInfoById() {

    $id= $this->input->post('id');

  $data = array(
		'POSITION' => $this->input->post('POSITION'),
		 'specialization' => $this->input->post('specialization'),
		 'qualification' => $this->input->post('qualification'),
		 'post' => $this->input->post('post'),
			 'DATE' => $this->input->post('DATE'),
			 'scale' => $this->input->post('scale'),
	  'STATUS' => $this->input->post('STATUS')
);
$this->CareerModel->updateInfoById($id,$data);

if($id){
$this->session->set_flashdata('msg', 'data inserted.');

redirect("CareerControllers/manageCareer");
}else{
$this->session->set_flashdata('msg', 'error...');
redirect("CareerControllers/manageCareer");
}

}
   	//...............End Update Subgallery By ID ............

		public function deleteInfo()
			{
		 $id = $this->uri->segment(3);

		//	print_r($id); die;

			$this->CareerModel->deleteInfo($id);

		redirect("CareerControllers/manageCareer");
			}

}
