本文整理汇总了PHP中Review::count_by_user_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP Review::count_by_user_dir方法的具体用法?PHP Review::count_by_user_dir怎么用?PHP Review::count_by_user_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Review
的用法示例。
在下文中一共展示了Review::count_by_user_dir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($directory_id)
{
if (empty($directory_id) || !is_numeric($directory_id)) {
show_404();
}
$directory_user = Directory_User::get_user_dir($this->c_user->id, $directory_id, $this->profile->id);
if (!$directory_user->exists()) {
return $this->link_to_config();
}
$from = $this->getRequest()->get('from', strtotime('-30 days'));
$to = $this->getRequest()->get('from', strtotime('now'));
$from_date = DateTime::createFromFormat($this->date_format, $from);
$to_date = DateTime::createFromFormat($this->date_format, $to);
$reviewsTotal = Review::count_by_user_dir($this->c_user->id, $directory_id);
$stars = (int) $directory_user->directory->stars;
$review = new Review();
$options = array('rank' => Review::generateRantQueryByStars($stars));
if ($from_date && $to_date) {
$options['date_from'] = $from_date->format(Review::POSTEDFORMAT);
$options['date_to'] = $to_date->format(Review::POSTEDFORMAT);
}
$details = $review->details($this->c_user->id, $this->profile->id, $directory_id, $options);
/*$html = $this->load($directory_id);*/
JsSettings::instance()->add(array('directory' => array('id' => $directory_id, 'reviews_total' => $reviewsTotal, 'link' => $directory_user->directory->type == 'Google_Places' ? '' : $directory_user->link, 'stars' => (int) $directory_user->directory->stars, 'details_url' => site_url('reviews/details'), 'show_all_link' => site_url('reviews/all/' . $directory_id)), 'date_format' => array('datepicker' => $this->js_datepicker_date_format, 'string' => $this->js_string_date_format)));
CssJs::getInst()->add_js(array('libs/highcharts/highcharts.js'))->c_js();
$this->template->set('from_date', $from_date);
$this->template->set('to_date', $to_date);
$this->template->set('type', $directory_user->directory->type);
$this->template->set('reviewsTotal', $reviewsTotal);
$this->template->set('reviews', $details['latest_reviews']);
$this->template->set('rank', $details['rank_details']);
$this->template->set('rate', $details['rank']);
$this->template->set('stars', $stars);
/*$this->template->set('html', $html);*/
if ($directory_user->directory->type == 'Foursquare') {
$data = unserialize($directory_user->additional);
$this->template->set('rate', round($data['rate'], 1));
$this->template->set('visitors', round($data['visitors'], 1));
$this->template->set('checkins', round($data['checkins'], 1));
}
$this->template->render();
}
示例2: exist_reviews
public function exist_reviews()
{
$raws = Review::count_by_user_dir($this->directory_user['user_id'], $this->directory_user['directory_id']);
return $raws;
}