<?php
Class Dashboard Extends MY_Controller{
	function __construct()
	{
		parent::__construct();	
		$this->load->model('admin_api/Dashboard_model');
        
        //date_default_timezone_set("Asia/Kolkata");
        //date_default_timezone_get();		
	}
	public function index()
	{	
        $data['active_dashboard'] = 'open';
		$data['title'] = 'Dashboard';	
		// $data['active_doctor']=$this->Dashboard_model->get_all_active_doctors();
		// $data['inactive_doctor']=$this->Dashboard_model->get_all_deactive_doctors();
		// $data['active_patient']=$this->Dashboard_model->get_all_active_patients();	
		// $data['inactive_patient']=$this->Dashboard_model->get_all_deactive_patients();

         
    
   // print_r($data['main_role']);exit();
	$data['main_content'] = 'admin/Dashboard_view';
    $this->load->view('admin/includes/template', $data);			
	}
	
	public function competitor()
	{	
        $data['active_competitor'] = 'open';
		$data['title'] = 'competitor';	
		 $data['competitor']=$this->Dashboard_model->get_competitor_list();
		$data['main_content'] = 'admin/competitor';
		$this->load->view('admin/includes/template', $data);			
	}

	
	public function save_compitator()
	{
			$post_data = $this->input->post();
				$query=$this->Dashboard_model->save_compitator($post_data);
				if($query){
					$this->session->set_flashdata('success_message', 'Compitator Added successfully!');

					redirect('admin/Dashboard/competitor','refresh');
				}else{
					$this->session->set_flashdata('failure_message', 'You are fail to Add Compitator!');
					redirect('admin/Dashboard/competitor','refresh');
				}
	}
	
	public function update_compitator()
	{
			$post_data = $this->input->post();
				$query=$this->Dashboard_model->update_compitator($post_data);
				if($query){
					$this->session->set_flashdata('success_message', 'Compitator Update successfully!');

					redirect('admin/Dashboard/competitor','refresh');
				}else{
					$this->session->set_flashdata('failure_message', 'You are fail to update Compitator!');
					redirect('admin/Dashboard/competitor','refresh');
				}
	}
	
	public function delete_competitor($id)
	{
			//$post_data = $this->input->post();
				$query=$this->Dashboard_model->delete_competitor($id);
				if($query){
					$this->session->set_flashdata('success_message', 'Compitator deleted successfully!');

					redirect('admin/Dashboard/competitor','refresh');
				}else{
					$this->session->set_flashdata('failure_message', 'You are fail to deleted Compitator!');
					redirect('admin/Dashboard/competitor','refresh');
				}
	}


}?>