mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/ARCHIVED-IZYIM.git
synced 2026-08-25 15:24:17 +00:00
39 lines
2.0 KiB
PHP
Executable File
39 lines
2.0 KiB
PHP
Executable File
<?php
|
|
|
|
global $db;
|
|
$requestData= $_REQUEST;
|
|
$columns = array(
|
|
0 => 'message',
|
|
1 => 'file_name'
|
|
|
|
);
|
|
$data = $db->query("SELECT COUNT(notice_messages.message_id) FROM `notice_messages` join notice_room_message on notice_messages.message_id = notice_room_message.message_id join notice_rooms on notice_room_message.room_id = notice_rooms.room_id WHERE notice_messages.from_id = '" . $_SESSION['user_id'] . "' and notice_rooms.room_type = 'general'");
|
|
$count = $data[0]["jumlah"];
|
|
$totalData = $count;
|
|
$totalFiltered = $totalData;
|
|
|
|
$sql = "SELECT notice_messages.message as message, notice_messages.file_name as file_name, notice_messages.mime as mime, notice_messages.file as file FROM `notice_messages` join notice_room_message on notice_messages.message_id = notice_room_message.message_id join notice_rooms on notice_room_message.room_id = notice_rooms.room_id WHERE notice_messages.from_id = '" . $_SESSION['user_id'] . "' and notice_rooms.room_type = 'general'";
|
|
|
|
$data = $db->query($sql);
|
|
$totalFiltered = count($data);
|
|
$sql.=" LIMIT ".$requestData['start']." ,".$requestData['length']." ";
|
|
$data = $db->query($sql);
|
|
$qweqwe = array();
|
|
foreach ($data as $key => $value) {
|
|
|
|
$nestedData = array();
|
|
|
|
$nestedData[] = $value["message"];
|
|
$nestedData[] = ($value["file_name"] ? "<img src='".$value["file_name"]."' style='width:70px !important;height:auto !important'/>" : "N/A");
|
|
$nestedData[] = GeneralGetToID($value["message_id"]);
|
|
|
|
$qweqwe[] = $nestedData;
|
|
}
|
|
$json_data = array(
|
|
"draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
|
|
"recordsTotal" => intval( $totalData ), // total number of records
|
|
"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
|
|
"data" => $qweqwe // total data array
|
|
);
|
|
echo json_encode($json_data);
|