Thứ Hai, 14 tháng 9, 2026

Mãn dữ liệu function code

$is_allowed = in_array((int)$mbrow["user_level"], array(3, 4, 5, 6));

$disabled_class = !$is_allowed ? 'disabled' : '';

$menu_items = array(

    array(

        'op'     => 'user_verified',

        'title'  => 'Profile',

        'active' => 'active'

    ),

    array(

        'op'     => 'page_create',

        'title'  => 'Page tự tạo (Giới thiệu, Giải pháp)',

        'active' => 'active'

    ),

    array(

        'op'     => 'supplier_pagemenu',

        'title'  => 'Tạo menu',

        'active' => 'select'

    ),

    array(

        'op'     => 'supplier_pagehome',

        'title'  => 'Giao diện trang chủ NCC',

        'active' => 'select'

    )

);

// 3. Xuất HTML dùng echo chuỗi (tương thích tốt với các CMS cũ như NukeViet)

echo'<ul>';

foreach ($menu_items as $item) {

    $is_active_class = ($op == $item['op']) ? $item['active'] : '';

    $link = $is_allowed ? $site_live .'modules.php?name=Your_Account&op='.$item['op'] : 'javascript:void(0);';

    echo '<li class="'.$is_active_class.' user-super '.$disabled_class.'">

        <a href="'.$link.'">

            <i class="fa fa-long-arrow-right"></i> ' . $item['title'] . '

        </a>

    </li>';

}

?>

<style type="text/css">

    /* Styling cho menu bị khóa */

    li.disabled {

        /* Làm mờ 60% */

        opacity: 0.4; 

        /* Đổi con trỏ chuột thành biểu tượng cấm */

        cursor: not-allowed; 

    }

    li.disabled a {

        /* Chặn hoàn toàn sự kiện click */

        pointer-events: none;

        /* Ép màu chữ thành xám */

        color: #999 !important;

    }

</style>

<?php

echo'</ul>';

Không có nhận xét nào:

Đăng nhận xét