本文整理汇总了PHP中Rating::set_max_rating方法的典型用法代码示例。如果您正苦于以下问题:PHP Rating::set_max_rating方法的具体用法?PHP Rating::set_max_rating怎么用?PHP Rating::set_max_rating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rating
的用法示例。
在下文中一共展示了Rating::set_max_rating方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
function render_for_ajax()
{
$this->anon = TRUE;
if (!empty(PA::$login_user)) {
$login_id = PA::$login_user->user_id;
$this->anon = FALSE;
}
switch ($this->params["op"]) {
/*
case "add_oneliner":
Oneliners::create(
@(int)$login_id,
$this->params['genre'],
(int)$this->params['rating'],
$this->params['body'],
TRUE); // change to FALSE for production once we have approval UI
$this->note = __("Your One-liner submission was received - thank you for participating!")
. " \n" . __("Your submisssion will appear if it is approved by our staff.");
break;
*/
case "add_rating":
if ($this->anon) {
$this->err = __("Please log in or register to add ratings!");
break;
}
$rating = new Rating();
$this->subject_type = $this->params['subject_type'];
$this->subject_id = $this->params['subject_id'];
$rating->set_rating_type($this->subject_type);
$rating->set_type_id($this->subject_id);
$rating->set_rating((int) $this->params['rating']);
$rating->set_max_rating(5);
$rating->set_user_id(@(int) $login_id);
try {
$rating->rate();
// for rivers of people
$activity = 'user_post_a_rating';
$extra = serialize(array('info' => PA::$login_user->login_name . ' posted a rating.', 'subject_type' => $this->subject_type, 'subject_id' => $this->subject_id));
Activities::save(PA::$login_uid, $activity, -1, $extra, array($activity));
} catch (PAException $e) {
return $e->getMessage();
break;
}
$this->note = __("Rating was added - thank you for participating!");
// $this->add_oneliner = true; // flag it so we can ask for Onle-liner
break;
default:
// just ignore unknown ops
break;
}
return $this->render();
}
示例2: Rating
<?php
/** !
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* [filename] is a part of PeopleAggregator.
* [description including history]
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author [creator, or "Original Author"]
* @license http://bit.ly/aVWqRV PayAsYouGo License
* @copyright Copyright (c) 2010 Broadband Mechanics
* @package PeopleAggregator
*/
$login_required = TRUE;
//including necessary files
$use_theme = 'Beta';
//TODO : Remove this when new UI is completely implemented.
include_once "web/includes/page.php";
require 'api/Rating/Rating.php';
$Rating = new Rating();
if (!empty($_POST)) {
$Rating->set_rating_type(@$_POST['rating_type']);
$Rating->set_type_id(@(int) $_POST['type_id']);
$Rating->set_rating(@(int) $_POST['rating']);
$Rating->set_max_rating(@(int) $_POST['max_rating']);
$Rating->set_user_id(@(int) $login_uid);
$Rating->rate();
$rating = rating(@$_POST['rating_type'], @(int) $_POST['type_id']);
print $rating['overall'];
}