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

class StateControllers extends CI_Controller {

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

	 	public function __construct(){
		parent::__construct();
		$this->load->library("form_validation");
		$this->load->model("StateModel");
		$this->load->library('upload');

    }

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

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



	public function index()
    	{

        	$this->load->view('admin/header');
 	//	$this->load->view('add_sub_gallery');
 			$this->load->view('admin/add_state');

	}


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


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


		public function insertInfo(){
		$data = array(

			'NAME' => $this->input->post('NAME')

		);

    	$id = $this->AreaModel->insertInfo('area_tb', $data);

			if($id){
		$this->session->set_flashdata('msg', 'Post Your Inquiry.');
		redirect("StateControllers/index");
	}else{
		$this->session->set_flashdata('msg', 'some error...');
		redirect("StateControllers/index");
	}


	}


		public function manageInfo()
    	{

       	$result['all_info'] = $this->StateModel->selectInfo('area_tb', array());

			$this->load->view('admin/header');
						$this->load->view('admin/manage_state',$result);



	}

	public function manageFront()
		{


			$result['front_all_info'] = $this->StateModel->selectFrontInfo();

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

}

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

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

			 function getInfoById() {
     $id = $this->uri->segment(3);
      $data['single_data'] = $this->StateModel->getInfoById($id);

	$this->load->view('admin/header');
       $this->load->view('admin/edit_state', $data);
      }

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

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


       function updateInfoById() {

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

  $data = array(
   'NAME' => $this->input->post('NAME'),
	  'STATUS' => $this->input->post('STATUS')
);
$this->StateModel->updateInfoById($id,$data);

	redirect("StateControllers/manageInfo");


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

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

		//	print_r($id); die;

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

		redirect("StateControllers/manageInfo");
			}

}
