query("SELECT notice_messages.delivery_arrangement_id as delivery_arrangement_id, notice_messages.decision_type as decision_type,notice_messages.decision as decision,notice_messages.warehouse_arrangement_id as warehouse_arrangement_id,notice_messages.reply_id as reply_id, notice_messages.file as file, notice_messages.file_name as file_name, notice_messages.message_id as message_id, notice_messages.message_id as message_id, notice_messages.message as message, notice_messages.from_id as from_id, notice_messages.created_on as created_on, notice_messages.chat_type as chat_type, notice_messages.mime as mime FROM `notice_messages` join notice_room_message on notice_messages.message_id = notice_room_message.message_id WHERE notice_room_message.room_id = '".$room_id."' && notice_messages.message_id > '".$id."' ORDER BY notice_messages.message_id ASC");
$counts = 0;
$html = "";
if(count($data) > 0){
foreach ($data as $key => $value) {
if(date("Y-m-d", strtotime($request->get('last_date'))) <> date("Y-m-d", strtotime($value['created_on']))) {
if($counts == 0){
$counts = 1;
$prev_date = date("Y-m-d", strtotime($value['created_on']));
$html .= '
' . date("F j, Y", strtotime($value['created_on'])) . '';
}
}
if(date("Y-m-d", strtotime($request->get('last_date'))) <> date("Y-m-d", strtotime($value['created_on']))) {
if (date("Y-m-d", strtotime($prev_date)) <> date("Y-m-d", strtotime($value['created_on']))){
$prev_date = date("Y-m-d", strtotime($value['created_on']));
$html .= '' . date("F j, Y", strtotime($value['created_on'])) . '';
}
}
if( $counts == 1){
$counts = 2;
if(getRoomUnread($room_id) > 0){
$html .= ''.getRoomUnread($room_id).' Unread Messages';
}
}
if($value["from_id"] == $_SESSION['user_id'] ){
$class="out";
}else{
$class="in";
}
$data = $db->query("UPDATE notice_unread SET status = 1 WHERE message_id = '". $value['message_id'] . "' and user_id = '".$_SESSION['user_id']."'");
if(getMessageData($value["reply_id"], "from_id") == $_SESSION['user_id'] ){
$classReply="border-left: 2px solid #F3565D !important;";
}else{
$classReply="border-left: 2px solid #1BBC9B !important;";
}
if($value['chat_type']== 1){
if($value['reply_id'] == null || $value['reply_id'] == 0){
$html .= '';
$html .= '';
$html .= '';
}else{
$html .= '';
$html .= '';
$html .= '';
}
}elseif($value['chat_type']== 2){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 3){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 4){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 5){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 6){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 7){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 8){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 9){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 10){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 11){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 13){
$html .= '';
$html .= '';
$html .= '';
}elseif($value['chat_type']== 14){
$html .= '';
$html .= '';
$html .= '';
}
}
echo $html;
}
?>