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


PHP Rating::rate方法代码示例

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


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

示例1: 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'];
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:29,代码来源:rating.php

示例2: 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();
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:52,代码来源:RatingModule.php


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