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

class Performance extends MY_Controller
{
	function __construct()
	{
		parent::__construct();

		if($this->logged_user = $this->session->userdata('user')){
			$this->login->checkModuleAccess(4);
			$this->logged_module = $_SESSION['module_data'];
		} else {
			redirect(base_url());
		}

		$this->load->model('hr/model_performance');
	}

	public function index()
	{
		$data = array(
			'page_setup' => $this->template->pageSetup('HR', '', 'Staff Performance Dashboard'),
		);

		if($this->logged_module['role'] == 'admin'){

			$data['staff_list'] = $this->model_performance->getEmploymentDetail();

			$this->template->view('hr/performance/admin_dashboard', $data);
		}else{

			$data['staff_list'] = $this->model_performance->getEmploymentDetail($this->logged_user['department_id']);

			$this->template->view('hr/performance/moderator_dashboard', $data);
		}
		
	}

}