GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 18.116.90.161
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/pdf/../css/../../cas/application/models/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/pdf/../css/../../cas/application/models/admin/CourseManagement.php
<?php

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

class CourseManagement extends CI_Model {

    function createNewCourse(array $newCourseInfo) {
        $this->db->insert('tbl_course_master', $newCourseInfo);
        return $this->db->insert_id();
    }

    function getAllCourses() {
        $this->db->select("TCM.course_id,TCM.course_name,TCM.course_duration,TCM.course_no_of_sems,TCM.course_category,"
                . "TCM.sub_dept_id,TCM.course_time_mgmt_flag,TCM.course_full_name,TCM.course_time_type,TCM.course_approval_flag,"
                . "TCM.course_active_status,TCM.course_delete_status,TCM.course_added_by,TCM.course_added_on,TSMD.sub_dept_name,TDM.dept_id,TDM.dept_name,"
                . "TCM.course_updated_by,TCM.course_updated_on,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_course_master TCM');
        $this->db->join('tbl_sub_departments_master TSMD', 'TCM.sub_dept_id = TSMD.sub_dept_id');
        $this->db->join('tbl_department_master TDM', 'TSMD.dept_id = TDM.dept_id');
        $this->db->join('tbl_staff_members TSMA', "TCM.course_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "TCM.course_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("TCM.course_updated_on", "desc");
        return $this->db->get();
    }

    function getNonDeletedCoursesWithFullInfo() {
        $this->db->select("TCM.course_id,TCM.course_name,TCM.course_duration,TCM.course_no_of_sems,TCM.course_category,"
                . "TCM.sub_dept_id,TCM.course_time_mgmt_flag,TCM.course_full_name,TCM.course_time_type,TCM.course_approval_flag,"
                . "TCM.course_active_status,TCM.course_delete_status,TCM.course_added_by,TCM.course_added_on,TSMD.sub_dept_name,TDM.dept_id,TDM.dept_name,"
                . "TCM.course_updated_by,TCM.course_updated_on,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_course_master TCM');
        $this->db->join('tbl_sub_departments_master TSMD', 'TCM.sub_dept_id = TSMD.sub_dept_id');
        $this->db->join('tbl_department_master TDM', 'TSMD.dept_id = TDM.dept_id');
        $this->db->join('tbl_staff_members TSMA', "TCM.course_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "TCM.course_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("TCM.course_delete_status", "F");
        $this->db->order_by("TCM.course_updated_on", "desc");
        return $this->db->get();
    }

    function getCoursesBy($course_id) {
        $this->db->select("TCM.course_id,TCM.course_name,TCM.course_duration,TCM.course_no_of_sems,TCM.course_category,"
                . "TCM.sub_dept_id,TCM.course_time_mgmt_flag,TCM.course_full_name,TCM.course_time_type,TCM.course_approval_flag,"
                . "TCM.course_active_status,TCM.course_delete_status,TCM.course_added_by,TCM.course_added_on,TSMD.sub_dept_name,TDM.dept_id,TDM.dept_name,"
                . "TCM.course_updated_by,TCM.course_updated_on,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_course_master TCM');
        $this->db->join('tbl_sub_departments_master TSMD', 'TCM.sub_dept_id = TSMD.sub_dept_id');
        $this->db->join('tbl_department_master TDM', 'TSMD.dept_id = TDM.dept_id');
        $this->db->join('tbl_staff_members TSMA', "TCM.course_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "TCM.course_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("TCM.course_id", $course_id);
        return $this->db->get();
    }

    function getCourseByAlias($course_alias) {
        $this->db->select('*');
        $this->db->from('tbl_course_master');
        $this->db->where('course_name', $course_alias);
        return $this->db->get();
    }

    function getCourseByFullName($course_name) {
        $this->db->select('*');
        $this->db->from('tbl_course_master');
        $this->db->where('course_full_name', $course_name);
        return $this->db->get();
    }

    function isCourseAliasSafeUpdate($course_id, $course_alias) {
        $this->db->select("*");
        $this->db->from('tbl_course_master');
        $this->db->where('course_name', $course_alias);
        $this->db->where('course_id != ' . $course_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function isCourseNameSafeUpdate($course_id, $course_name) {
        $this->db->select("*");
        $this->db->from('tbl_course_master');
        $this->db->where('course_full_name', $course_name);
        $this->db->where('course_id != ' . $course_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function getNonDeletedCourses() {
        $this->db->select("*");
        $this->db->from('tbl_course_master TCM');
        $this->db->where('TCM.course_delete_status', 'F');
        $this->db->order_by("TCM.course_updated_on", "desc");
        return $this->db->get();
    }

    function getActiveAndNonDeletedCourses() {
        $this->db->select("*");
        $this->db->from('tbl_course_master TCM');
        $this->db->where('TCM.course_delete_status', 'F');
        $this->db->where('TCM.course_active_status', 'T');
        $this->db->order_by("TCM.course_updated_on", "desc");
        return $this->db->get();
    }

    function updateCourseInfo(array $courseUpdatedInfo) {
        $this->db->where('course_id', $courseUpdatedInfo['course_id']);
        return $this->db->update('tbl_course_master', $courseUpdatedInfo);
    }

    /* Functions For Sub-Courses */

    function getAllSubCoursesBy($course_id) {
        $this->db->select("TCSM.tcsm_id,TCSM.tcsm_course_type,TCSM.tcsm_sem_start_from,TCSM.tcsm_duration,TCSM.course_id,TCSM.tcsm_active_status");
        $this->db->from('tbl_course_sub_master TCSM');
        $this->db->where("TCSM.course_id", $course_id);
        return $this->db->get();
    }

    function getSubCourseInfoBy($course_id, $course_type) {
        $this->db->select("TCSM.tcsm_id,TCSM.tcsm_course_type,TCSM.tcsm_sem_start_from,TCSM.tcsm_duration,TCSM.course_id,TCSM.tcsm_active_status");
        $this->db->from('tbl_course_sub_master TCSM');
        $this->db->where("TCSM.course_id", $course_id);
        $this->db->where("TCSM.tcsm_course_type", $course_type);
        return $this->db->get();
    }

    function createNewSubCourse(array $newSubCourseInfo) {
        $this->db->insert('tbl_course_sub_master', $newSubCourseInfo);
        return $this->db->insert_id();
    }

    function updateSubCourseInfo(array $subCourseUpdatedInfo) {
        $this->db->where('tcsm_id', $subCourseUpdatedInfo['tcsm_id']);
        return $this->db->update('tbl_course_sub_master', $subCourseUpdatedInfo);
    }

    /* Functions For Course Profile */

    function createNewCourseProfile(array $newCourseProfileInfo) {
        $this->db->insert('course_profile', $newCourseProfileInfo);
        return $this->db->insert_id();
    }

    function getAllCourseProfile() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('course_profile CP');
        $this->db->join('tbl_univ_course_session_mapping TUCSM', 'CP.ucs_map_id = TUCSM.ucs_map_id');
        $this->db->join('tbl_session_master TSM', 'TUCSM.session_id = TSM.session_id');
        $this->db->join('tbl_course_sub_master TSCM', 'TUCSM.sub_course_id = TSCM.tcsm_id');
        $this->db->join('tbl_course_master TCM', 'TSCM.course_id = TCM.course_id');
        $this->db->join('tbl_staff_members TSMA', "CP.cp_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "CP.cp_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("CP.cp_added_on", "desc");
        return $this->db->get();
    }

    function getAllNonDeletedActiveCourseProfilesBy($ucsMapId) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('course_profile CP');
        $this->db->join('tbl_univ_course_session_mapping TUCSM', 'CP.ucs_map_id = TUCSM.ucs_map_id');
        $this->db->join('tbl_session_master TSM', 'TUCSM.session_id = TSM.session_id');
        $this->db->join('tbl_course_sub_master TSCM', 'TUCSM.sub_course_id = TSCM.tcsm_id');
        $this->db->join('tbl_course_master TCM', 'TSCM.course_id = TCM.course_id');
        $this->db->join('tbl_staff_members TSMA', "CP.cp_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "CP.cp_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("CP.ucs_map_id", $ucsMapId);
        $this->db->where("CP.cp_active_status", "T");
        $this->db->where("CP.cp_delete_status", "F");
        $this->db->order_by("CP.cp_added_on", "desc");
        return $this->db->get();
    }

    function getCourseProfileInfoBy($cpId) {
        $this->db->select("*");
        $this->db->from('course_profile CP');
        $this->db->join('tbl_univ_course_session_mapping TUCSM', 'CP.ucs_map_id = TUCSM.ucs_map_id');
        $this->db->join('tbl_session_master TSM', 'TUCSM.session_id = TSM.session_id');
        $this->db->join('tbl_course_sub_master TSCM', 'TUCSM.sub_course_id = TSCM.tcsm_id');
        $this->db->join('tbl_course_master TCM', 'TSCM.course_id = TCM.course_id');
        $this->db->where("CP.cp_id", $cpId);
        return $this->db->get();
    }

    function getCourseProfileByCourseTypeAndSession($ucsMapId, $session, $semOrYear) {
        $this->db->select("*");
        $this->db->from('course_profile CP');
        $this->db->where("CP.ucs_map_id", $ucsMapId);
        $this->db->where("CP.session_id", $session);
        $this->db->where("CP.cp_sem_or_year", $semOrYear);
        return $this->db->get();
    }

    function getCourseProfilesReport($course = '', $session = '', $entryType = '', $semOrYear = '') {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('course_profile CP');
        $this->db->join('tbl_univ_course_session_mapping TUCSM', 'CP.ucs_map_id = TUCSM.ucs_map_id');
        $this->db->join('tbl_session_master TSM', 'TUCSM.session_id = TSM.session_id');
        $this->db->join('tbl_course_sub_master TSCM', 'TUCSM.sub_course_id = TSCM.tcsm_id');
        $this->db->join('tbl_course_master TCM', 'TSCM.course_id = TCM.course_id');
        $this->db->join('tbl_staff_members TSMA', "CP.cp_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "CP.cp_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("CP.cp_active_status", "T");
        $this->db->where("CP.cp_delete_status", "F");
        /* Semester/Year Wise Wise Filter */
        if ($semOrYear != '') {
            $this->db->where("CP.cp_sem_or_year", $semOrYear);
        }
        /* Semester/Year Wise Filter */
        /* Entry Type Wise Filter */
        if ($entryType != '') {
            $this->db->where("CP.ucs_map_id", $entryType);
        }
        /* Entry Type Wise Filter */
        /* Session Wise Filter */
        if ($session != '') {
            $this->db->where("CP.session_id", $session);
        }
        /* Session Wise Filter */
        /* Course Wise Filter */
        if ($course != '') {
            $this->db->where("CP.course_id", $course);
        }
        /* Course Wise Filter */
        $this->db->order_by("CP.cp_added_on", "desc");
        return $this->db->get();
    }

    function updateCourseProfileInfo(array $courseProfileUpdatedInfo) {
        $this->db->where('cp_id', $courseProfileUpdatedInfo['cp_id']);
        return $this->db->update('course_profile', $courseProfileUpdatedInfo);
    }

    /* Functions For Course Profile */

    /* Functions For Course Closure For Admission Portal */

    function createNewCounsellingClosure(array $newCounsellingClosureInfo) {
        $this->db->insert('adm_allowed_range', $newCounsellingClosureInfo);
        return $this->db->insert_id();
    }

    function getAllCourseClosureInfo() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('adm_allowed_range AAR');
        $this->db->join('tbl_course_master TSM', "AAR.course_id = TSM.course_id");
        $this->db->join('tbl_staff_members TSMA', "AAR.aar_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "AAR.aar_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("AAR.aar_updated_on", "desc");
        return $this->db->get();
    }

    function getCounsellingClosureInfoBy($aar_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('adm_allowed_range AAR');
        $this->db->join('tbl_course_master TSM', "AAR.course_id = TSM.course_id");
        $this->db->join('tbl_staff_members TSMA', "AAR.aar_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "AAR.aar_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("AAR.aar_id", $aar_id);
        return $this->db->get();
    }

    function getCounsellingClosureInfo($course_id) {
        $this->db->select('*');
        $this->db->from('adm_allowed_range');
        $this->db->where('course_id', $course_id);
        return $this->db->get();
    }

    function updateCounsellingClosureInfo(array $counsellingClosureInfo) {
        $this->db->where('aar_id', $counsellingClosureInfo['aar_id']);
        return $this->db->update('adm_allowed_range', $counsellingClosureInfo);
    }

}

KBHT - 2023