Пример #1
0
				pad_w_zero = '';
				
				if(comment_number.length < 2)pad_w_zero = '0'; ///pad_w_zero
				if(reset_comment == false ) { style = "background-color:#FFFF99";}
				new_line = '<div class="comment_board_entry" id="c'+comments[i]['comment_id']+'" style="'+style+'">';
				
				new_line += '<div class="comment_header">';
				new_line += '<span class="comment_number">'+pad_w_zero+comment_number+'</span>';
				new_line += '<span class="comment_country">'+comments[i]['comment_country']+'</span>';
				new_line += '<span class="comment_time">'+ comments[i]['comment_time'] +' </span>';
				new_line += '<span class="comment_username"><a href="<?php 
echo Yii::app()->getRequest()->getBaseUrl(true);
?>
/mysub/'+ comments[i]['username'] +'">'+ comments[i]['username'] + '</a></span>';				
				new_line += '<?php 
echo SiteHelper::comment_vote("'+comments[i]['comment_id']+'", "'+ comments[i]['likes']+'", "'+comments[i]['dislikes']+'");
?>
';
				new_line += '</div>';
				new_line += '<div class="comment_text">'+ comments[i]['comment_text']+'</div>';
				
				new_line += '</div>';
				
				$("#comments_board").prepend(new_line);
				
				if(reset_comment == false ){
					$("#c"+comments[i]['comment_id']).fadeTo("slow",0.5, function () {
						$(this).css("background-color", "white");
						$(this).fadeTo("slow",1.0);
					});
				}
Пример #2
0
$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>";
}
foreach ($comments as $comment) {
    ?>
<div class="comment" id="c<?php 
    echo $comment->id;
    ?>
">
	<div class="comment_info">
		<?php 
    $time_since_comment = SiteLibrary::time_since(SiteLibrary::utc_time() - $comment->time);
    echo '<span class="comment_number">' . str_pad($comment->comment_number, 2, '0', STR_PAD_LEFT) . '</span>' . '<span class="comment_country">' . $comment->country->code . '</span>' . ' <span>' . CHtml::link($comment->user->username, array('mysub/' . $comment->user->username)) . '</span>' . ' <span title="' . date("Y/m/d H:i", $comment->time) . ' UTC ' . '">' . Yii::t('comment', '{time_number} {time_name} ago', array('{time_number}' => $time_since_comment[0], '{time_name}' => Yii::t('site', $time_since_comment[1]))) . '</span>';
    echo SiteHelper::comment_vote($comment->id, $comment->likes, $comment->dislikes);
    ?>
	</div>

	<div class="comment_content">
		<?php 
    echo nl2br(CHtml::encode($comment->comment));
    ?>
	</div>

</div><!-- comment -->
<?php 
}
?>
<br>
<div class="flash-notice" style="border:none"><?php