D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
cas
/
application
/
models
/
admin
/
Filename :
DesignationManagement.php
back
Copy
<?php /** * Model For Handling All DB Operations Related To Designations * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class DesignationManagement extends CI_Model { function createNewDesignation(array $newDesignationInfo) { $this->db->insert('tbl_designation_master', $newDesignationInfo); return $this->db->insert_id(); } function getAllDesignations() { $this->db->select("TDEM.desig_id,TDEM.desig_name,TDEM.desig_desc,TDEM.desig_active_status," . "TDEM.desig_delete_status,TDEM.dcm_id,TDEM.desig_added_by,TDEM.desig_added_on," . "TDEM.desig_updated_by,TDEM.desig_updated_on,DCM.dcm_name,DCM.dcm_name," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_designation_master TDEM'); $this->db->join('designation_category_mst DCM', 'TDEM.dcm_id = DCM.dcm_id'); $this->db->join('tbl_staff_members TSMA', 'TDEM.desig_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDEM.desig_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TDEM.desig_updated_on", "desc"); return $this->db->get(); } function getDesignationInfoBy($desig_id) { $this->db->select("TDEM.desig_id,TDEM.desig_name,TDEM.desig_desc,TDEM.desig_active_status," . "TDEM.desig_delete_status,TDEM.dcm_id,TDEM.desig_added_by,TDEM.desig_added_on," . "TDEM.desig_updated_by,TDEM.desig_updated_on,DCM.dcm_name,DCM.dcm_name," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_designation_master TDEM'); $this->db->join('designation_category_mst DCM', 'TDEM.dcm_id = DCM.dcm_id'); $this->db->join('tbl_staff_members TSMA', 'TDEM.desig_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDEM.desig_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where('TDEM.desig_id', $desig_id); return $this->db->get(); } function getDesignationInfoByName($desig_name) { $this->db->select("TDEM.desig_id,TDEM.desig_name,TDEM.desig_desc,TDEM.desig_active_status," . "TDEM.desig_delete_status,TDEM.dcm_id,TDEM.desig_added_by,TDEM.desig_added_on," . "TDEM.desig_updated_by,TDEM.desig_updated_on,DCM.dcm_name,DCM.dcm_name," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_designation_master TDEM'); $this->db->join('designation_category_mst DCM', 'TDEM.dcm_id = DCM.dcm_id'); $this->db->join('tbl_staff_members TSMA', 'TDEM.desig_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDEM.desig_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where('TDEM.desig_name', $desig_name); return $this->db->get(); } function isDesignationNameSafeUpdate($desig_id, $desig_name) { $this->db->select("*"); $this->db->from('tbl_designation_master'); $this->db->where('desig_name', $desig_name); $this->db->where('desig_id != ' . $desig_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function getActiveNonDeletedDesignationsUnderGivenCategory($desig_cat_id) { $this->db->select("*"); $this->db->from('tbl_designation_master TDESIGM'); $this->db->where("TDESIGM.desig_active_status", "T"); $this->db->where("TDESIGM.desig_delete_status", "F"); $this->db->where("TDESIGM.dcm_id", $desig_cat_id); $this->db->order_by("TDESIGM.desig_updated_on", "desc"); return $this->db->get(); } function updateDesignationInfo(array $designationUpdatedInfo) { $this->db->where('desig_id', $designationUpdatedInfo['desig_id']); return $this->db->update('tbl_designation_master', $designationUpdatedInfo); } /* Functions For Designation Categories */ function createNewDesignationCategory(array $newDesignationCategoryInfo) { $this->db->insert('designation_category_mst', $newDesignationCategoryInfo); return $this->db->insert_id(); } function getAllDesignationCategories() { $this->db->select("TDCM.dcm_id,TDCM.dcm_name,TDCM.dcm_short_name,TDCM.dcm_description,TDCM.dcm_active_status,TDCM.dcm_delete_status," . "TDCM.dcm_added_by,TDCM.dcm_added_on,TDCM.dcm_updated_by,TDCM.dcm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('designation_category_mst TDCM'); $this->db->join('tbl_staff_members TSMA', 'TDCM.dcm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDCM.dcm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TDCM.dcm_updated_on", "desc"); return $this->db->get(); } function getActiveNonDeletedDesignationCategories() { $this->db->select("TDCM.dcm_id,TDCM.dcm_name,TDCM.dcm_short_name,TDCM.dcm_description,TDCM.dcm_active_status,TDCM.dcm_delete_status," . "TDCM.dcm_added_by,TDCM.dcm_added_on,TDCM.dcm_updated_by,TDCM.dcm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('designation_category_mst TDCM'); $this->db->join('tbl_staff_members TSMA', 'TDCM.dcm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDCM.dcm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TDCM.dcm_active_status", "T"); $this->db->where("TDCM.dcm_delete_status", "F"); $this->db->order_by("TDCM.dcm_updated_on", "desc"); return $this->db->get(); } function getDesignationCategoryBy($desig_cat_id) { $this->db->select("TDCM.dcm_id,TDCM.dcm_name,TDCM.dcm_short_name,TDCM.dcm_description,TDCM.dcm_active_status,TDCM.dcm_delete_status," . "TDCM.dcm_added_by,TDCM.dcm_added_on,TDCM.dcm_updated_by,TDCM.dcm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('designation_category_mst TDCM'); $this->db->join('tbl_staff_members TSMA', 'TDCM.dcm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDCM.dcm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TDCM.dcm_id", $desig_cat_id); return $this->db->get(); } function getDesignationCategoryByName($desig_cat_name) { $this->db->select("TDCM.dcm_id,TDCM.dcm_name,TDCM.dcm_short_name,TDCM.dcm_description,TDCM.dcm_active_status,TDCM.dcm_delete_status," . "TDCM.dcm_added_by,TDCM.dcm_added_on,TDCM.dcm_updated_by,TDCM.dcm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('designation_category_mst TDCM'); $this->db->join('tbl_staff_members TSMA', 'TDCM.dcm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDCM.dcm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TDCM.dcm_name", $desig_cat_name); return $this->db->get(); } function getDesignationCategoryByShortName($desig_cat_short_name) { $this->db->select("TDCM.dcm_id,TDCM.dcm_name,TDCM.dcm_short_name,TDCM.dcm_description,TDCM.dcm_active_status,TDCM.dcm_delete_status," . "TDCM.dcm_added_by,TDCM.dcm_added_on,TDCM.dcm_updated_by,TDCM.dcm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('designation_category_mst TDCM'); $this->db->join('tbl_staff_members TSMA', 'TDCM.dcm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDCM.dcm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TDCM.dcm_short_name", $desig_cat_short_name); return $this->db->get(); } function isDesignationCategoryNameSafeUpdate($desig_cat_id, $desig_cat_name) { $this->db->select("*"); $this->db->from('designation_category_mst'); $this->db->where('dcm_name', $desig_cat_name); $this->db->where('dcm_id != ' . $desig_cat_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isDesignationCategoryShortNameSafeUpdate($desig_cat_id, $desig_cat_short_name) { $this->db->select("*"); $this->db->from('designation_category_mst'); $this->db->where('dcm_short_name', $desig_cat_short_name); $this->db->where('dcm_id != ' . $desig_cat_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updateDesignationCategoryInfo(array $designationCategoryUpdatedInfo) { $this->db->where('dcm_id', $designationCategoryUpdatedInfo['dcm_id']); return $this->db->update('designation_category_mst', $designationCategoryUpdatedInfo); } }