Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(count($query_isi) == 0 && count($query_balasan) == 0) {
- $isi_chat .= '<li class="chat-body">
- <ul class="collection">
- </ul>
- </li>
- <li class="center-align chat-footer">
- <form id="form-chat" class="col s12" onsubmit="submit_chat()" action="POST" >
- <div class="input-field">
- <input type="hidden" name="dari_user_ID" id="dari_user_ID" value="'.Session('user_ID').'"/>
- <input type="hidden" name="kepada_user_ID" id="kepada_user_ID" value="'.Request('kepada_user_ID').'"/>
- <input style="margin-top:5px;" id="icon_prefix" type="text" class="search isi" placeholder="Type here.." name="isi"/>
- <a onclick="submit_chat()" style = "margin-top:5px;"><i class="material-icons prefix">send</i></a>
- </div>
- </form>
- </li>';
- } else {
- if(count($query_balasan) != 0) {
- $isi_chat .= '<li class="chat-body">
- <ul class="collection">';
- foreach($query_balasan as $chat_balasan) {
- $waktu_balasan = date('Y-m-d', strtotime($chat_balasan->created_at));
- $isi_chat .= '<li class="collection-item display-flex avatar pl-5 pb-0" data-target="slide-out-chat">
- <span class="avatar-status avatar-online avatar-50">
- <img src="'.$query_header->foto.'" alt="avatar" />
- </span>
- <div class="user-content speech-bubble">
- <p class="medium-small">'.$chat_balasan->isi.'</p>
- </div>
- </li>';
- }
- if(count($query_isi) != 0) {
- foreach($query_isi as $chat_isi) {
- $waktu_isi = date('Y-m-d', strtotime($chat_isi->created_at));
- $isi_chat .= '<li class="collection-item display-flex avatar justify-content-end pl-5 pb-0" data-target="slide-out-chat">
- <div class="user-content speech-bubble-right">
- <p class="medium-small">'.$chat_isi->isi.'</p>
- </div>
- </li>
- <li class="collection-item display-flex avatar pl-5 pb-0" data-target="slide-out-chat">
- <span class="avatar-status avatar-online avatar-50">
- <img src="'.$query_header->foto.'" alt="avatar" />
- </span>
- <div class="user-content speech-bubble">
- <p class="medium-small">'.$chat_balasan->isi.'</p>
- </div>
- </li>';
- }
- if($waktu_balasan > $waktu_isi) {
- foreach($query_balasan as $chat_balasan) {
- $isi_chat .= '<li class="collection-item display-flex avatar pl-5 pb-0" data-target="slide-out-chat">
- <span class="avatar-status avatar-online avatar-50">
- <img src="'.$query_header->foto.'" alt="avatar" />
- </span>
- <div class="user-content speech-bubble">
- <p class="medium-small">'.$chat_balasan->isi.'</p>
- </div>
- </li>';
- }
- }
- }
- } else if (count($query_isi) != 0 && count($query_balasan) == 0) {
- $isi_chat .= '<li class="chat-body">
- <ul class="collection">';
- foreach($query_isi as $chat_isi) {
- $isi_chat .= '<li class="collection-item display-flex avatar justify-content-end pl-5 pb-0" data-target="slide-out-chat">
- <div class="user-content speech-bubble-right">
- <p class="medium-small">'.$chat_isi->isi.'</p>
- </div>
- </li>';
- }
- foreach($query_balasan as $chat_balasan) {
- $isi_chat .= '<li class="collection-item display-flex avatar pl-5 pb-0" data-target="slide-out-chat">
- <span class="avatar-status avatar-online avatar-50">
- <img src="'.$query_header->foto.'" alt="avatar" />
- </span>
- <div class="user-content speech-bubble">
- <p class="medium-small">'.$chat_balasan->isi.'</p>
- </div>
- </li>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement