public function view($id) { $get_thread = $this->model_thread->get_thread($id); foreach ($get_thread as $t) { $data = array('idCategory' => $t->category, 'category' => $t->category_name, 'topic' => $t->topicName, 'author' => $t->author, 'tanggal' => $t->created_at, 'title' => $t->title, 'status' => $t->status, 'message' => BBCodeParser($t->message)); } $user = sentinel()->getUser(); $visitorIdentity = visitorIdentity($user->id, $id); $this->model_visitor->saveVisitor($visitorIdentity); $daerahUser = $user->profile->desa_id; if ($this->checkTA() == TRUE) { $data['tenagaAhli'] = $user->id; $data['draftSide'] = $this->model_thread->get_all_drafts($user->id); $data['threadSide'] = $this->model_thread->get_all_threads($daerahUser, $user->id); } else { $data['threadSide'] = $this->model_thread->get_threads_by_user($daerahUser, $user->id); } $data['authorSide'] = $this->model_thread->get_thread_from_author($user->id); $data['categoriesSide'] = $this->model_thread->get_categories(); $data['closeThreads'] = $this->model_thread->get_close_threads($user->id); $data['commentsSide'] = $this->model_thread->get_comments_from_author($user->id); $data['reply'] = $this->model_thread->get_reply($id); $data['countReply'] = count($data['reply']); $data['userID'] = $user->id; $data['topics'] = $this->model_topic->get_approved_topics(); $data['id'] = $id; if ($this->session->flashdata('success')) { $data['success'] = $this->session->flashdata('success'); } elseif ($this->session->flashdata('failed')) { $data['failed'] = $this->session->flashdata('failed'); } $this->load->view('thread/single', $data); }
public function view($id) { $get_thread = $this->model_thread->get_thread($id); foreach ($get_thread as $t) { $data = array('idCategory' => $t->category, 'category' => $t->category_name, 'user' => $t->author, 'tanggal' => $t->created_at, 'title' => $t->title, 'message' => BBCodeParser($t->message)); } $user = sentinel()->getUser(); $visitorIdentity = visitorIdentity($user->id, $id); $this->model_visitor->saveVisitor($visitorIdentity); $data['categoriesSide'] = $this->model_thread->get_categories(); $data['threadSide'] = $this->model_thread->get_all_threads(); $data['reply'] = $this->model_thread->get_reply($id); $data['countReply'] = count($data['reply']); $data['id'] = $id; if ($this->session->flashdata('success')) { $data['success'] = $this->session->flashdata('success'); } elseif ($this->session->flashdata('failed')) { $data['failed'] = $this->session->flashdata('failed'); } $this->load->view('thread/single', $data); }