本文整理汇总了PHP中Vote::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Vote::write方法的具体用法?PHP Vote::write怎么用?PHP Vote::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vote
的用法示例。
在下文中一共展示了Vote::write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Adds vote to the db.
*
* @return Vote data.
*/
protected function add() {
if($this->isAjax) {
$args = array(
'Choice' => Director::urlParam('Vote'),
'IP' => Director::urlParam('IP')
);
$vote = new Vote($args);
if($vote->write()) {
$args['success'] = true;
} else {
$args['success'] = false;
}
$json = json_encode($args);
return $json;
} else {
return Director::redirect('/');
}
}
示例2: registervote
public function registervote()
{
$pos = $_GET['pos'] == "true" ? true : false;
$roomid = Convert::raw2sql($_GET['roomid']);
$optionid = Convert::raw2sql($_GET['optionid']);
$nonce = $_POST["payment_method_nonce"];
$option = Option::get_by_id("Option", $optionid);
if (isset($_POST["payment_method_nonce"])) {
$result = Braintree_Transaction::sale(['amount' => '1.00', 'paymentMethodNonce' => $nonce]);
}
if ($option) {
$vote = new Vote();
$vote->Positive = $pos;
$vote->ParentID = $option->ID;
$voteID = $vote->write();
}
}