本文整理汇总了PHP中Rating::getStarsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Rating::getStarsArray方法的具体用法?PHP Rating::getStarsArray怎么用?PHP Rating::getStarsArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rating
的用法示例。
在下文中一共展示了Rating::getStarsArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
if ($page['user']['usertype'] != "1") {
Session::setError('You are not able to view offers for an advertisement');
Session::redirect('/');
}
// make sure is valid advertisement
$advertisement = Advertisement::getAdvertisement($page['parameters']['id']);
if ($advertisement == null) {
Session::setError('Advertisement does not exist.');
Session::redirect('/');
}
// make sure the advertisement is owned by the user
if ($advertisement['owner'] != $page['user']['id']) {
Session::setError('You do not own this advertisement');
Session::redirect('/');
}
$page['advertisement'] = $advertisement;
$offers = Offer::getOffersForAdvertisement($advertisement['id']);
$page['offers'] = $offers;
foreach ($page['offers'] as &$offer) {
$offer['ownerDetails'] = User::getUser($offer['owner']);
if ($offer['status'] == "3") {
$offer['yourRating'] = Rating::getRating($offer['id'], User::getId());
if ($offer['yourRating'] != null) {
$offer['yourRating']['rating'] = Rating::getStarsArray($offer['yourRating']['rating']);
}
$offer['theirRating'] = Rating::getRating($offer['id'], $offer['ownerDetails']['id']);
if ($offer['theirRating'] != null) {
$offer['theirRating']['rating'] = Rating::getStarsArray($offer['theirRating']['rating']);
}
}
}
示例2: foreach
<?php
/**
* @var $page
*/
$user = User::getUser($page['parameters']['id']);
if ($user != null) {
$page['userProfile'] = $user;
// get the user's rating
$rating = Rating::getUserRating($user['id']);
$page['userProfile']['rating'] = Rating::getStarsArray($rating);
// Get the user's advertisements if applicable
if ($user['usertype'] == "1") {
$advertisements = Advertisement::getUserAdvertisements($user['id']);
// trim the description
foreach ($advertisements as &$advertisement) {
if (strlen($advertisement['description']) > 150) {
$advertisement['description'] = substr($advertisement['description'], 0, 150) . '...';
}
}
$page['advertisements'] = $advertisements;
}
} else {
$page['userProfile'] = null;
}