2023-01-05 12:19:39 +00:00
|
|
|
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
|
|
class Faculty extends CI_Controller {
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->load->model('Faculty_model');
|
|
|
|
$this->load->model('Commonsql_model');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Index Page for this controller.
|
|
|
|
*
|
|
|
|
* Maps to the following URL
|
|
|
|
* http://example.com/index.php/welcome
|
|
|
|
* - or -
|
|
|
|
* http://example.com/index.php/welcome/index
|
|
|
|
* - or -
|
|
|
|
* Since this controller is set as the default controller in
|
|
|
|
* config/routes.php, it's displayed at http://example.com/
|
|
|
|
*
|
|
|
|
* So any other public methods not prefixed with an underscore will
|
|
|
|
* map to /index.php/welcome/<method_name>
|
|
|
|
* @see https://codeigniter.com/user_guide/general/urls.html
|
|
|
|
*/
|
|
|
|
public function faculty_list()
|
|
|
|
{
|
|
|
|
$data['fac']=$this->Faculty_model->list_fa();
|
|
|
|
$this->load->view('faculty/faculty_list',$data);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function add_faculty()
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->load->view('faculty/add_faculty');
|
|
|
|
|
|
|
|
if($this->input->post('submit'))
|
|
|
|
{
|
2023-01-06 07:23:42 +00:00
|
|
|
$faculty=$this->input->post('code');
|
2023-01-05 12:19:39 +00:00
|
|
|
$name=$this->input->post('name');
|
|
|
|
$email=$this->input->post('email');
|
|
|
|
//$dob=$this->input->post('dob');
|
|
|
|
$gender=$this->input->post('gender');
|
2023-01-06 07:23:42 +00:00
|
|
|
$number=$this->input->post('mobile');
|
2023-01-05 12:19:39 +00:00
|
|
|
$address=$this->input->post('address');
|
2023-01-06 07:23:42 +00:00
|
|
|
$desi=$this->input->post('designation');
|
|
|
|
$f_img=$this->input->post('image');
|
2023-01-05 12:19:39 +00:00
|
|
|
|
|
|
|
$table="faculty";
|
|
|
|
$values=array('code'=>$faculty,
|
|
|
|
'name'=>$name,
|
|
|
|
'email'=>$email,
|
|
|
|
//'dob'=>$dob,
|
|
|
|
'gender'=>$gender,
|
|
|
|
'mobile'=>$number,
|
|
|
|
'address'=>$address,
|
2023-01-06 07:23:42 +00:00
|
|
|
'designation'=>$desi,
|
|
|
|
'image'=>$f_img,
|
2023-01-05 12:19:39 +00:00
|
|
|
'created_on'=>date('Y-m-d'),
|
|
|
|
'created_by'=>1,
|
|
|
|
'status'=>1);
|
|
|
|
$result=$this->Commonsql_model->insert_table($table,$values);
|
|
|
|
if($result)
|
|
|
|
{
|
|
|
|
$this->session->set_userdata('suc','successfully added');
|
|
|
|
redirect('faculty');
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->session->set_userdata('err','Please try again');
|
|
|
|
redirect('faculty');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function edit_faculty($id)
|
|
|
|
{
|
|
|
|
|
|
|
|
$data['fac']=$this->Faculty_model->get_fac($id);
|
|
|
|
$this->load->view('faculty/edit_faculty',$data);
|
|
|
|
|
|
|
|
if($this->input->post('submit'))
|
|
|
|
{
|
2023-01-06 07:23:42 +00:00
|
|
|
$faculty=$this->input->post('code');
|
2023-01-05 12:19:39 +00:00
|
|
|
$name=$this->input->post('name');
|
|
|
|
$email=$this->input->post('email');
|
|
|
|
//$dob=$this->input->post('dob');
|
|
|
|
$gender=$this->input->post('gender');
|
|
|
|
$number=$this->input->post('number');
|
|
|
|
$address=$this->input->post('address');
|
2023-01-06 07:23:42 +00:00
|
|
|
$desi=$this->input->post('designation');
|
|
|
|
$f_img=$this->input->post('image');
|
2023-01-05 12:19:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
$table="faculty";
|
|
|
|
$where=array("id"=>$id);
|
|
|
|
$values=array('code'=>$faculty,
|
|
|
|
'name'=>$name,
|
|
|
|
'email'=>$email,
|
|
|
|
//'dob'=>$dob,
|
|
|
|
'gender'=>$gender,
|
|
|
|
'mobile'=>$number,
|
|
|
|
'address'=>$address,
|
2023-01-06 07:23:42 +00:00
|
|
|
'designation'=>$desi,
|
|
|
|
'image'=>$f_img,
|
|
|
|
'updated_on'=>date('Y-m-d'),
|
|
|
|
'updated_by'=>1,
|
2023-01-05 12:19:39 +00:00
|
|
|
'status'=>1);
|
|
|
|
|
|
|
|
$result=$this->Commonsql_model->updateTable($table,$where,$values);
|
|
|
|
if($result)
|
|
|
|
{
|
|
|
|
$this->session->set_userdata('suc','successfully Updated');
|
|
|
|
redirect('faculty');
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->session->set_userdata('err','Please try again');
|
|
|
|
redirect('faculty');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//echo "sdsd";exit;
|
|
|
|
|
|
|
|
//echo $this->db->last_query();exit;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleted_faculty()
|
|
|
|
{
|
|
|
|
if($this->input->post('submit'))
|
|
|
|
{
|
|
|
|
$id=$this->input->post('hiddenpass');
|
|
|
|
|
|
|
|
$table="faculty";
|
|
|
|
$where=array("id"=>$id);
|
|
|
|
$values=array(
|
|
|
|
'status'=>0);
|
|
|
|
|
|
|
|
$result=$this->Commonsql_model->updateTable($table,$where,$values);
|
|
|
|
if($result)
|
|
|
|
{
|
|
|
|
$this->session->set_userdata('suc','successfully deleted');
|
|
|
|
redirect('faculty');
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->session->set_userdata('err','Please try again');
|
|
|
|
redirect('faculty');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|