HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dmstechonline/crm.chaitanyahospitalvirar.com/application/views/admin/chat/_partialmyuser.php
<?php
$response_json = isJSON($userList);
if ($response_json) {

    $userList = (json_decode($userList));
    
    if (!empty($userList)) {
        foreach ($userList->chat_users as $user_key => $user_value) {
            if (!empty($user_value->messages)) {
                $count_noti = getConnectionNotification($userList, $user_value->id);
                ?>
                <li class="contact" data-chat-connection-id="<?php echo $user_value->id; ?>">
                    <div class="wrap">
                        <?php
                        if ($user_value->user_details->image == "") {
                            $img = base_url() . "uploads/patient_images/no_image.png";
                        } else {
                            $img = ($user_value->user_details->user_type == "staff") ? base_url() . "uploads/staff_images/" . $user_value->user_details->image : base_url() . $user_value->user_details->image;
                        }
                        ?>
                        <img src="<?php echo $img.img_time(); ?>" alt="">
                        <div class="meta">
                            <p class="name">
                                <?php
                                $staff_name= ($user_value->user_details->surname == "")? $user_value->user_details->name : $user_value->user_details->name." ".$user_value->user_details->surname; 

                            echo ($user_value->user_details->user_type == "staff") ? " " . $staff_name . " ": " " . $user_value->user_details->patient_name;
                                echo ($user_value->user_details->user_type == "staff") ? " (" . $this->lang->line('staff') . ")" : " (" . $this->lang->line('patient') . ")";
                                ?></p>


                            <p class="preview">
                                <?php
                                if ($chat_user->id != $user_value->messages->chat_user_id) {
                                    echo "<span>" . $this->lang->line('you') . ": </span>";
                                }
                                ?>
                                <?php echo $user_value->messages->message; ?></p>
                        </div>
                    </div>
                    <?php
                    if ($count_noti > 0) {
                        ?>
                        <span class="chatbadge notification_count"><?php echo $count_noti; ?></span> 
                        <?php
                    } else {
                        ?>
                        <span class="chatbadge notification_count displaynone">0</span> 
                        <?php
                    }
                    ?>

                </li>
                <?php
            }
        }
    }
}

function getConnectionNotification($userList, $chat_connection_id) {
    if (!empty($userList->chat_user_notification)) {
        foreach ($userList->chat_user_notification as $notifiction_key => $notifiction_value) {
            if ($notifiction_value->chat_connection_id == $chat_connection_id) {
                return $notifiction_value->no_of_notification;
            }
        }
    }
    return 0;
}
?>