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


PHP Rating::getRating方法代码示例

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


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

示例1: get

 public function get($season, $episode)
 {
     $episode = Episode::with(['doctors', 'companions', 'enemies'])->where('season', $season)->where('episode', $episode)->first();
     $ratings = Rating::getRating('episode', $episode->id);
     $comments = Comment::where('item_id', $episode->id)->where('item_type', 'episode')->with('user')->orderBy('created_at', 'desc')->get();
     return View::make('items.episode', ['episode' => $episode, 'ratings' => $ratings, 'comments' => $comments]);
 }
开发者ID:thechrisroberts,项目名称:thedoctor,代码行数:7,代码来源:EpisodeController.php

示例2: get

 public function get($id)
 {
     $enemy = Enemy::with('episodes')->find($id);
     $ratings = Rating::getRating('enemy', $id);
     $comments = Comment::where('item_id', $id)->where('item_type', 'enemy')->with('user')->orderBy('created_at', 'desc')->get();
     return View::make('items.enemy', ['enemy' => $enemy, 'ratings' => $ratings, 'comments' => $comments]);
 }
开发者ID:thechrisroberts,项目名称:thedoctor,代码行数:7,代码来源:EnemyController.php

示例3: get

 public function get($id)
 {
     $doctor = Doctor::with(['companions', 'episodes'])->find($id);
     $ratings = Rating::getRating('doctor', $id);
     $comments = Comment::where('item_id', $id)->where('item_type', 'doctor')->with('user')->orderBy('created_at', 'desc')->get();
     return View::make('items.doctor', ['doctor' => $doctor, 'ratings' => $ratings, 'comments' => $comments]);
 }
开发者ID:thechrisroberts,项目名称:thedoctor,代码行数:7,代码来源:DoctorController.php

示例4: starRating

 public function starRating($recipeId, $id = null, $value = null)
 {
     $session = Zend_Registry::get('session');
     $log = Zend_Registry::get('log');
     // fetch the rating
     $ra = new Rating();
     $rating = $ra->getRating($recipeId);
     // If were passing through a value we already know what to display and are probably read only
     if (isset($value)) {
         return $this->displayRating($value, $id);
     }
     // Logged in?
     if (!$session->user) {
         return $this->displayRating($rating);
     }
     //$log->debug( $session->user['name'] . ' is logged in' );
     $r = new Recipe();
     if ($r->isOwner($recipeId)) {
         return $this->displayRating($rating);
     }
     //$log->debug( $session->user['name'] . ' is not the owner' );
     // Has this user already rated?
     $db = Zend_Registry::get('db');
     $select = $db->select()->from('ratings', array("numberOfRatings" => "COUNT(*)"))->where("recipe_id = ?", $recipeId)->where("user_id = ?", $session->user['id']);
     //$log->debug( $select->__toString() );
     //$log->debug( $db->fetchOne( $select ) );
     // If we get a result show the user the overall rating
     if ($db->fetchOne($select) > 0) {
         return $this->displayRating($rating);
     }
     //$log->debug( $session->user['name'] . ' has not already rated this' );
     // Otherwise show the rating but make it clickable
     return $this->displayRating($rating, null, false);
 }
开发者ID:vishaleyes,项目名称:cookingwithzend,代码行数:34,代码来源:StarRating.php

