当前位置: 首页>>代码示例>>PHP>>正文


PHP Rating::getStarsArray方法代码示例

本文整理汇总了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']);
        }
    }
}
开发者ID:Outlaw11A,项目名称:SEP2015,代码行数:31,代码来源:view.php

示例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;
}
开发者ID:Outlaw11A,项目名称:SEP2015,代码行数:25,代码来源:user.php


注:本文中的Rating::getStarsArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。