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


PHP Rating::GetRating方法代码示例

本文整理汇总了PHP中Rating::GetRating方法的典型用法代码示例。如果您正苦于以下问题:PHP Rating::GetRating方法的具体用法?PHP Rating::GetRating怎么用?PHP Rating::GetRating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rating的用法示例。


在下文中一共展示了Rating::GetRating方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Video

    App::Throw404();
}
// Check if video is valid
if (!Video::Exist(array('video_id' => $_POST['video_id'], 'status' => 'approved'))) {
    App::Throw404();
}
$video = new Video($_POST['video_id']);
// Verify rating was given
if (!isset($_POST['rating']) || !in_array($_POST['rating'], array('1', '0'))) {
    App::Throw404();
}
// Verify user is logged in
if (!$logged_in) {
    echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_rate_login')));
    exit;
}
// Check user doesn't rate his own video
if ($user->user_id == $video->user_id) {
    echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_rate_own')));
    exit;
}
// Submit rating if none exists
if (Rating::AddRating($_POST['rating'], $video->video_id, $logged_in)) {
    Plugin::Trigger('rate.ajax.rate_video');
    echo json_encode(array('result' => 1, 'msg' => (string) Language::GetText('success_rated'), 'other' => Rating::GetRating($video->video_id)));
    exit;
} else {
    Plugin::Trigger('rate.ajax.rate_video_duplicate');
    echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_rate_duplicate')));
    exit;
}
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:rate.ajax.php

示例2: Video

    if (!empty($_GET['private']) && ($video_id = Video::Exist(array('status' => 'approved', 'private_url' => $_GET['private'])))) {
        View::$vars->video = new Video($video_id);
        View::$vars->private = true;
        View::$vars->comments_url = HOST . '/private/comments/' . View::$vars->video->private_url;
    } else {
        if (!empty($_GET['get_private'])) {
            exit(Video::GeneratePrivate());
        } else {
            App::Throw404();
        }
    }
}
// Load video data for page rendering
View::$vars->member = new User(View::$vars->video->user_id);
View::$vars->video->Update(array('views' => View::$vars->video->views + 1));
View::$vars->rating = Rating::GetRating(View::$vars->video->video_id);
View::$vars->meta->title = View::$vars->video->title;
View::$vars->meta->keywords = implode(', ', View::$vars->video->tags);
View::$vars->meta->description = View::$vars->video->description;
Plugin::Trigger('play.load_video');
// Retrieve user data if logged in
if (View::$vars->logged_in) {
    View::$vars->user = new User(View::$vars->logged_in);
    $data = array('member' => View::$vars->video->user_id, 'user_id' => View::$vars->user->user_id);
    View::$vars->subscribe_text = Subscription::Exist($data) ? 'unsubscribe' : 'subscribe';
} else {
    View::$vars->subscribe_text = 'subscribe';
}
// Retrieve count of all videos
$query = "SELECT COUNT(video_id) as total FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND private = '0'";
$result_total = $db->Query($query);
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:play.php


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