function view($event, $question, $sort = 'date') { // how to sort comments switch ($sort) { case 'votes': $sort = 'votes'; break; default: $sort = 'date'; break; } $event_id = $this->event->get_id_from_url($event); if (!$event_id) { redirect(); } $this->question->event_id = $event_id; $question_id = $this->question->get_id_from_url($question); $this->question->question_status = null; $this->question->question_id = $question_id; $result = $this->question->questionQueue(); $data = $result[0]; $data['event_type'] = 'question'; $image_array = unserialize($data['user_avatar']); if ($image_array) { $data['avatar_path'] = "./avatars/" . $image_array['file_name']; } else { $data['avatar_path'] = "./images/image01.jpg"; } // set display name $data['display_name'] = $this->user->displayName($data['user_name']); //get time diff $data['time_diff'] = $this->time_lib->getDecay($data['date']); //tags if (!empty($data['tags'])) { foreach ($data['tags'] as $k1 => $tag) { $data['tags'][$k1] = anchor("forums/queue/event/" . url_title($data['event_name']) . "/tag/" . $tag, $tag); } } //get voted if ($this->userauth->isUser()) { $this->vote->type = 'question'; $score = $this->vote->votedScore($data['question_id'], $this->userauth->user_id); if ($score > 0) { $data['voted'] = 'up'; } else { if ($score < 0) { $data['voted'] = 'down'; } else { $data['voted'] = false; } } } else { $data['voted'] = false; } $this->load->library('comments_library'); $comments_library = new Comments_library(); $comments_library->ajax = isset($_POST['ajax']); $comments_library->sort = $sort; $comments_library->custom_theme = strlen($this->config->item('custom_theme')) > 1 ? $this->config->item('custom_theme') . '/' : ''; $comments_library->type = $data['event_type']; $data['comments_body'] = $comments_library->createComments($result[0]); // If ajax then use different view, otherwise setup breadtrail and all if (isset($_POST['ajax'])) { $data['ajax'] = true; $this->load->view('question/_comments', $data); } else { $data['breadcrumb'] = array('Home' => $this->config->site_url(), 'Events' => 'event/', ucwords(str_replace('_', ' ', $data['event_name'])) => "forums/queue/event/" . url_title($data['event_name'])); $data['rightpods'] = array('dynamic' => array('event_description' => $data['event_desc'], 'event_location' => $data['location'])); $data['view_name'] = 'question_view'; $this->load->view('question/question_view.php', $data); } }
function view($event, $video) { $video_id = $this->video->get_id_from_url($video); $this->video->video_id = $video_id; $result = $this->video->videoQueue(); $data = $result[0]; $data['event_type'] = 'video'; $image_array = unserialize($data['user_avatar']); if ($image_array) { $data['avatar_path'] = "./avatars/" . $image_array['file_name']; } else { $data['avatar_path'] = "./images/image01.jpg"; } //exit(var_dump($data)); //get time diff $data['time_diff'] = $this->time_lib->getDecay($data['date']); //get voted if ($this->userauth->isUser()) { $this->vote->type = 'video'; $score = $this->vote->votedScore($data['video_id'], $this->userauth->user_id); if ($score > 0) { $data['voted'] = 'up'; } else { if ($score < 0) { $data['voted'] = 'down'; } else { $data['voted'] = false; } } } else { $data['voted'] = false; } $this->load->library('comments_library'); $comments_library = new Comments_library(); $comments_library->type = 'video'; $data['comments_body'] = $comments_library->createComments($result[0]); $data['breadcrumb'] = array('Home' => $this->config->site_url(), 'Events' => 'event/', ucwords(str_replace('_', ' ', $data['event_name'])) => "forums/queue/event/" . url_title($data['event_name'])); $data['rightpods'] = array('dynamic' => array('event_description' => $data['event_desc'], 'event_location' => $data['location'])); $this->load->view('video/video_view.php', $data); }