Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function notifikasi(){
- $this->db->select("judul, keterangan, link, icon, CONCAT(
- FLOOR((SUBSTRING_INDEX(TIMEDIFF(NOW(), created_at), ':', 1))/24), ' days ',
- MOD(SUBSTRING_INDEX(TIMEDIFF(NOW(), created_at), ':', 1), 24) , ' hours ',
- 0+SUBSTRING_INDEX(SUBSTRING_INDEX(TIMEDIFF(NOW(), created_at), ':', 2), ':', -1), ' minutes '
- ) AS created_at");
- // $query = $this->db->get_where("notifikasi",["status_buka"=>"0","kepada_dinas_ID" => Session("dinas_ID")]);
- $query = $this->db->where("status_buka", 0)
- ->where("kepada_dinas_ID", Session("dinas_ID"))
- ->where("judul !=", "chat")
- ->get('notifikasi');
- $query_chat = $this->db->get_where("notifikasi",["status_buka"=>"0","kepada_dinas_ID" => Session("user_ID"), "judul" => "chat"]);
- // $query_name_sender = $this->db->get_where("notifikasi",["status_buka"=>"0","kepada_dinas_ID" => Session("user_ID"), "judul" => "chat"])->row_array();
- // $test = $query_name_sender['dari_dinas_ID'];
- // $get_name_sender = $this->db->get_where("user", ["ID" => $test])->row_array();
- $total_nofitikasi_baru = $query->num_rows();
- $total_nofitikasi_chat_baru = $query_chat->num_rows();
- $data['notification_badge'] = $total_nofitikasi_baru;
- $data['chat_badge'] = $total_nofitikasi_chat_baru;
- $data['item'] = '<li><h6>NOTIFICATIONS<span class="new badge">'.$total_nofitikasi_baru.'</span></h6></li><li class="divider"></li>';
- foreach ($query->result() as $row){
- // if($row->judul == "chat") {
- // $data['item'].= "<li><a class='grey-text text-darken-2 menu' href='".$row->link."'><span class='material-icons icon-bg-circle green small'>".$row->icon."</span> ".substr($row->judul,"0",20)." : dari ".$get_name_sender['nama']."</a><time class='media-meta' datetime='".$row->created_at."'>".$row->created_at."</time></li>";
- // // $data['item'].= "<li><a class='grey-text text-darken-2 menu' href='".$row->link."'><span class='material-icons icon-bg-circle green small'>".$row->icon."</span> ".substr($row->judul,"0",20)." : Dari</a><time class='media-meta' datetime='".$row->created_at."'>".$row->created_at."</time></li>";
- // } else {
- $data['item'].= "<li><a class='grey-text text-darken-2 menu' href='".$row->link."'><span class='material-icons icon-bg-circle green small'>".$row->icon."</span> ".substr($row->judul,"0",20)."...</a><time class='media-meta' datetime='".$row->created_at."'>".$row->created_at."</time></li>";
- // }
- }
- return $data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement