function getBizById($bizid) { $CI =& get_instance(); $CI->load->model('bizs'); //$CI->load->model('reviews'); $biz = $CI->bizs->get($bizid); //$biz->rating_stats = $CI->reviews->get_rating_stats($biz->id); if (!$biz) { return false; } //get biz category info $biz = biz_cat_info($biz); // get biz rating stats //$biz = biz_rate_stats($biz); // get photo stats $biz = biz_photo_stats($biz); return $biz; }
public function show() { $id = $this->uri->segment(2); if (!$id || !is_numeric($id)) { show_404(); } $this->load->model("bizs"); if (!($biz = $this->bizs->get($id)) || !$biz->published) { show_404(); } $this->load->model('reviews'); $biz->rating_stats = $this->reviews->get_rating_stats($biz->id); //get biz category info $biz = biz_cat_info($biz); // get biz rating stats $biz = biz_rate_stats($biz); // get photo stats $biz = biz_photo_stats($biz); $data['biz'] = $biz; $pageData = $this->reviews->getPageData('/biz/' . $id . '/', 3, array('bizid' => $id)); $data['pagination_links'] = $pageData['pagination_links']; $data['reviews'] = $pageData['list']; $biz->review_num = $pageData['count']; $data['first_review'] = $this->reviews->get_first_review($biz->id); if ($this->tank_auth->is_logged_in()) { $uid = $this->tank_auth->get_user_id(); if ($my_review = $this->reviews->get(array('uid' => $uid, 'bizid' => $biz->id))) { if (isset($data['reviews'][$my_review->id])) { unset($data['reviews'][$my_review->id]); } array_unshift($data['reviews'], $my_review); $data['my_review'] = $my_review; } } $this->load->helper('form'); $data['biz_map'] = 1; $data['heading'] = "{$biz->city->name} {$biz->name} ratings and reviews"; $this->load->view('biz/show', $data); }