f2a40c268b
1. Have to test and deploy in server. 2. add faculty detail into employee table and student detail into employee table, 3. Change Teaching Assistant into multiple select 4. User Profile
114 lines
2.7 KiB
PHP
114 lines
2.7 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Role extends CI_Controller {
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('Role_model');
|
|
$this->load->model('Commonsql_model');
|
|
|
|
}
|
|
|
|
public function listrole()
|
|
{
|
|
if($this->session->userdata('id')==""){redirect('');}
|
|
$data['rol']=$this->Role_model->list_rol();
|
|
$this->load->view('roles/role_list',$data);
|
|
}
|
|
function addrole()
|
|
{
|
|
if($this->session->userdata('id')==""){redirect('');}
|
|
$currentUser=$this->session->userdata('id');
|
|
|
|
if($this->input->post('submit'))
|
|
{
|
|
$role=$this->input->post('rolename');
|
|
|
|
$table="role";
|
|
|
|
$values=array('name'=>$role,
|
|
'createdOn'=>date('Y-m-d'),
|
|
'createdBy'=>$currentUser,
|
|
'status'=>1);
|
|
|
|
$result=$this->Commonsql_model->insert_table($table,$values);
|
|
if($result)
|
|
{
|
|
$this->session->set_userdata('suc','successfully added');
|
|
redirect('roles');
|
|
}
|
|
else
|
|
{
|
|
$this->session->set_userdata('err','Please try again');
|
|
redirect('roles');
|
|
}
|
|
|
|
}
|
|
}
|
|
function editrole()
|
|
{
|
|
if($this->session->userdata('id')==""){redirect('');}
|
|
$currentUser=$this->session->userdata('id');
|
|
|
|
if($this->input->post('submit'))
|
|
{
|
|
$rolename=$this->input->post('rolename');
|
|
$primaryid=$this->input->post('hiddenroleid');
|
|
|
|
$table="role";
|
|
$where=array("id"=>$primaryid);
|
|
$values=array('name'=>$rolename,
|
|
'updatedOn'=>date('Y-m-d'),
|
|
'updatedBy'=>$currentUser,
|
|
'status'=>1);
|
|
|
|
$result=$this->Commonsql_model->updateTable($table,$where,$values);
|
|
//echo $this->db->last_query();exit;
|
|
if($result)
|
|
{
|
|
$this->session->set_userdata('suc','successfully Updated');
|
|
redirect('roles');
|
|
}
|
|
else
|
|
{
|
|
$this->session->set_userdata('err','Please try again');
|
|
redirect('roles');
|
|
}
|
|
//echo $this->db->last_query();exit;
|
|
}
|
|
$this->load->view('roles/role_list',$data);
|
|
}
|
|
function deleterole()
|
|
{
|
|
if($this->session->userdata('id')==""){redirect('');}
|
|
$currentUser=$this->session->userdata('id');
|
|
|
|
if($this->input->post('submit'))
|
|
{
|
|
|
|
$primaryid=$this->input->post('hiddengffgdtpid');
|
|
//echo $primaryid ; exit;
|
|
$table="role";
|
|
$where=array("id"=>$primaryid);
|
|
$values=array(
|
|
'status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser);
|
|
|
|
$result=$this->Commonsql_model->updateTable($table,$where,$values);
|
|
if($result)
|
|
{
|
|
$this->session->set_userdata('suc','successfully deleted');
|
|
redirect('roles');
|
|
|
|
}
|
|
else
|
|
{
|
|
$this->session->set_userdata('err','Please try again');
|
|
redirect('roles');
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|