D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
cas
/
application
/
models
/
admin
/
Filename :
DocumentInfoManagement.php
back
Copy
<?php /** * Model Class For Handling All DB Operations Related To Document Info * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class DocumentInfoManagement extends CI_Model { function createNewDocumentInfo(array $newDocumentInfo) { $this->db->insert('tbl_document_document_info', $newDocumentInfo); return $this->db->insert_id(); } function createNewDocumentInfoMulti(array $newStudentDocumentsBatch) { $this->db->insert_batch('tbl_document_document_info', $newStudentDocumentsBatch); return $this->db->insert_id(); } function getAllDocumentsOfStudentBy($tspi_id) { $this->db->select('*'); $this->db->from('tbl_document_document_info TDDI'); $this->db->join('tbl_document_master TDOCM', 'TDDI.tddi_doc_id = TDOCM.doc_id'); $this->db->where('TDDI.tddi_mapping_id', $tspi_id); $this->db->where('TDDI.tddi_user_type_flag', "S"); return $this->db->get(); } function getUploadedDocumentOfStudentBy($tspi_id, $doc_id) { $this->db->select('*'); $this->db->from('tbl_document_document_info TDDI'); $this->db->where('TDDI.tddi_doc_id', $doc_id); $this->db->where('TDDI.tddi_mapping_id', $tspi_id); $this->db->where('TDDI.tddi_user_type_flag', "S"); return $this->db->get(); } function getUploadedDocumentOfEmployeeBy($smember_id, $doc_id) { $this->db->select('*'); $this->db->from('tbl_document_document_info TDDI'); $this->db->where('TDDI.tddi_doc_id', $doc_id); $this->db->where('TDDI.tddi_mapping_id', $smember_id); $this->db->where('TDDI.tddi_user_type_flag', "E"); return $this->db->get(); } function getDocumentInfoBy($tddi_id) { $this->db->select('*'); $this->db->from('tbl_document_document_info TDDI'); $this->db->where('TDDI.tddi_id', $tddi_id); return $this->db->get(); } function isDocumentUploaded($mapping_id, $doc_id, $type) { $this->db->select('*'); $this->db->from('tbl_document_document_info TDDI'); $this->db->where('TDDI.tddi_mapping_id', $mapping_id); $this->db->where('TDDI.tddi_doc_id', $doc_id); $this->db->where('TDDI.tddi_user_type_flag', $type); $result = $this->db->get()->result(); if (sizeof($result)) { return TRUE; } else { return FALSE; } } function updateStudentDocumentInfoMulti(array $studentDocumentUpdateInfoBatch) { return $this->db->update_batch('tbl_document_document_info', $studentDocumentUpdateInfoBatch, 'tddi_id'); } function deleteDocumentInfoEntryBy($tddi_id) { $this->db->where("tddi_id", $tddi_id); $this->db->delete('tbl_document_document_info'); } function deleteStudentDocumentInfoEntry($tspi_id) { $this->db->where("tddi_mapping_id", $tspi_id); $this->db->where("tddi_user_type_flag", "S"); $this->db->delete('tbl_document_document_info'); return $this->db->insert_id(); } /* Functions For Document Issue Management */ function createNewDocumentIssueInfo(array $newDocumentIssueInfo) { $this->db->insert('tbl_document_issue_info', $newDocumentIssueInfo); return $this->db->insert_id(); } function isDocumentIssued($doc_id, $tspi_id) { $this->db->select('*'); $this->db->from('tbl_document_issue_info TDII'); $this->db->where('TDII.tdii_doc_id', $doc_id); $this->db->where('TDII.tdii_doc_issued_to', $tspi_id); $this->db->where('TDII.tdii_doc_issue_status', 'T'); $result = $this->db->get()->result(); if (sizeof($result)) { return TRUE; } else { return FALSE; } } function getIssuedDocumentInfoBy($doc_id, $tspi_id) { $this->db->select("TDII.tdii_id,TDII.tdii_doc_id,TDII.tdii_doc_issued_on,TDII.tdii_doc_issue_status," . "TDII.tdii_doc_issue_user_type_flag,TDII.tdii_doc_issued_to,TDII.tdii_doc_unique_code,TDOCM.doc_name," . "TDII.tdii_doc_file_path,TDII.tdii_doc_issued_by,TDII.tdii_duplicate_status," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) issuedByAdmin"); $this->db->from('tbl_document_issue_info TDII'); $this->db->join('tbl_document_master TDOCM', 'TDII.tdii_doc_id = TDOCM.doc_id'); $this->db->join('tbl_staff_members TSMA', 'TDII.tdii_doc_issued_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->where('TDII.tdii_doc_id', $doc_id); $this->db->where('TDII.tdii_doc_issued_to', $tspi_id); $this->db->where('TDII.tdii_doc_issue_status', 'T'); $this->db->order_by('TDII.tdii_doc_issued_on', 'desc'); return $this->db->get(); } function getIssuedDocumentInfoByIssueId($tdii) { $this->db->select("TDII.tdii_id,TDII.tdii_doc_id,TDII.tdii_doc_issued_on,TDII.tdii_doc_issue_status," . "TDII.tdii_doc_issue_user_type_flag,TDII.tdii_doc_issued_to,TDII.tdii_doc_unique_code,TDOCM.doc_name," . "TDII.tdii_doc_file_path,TDII.tdii_doc_issued_by,TDII.tdii_duplicate_status,TDII.tdii_doc_content," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) issuedByAdmin"); $this->db->from('tbl_document_issue_info TDII'); $this->db->join('tbl_document_master TDOCM', 'TDII.tdii_doc_id = TDOCM.doc_id'); $this->db->join('tbl_staff_members TSMA', 'TDII.tdii_doc_issued_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->where('TDII.tdii_doc_issue_status', 'T'); $this->db->where('TDII.tdii_id', $tdii); return $this->db->get(); } function updateDocumentIssueInfo(array $documentIssueUpdatedInfo) { $this->db->where('tdii_id', $documentIssueUpdatedInfo['tdii_id']); return $this->db->update('tbl_document_issue_info', $documentIssueUpdatedInfo); } }