167 lines
3.9 KiB
PHP
167 lines
3.9 KiB
PHP
|
<?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'))
|
||
|
{
|
||
|
$faculty=$this->input->post('faculty');
|
||
|
$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');
|
||
|
$desi=$this->input->post('desigation');
|
||
|
$f_img=$this->input->post('f_img');
|
||
|
|
||
|
$table="faculty";
|
||
|
$values=array('code'=>$faculty,
|
||
|
'name'=>$name,
|
||
|
'email'=>$email,
|
||
|
//'dob'=>$dob,
|
||
|
'gender'=>$gender,
|
||
|
'mobile'=>$number,
|
||
|
'address'=>$address,
|
||
|
'desigation'=>$desi,
|
||
|
'f_img'=>$f_img,
|
||
|
'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'))
|
||
|
{
|
||
|
$faculty=$this->input->post('faculty');
|
||
|
$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');
|
||
|
$desi=$this->input->post('desigation');
|
||
|
$f_img=$this->input->post('f_img');
|
||
|
|
||
|
|
||
|
$table="faculty";
|
||
|
$where=array("id"=>$id);
|
||
|
$values=array('code'=>$faculty,
|
||
|
'name'=>$name,
|
||
|
'email'=>$email,
|
||
|
//'dob'=>$dob,
|
||
|
'gender'=>$gender,
|
||
|
'mobile'=>$number,
|
||
|
'address'=>$address,
|
||
|
'desigation'=>$desi,
|
||
|
'f_img'=>$f_img,
|
||
|
'update_on'=>date('Y-m-d'),
|
||
|
'update_by'=>1,
|
||
|
'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');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|