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


PHP SiteHelper::subject_vote方法代码示例

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


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

示例1: actionVote

 /**
  * Adds one vote to the subject votes count, a like or dislike.
  * @param integer $vote_id the ID of the subject
  * @param string $vote the vote: either like or dislike
  */
 public function actionVote($subject_id, $vote = "")
 {
     global $arr_response;
     if (!Yii::app()->user->isGuest) {
         $subject_count = Subject::add_vote($subject_id, $vote, Yii::app()->user->id);
         if ($subject_count['success'] == true) {
             $arr_response['subject_vote'] = SiteHelper::subject_vote($subject_count['subject_id'], $subject_count['likes'], $subject_count['dislikes'], true);
             $arr_response['response_message'] = Yii::t('subject', 'Vote sent.');
         } else {
             $arr_response['response_code'] = 409;
             $arr_response['response_message'] = $subject_count['message'];
         }
     } else {
         $arr_response['response_code'] = 401;
         $arr_response['response_message'] = Yii::t('subject', 'Sorry, you must log in to be able to vote.');
     }
 }
开发者ID:jjsub,项目名称:samesub,代码行数:22,代码来源:SubjectController.php

示例2: display_elements

function display_elements(obj_json){



	time_submitted = fromUnixTime(obj_json.time_submitted);
	current_title = obj_json.title;//title
	submit_info = '<?php 
echo Yii::t('site', 'by {username} at {time} UTC', array('{username}' => '<a href="' . Yii::app()->getRequest()->getBaseUrl(true) . '/mysub/\'+obj_json.username+\'">\' + obj_json.username + \'</a>', '{time}' => "'+time_submitted.getHours()+':'+time_submitted.getMinutes()+'"));
?>
';
	share_links = '<?php 
echo SiteHelper::share_links("'+obj_json.urn+'", "'+obj_json.title+'");
?>
';
	$('#subject_voting').html( '<?php 
echo SiteHelper::subject_vote("'+obj_json.subject_id+'", "'+obj_json.likes+'", "'+obj_json.dislikes+'");
?>
');;
	
	$('#share_links').html(share_links);
	$('#submit_info').html(submit_info);
	$('#perma_link').html('<a id="urn_link" title="' +obj_json.title +'" href="'+obj_json.permalink+'">[permalink]</a>');
	
	$('#content_div_1').empty();//some times iframes or object elements stay inside, so clean it just in those rare cases
	$('#content_div_1').html('<?php 
echo SiteHelper::content_html("'+obj_json.content_html+'", "'+obj_json.user_comment+'");
?>
 ');
	current_info = '<b>'+obj_json.country_name+'</b> | ';
	//$("#comments_board").html("Waiting for comments");
	
开发者ID:jjsub,项目名称:samesub,代码行数:30,代码来源:core.php

示例3: count

	<div class="row">
		<?php 
echo SiteHelper::formatted($model->user_comment);
?>
	</div>
	

<div style="float:left;">
	<?php 
echo SiteHelper::share_links($model->urn, $model->title);
?>
</div>
<div style="float:right;margin-left:10px">
	<?php 
echo SiteHelper::subject_vote($model->id, $model->likes, $model->dislikes);
?>
</div>
<div class="clear_both"></div>

<br>
<h3 class="detail_header"><?php 
echo Yii::t('subject', 'Comments');
?>
</h3>
<?php 
$comments = Comment::model()->with('user', 'country')->findAll("subject_id = {$model->id}");
$total_comments = count($comments);
if ($total_comments == 0) {
    echo "<h4>" . Yii::t('subject', 'NO COMMENTS') . "</h4>";
}
开发者ID:jjsub,项目名称:samesub,代码行数:30,代码来源:view.php


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