示例5: elseif

         } elseif (sotf_Utils::getParameter('comment')) {
             $reply_to = sotf_Utils::getParameter('comment');
             $page->redirect($_SERVER["PHP_SELF"] . "?id=" . $id . "&reply_to=" . $reply_to . "#edit");
             //redirect page, prevent resend of data
         }
     }
     $reply_to = sotf_Utils::getParameter('reply_to');
     $smarty->assign('reply_to', $reply_to);
     $smarty->assign('reply_title', $comments[$reply_to]['title']);
     $smarty->assign('email', $_SESSION['email']);
 }
 if ($settings["rating"] and ($user->loggedIn() or $settings["a_rating"])) {
     $value = (int) sotf_Utils::getParameter('rating');
     if (sotf_Utils::getParameter('rate_it') and $value != 0) {
         $rating->setRating($id, $value);
         $r = $rating->getRating($id);
         $r['prog_id'] = $id;
         $r['user_name'] = $user->getName();
         $r['user_email'] = $user->getEmail();
         $r['host'] = getHostName();
         $r['authkey'] = $page->getAuthKey();
         $portal->addEvent("rating", $r);
         $page->redirect($_SERVER["PHP_SELF"] . "?id=" . $id);
         //redirect page, prevent resend of data
     }
 }
 $smarty->assign('comments', $comments);
 $result = $portal->getProgrammes(array($id));
 $result = $result[0];
 if ($result === NULL) {
     $page->redirect($_SERVER["PHP_SELF"]);
开发者ID:BackupTheBerlios,项目名称:sotf,代码行数:31,代码来源:portal.php

示例6: completeOffer

 /**
  * Complete an offer if both ratings have been completed
  *
  * @param $id
  */
 static function completeOffer($id)
 {
     $offer = self::getOfferSingle($id);
     $advertisement = Advertisement::getAdvertisement($offer['advertisement']);
     if (Rating::getRating($id, $offer['owner']) != null && Rating::getRating($id, $advertisement['owner']) != null) {
         $mysql = new MySQL();
         $results = $mysql->query('UPDATE offer SET status = 3 WHERE id = :id', [':id' => $id]);
     }
 }
开发者ID:Outlaw11A,项目名称:SEP2015,代码行数:14,代码来源:Offer.php

示例7: getItemById

 function getItemById($itemId)
 {
     $item = array();
     $iid = $itemId;
     $colsArray = array("item" => array(1, 3, 4, 5, 6, 7, 9, 10, 11), "address" => array(3, 4, 5));
     $colStr = getSqlColumns($colsArray);
     $query = "SELECT {$colStr} FROM `item`, `address` WHERE `item`.`iid`={$iid} AND `item`.`aid`=`address`.`aid`;";
     if ($result = mysql_query($query)) {
         while ($res = mysql_fetch_array($result)) {
             $item = getSqlData($colsArray, $res);
         }
     }
     $rate = new Rating();
     $item["rating"] = $rate->getRating($itemId);
     $comments = $this->getComments($itemId);
     $replies = $this->getReply($itemId);
     foreach ($comments as $cid => $allData) {
         if (!isset($comments[$cid]["replies"])) {
             $comments[$cid]["replies"] = array();
         }
         if (isset($replies[$cid])) {
             $comments[$cid]["replies"] = $replies[$cid];
         }
     }
     $item["comments"] = $comments;
     return $item;
 }
开发者ID:117n-n711,项目名称:pjmgmt,代码行数:27,代码来源:items.php

示例8: define

define('DBUSER', 'root');
define('DBPASS', '');
define('DBNAME', 'lbs_db');
// if NRRTG is 0, the user can rate multiple items in a day, if it is 1, the user can rate only one item in a day
define('NRRTG', 0);
// If you want than only the logged users to can rate the element(s) on page, sets USRRATE to 0
// And sets $_SESSION['username'] with the session that your script uses to keep logged users
define('USRRATE', 1);
if (USRRATE !== 1) {
    if (!isset($_SESSION)) {
        session_start();
    }
    if (isset($_SESSION['username'])) {
        define('RATER', $_SESSION['username']);
    }
}
/* From Here no need to modify */
//if(!headers_sent()) header('Content-type: text/html; charset=utf-8');      // header for utf-8
include 'class.Rating.php';
// Include Rating class
$obRtg = new Rating();
// if data from POST 'elm' and 'rate'
if (isset($_POST['elm']) && isset($_POST['rate'])) {
    // removes tags and external whitespaces from 'elm'
    $_POST['elm'] = array_map('strip_tags', $_POST['elm']);
    $_POST['elm'] = array_map('trim', $_POST['elm']);
    if (!empty($_POST['rate'])) {
        $_POST['rate'] = intval($_POST['rate']);
    }
    echo $obRtg->getRating($_POST['elm'], $_POST['rate']);
}
开发者ID:rajitha-bandara,项目名称:odwlbs-peoject,代码行数:31,代码来源:ratings.php

示例9: 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

示例10: elseif

    } else {
        Session::redirect('/profile');
    }
}
// make sure the advertisement exists
$advertisement = Advertisement::getAdvertisement($offer['advertisement']);
if ($advertisement == null) {
    Session::setError('Advertisement does not exist, please check the URL and try again');
    if ($page['user']['usertype'] == "1") {
        Session::redirect('/advertisement/' . $offer['advertisement']);
    } else {
        Session::redirect('/profile');
    }
}
// make sure a rating hasn't already been done
$rating = Rating::getRating($offer['id'], User::getId());
if ($rating != null) {
    Session::setError('You have already completed a rating for this offer.');
    if ($page['user']['usertype'] == "1") {
        Session::redirect('/advertisement/' . $offer['advertisement']);
    } else {
        Session::redirect('/profile');
    }
}
// if the form is posted
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $ratingScore = (int) $_POST['rating']['score'];
    if ($ratingScore > 5) {
        $ratingScore = 5;
    } elseif ($ratingScore < 1) {
        $ratingScore = 1;
开发者ID:Outlaw11A,项目名称:SEP2015,代码行数:31,代码来源:complete.php


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