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

class Employee extends CI_Controller {
    function __construct()
 	{
	    parent::__construct();
		$this->load->helper('url');
		$this->load->helper('form');
		$this->load->model('common');
		$this->load->library('session');
	//	$this->load->database();
		$this->load->library(array('form_validation','template'));
	}

	public function index()   
	{
		$data["employs"] = $this->common->readdatafromcollectionwhereclause("Employs");
		$this->template->template_render('employee_information', $data); 
	}

	public function addEmployee()   
	{
		$data = $this->input->post();
		$data["id"] = time();
		$this->common->adddatamodel("Employs", $data["id"], $data);
		$this->session->set_flashdata('successmessage', 'New Employee added successfully');
		redirect('employee');
	}


	public function delete_employee($id){
		$response = $this->common->deletedatamodel("Employs", $id);
		$this->session->set_flashdata('successmessage', 'Employee Deleted');
		redirect('Employee');
	}
	
}
