Пример #1
0
 /**
  * @return string урл первого нового комментария
  */
 public static function getNewCommentsUrl()
 {
     $userID = \Yii::app()->getModule('comments')->getUserID();
     if (!empty($userID)) {
         $newComments = NewComments::model()->user($userID)->findAll();
     }
     if (empty($newComments)) {
         return false;
     }
     $comment = Comment::model()->findByPk($newComments[0]->comment_id);
     return $comment->url . '#comment_' . $comment->id;
 }
Пример #2
0
 public function isNew()
 {
     $userID = \Yii::app()->getModule('comments')->getUserID();
     if (empty($userID)) {
         return false;
     }
     return NewComments::model()->user($userID)->findByAttributes(array('comment_id' => $this->id)) ? true : false;
 }
Пример #3
0
echo $comment->id;
?>
"></a>

<?php 
$newCssClass = '';
if ($comment->isNew()) {
    ?>
    <?php 
    $newCssClass = ' new';
    ?>
    <?php 
    if ($userID = \Yii::app()->getModule('comments')->getUserID()) {
        ?>
        <?php 
        NewComments::model()->deleteByPk(array('user_id' => $userID, 'comment_id' => $comment->id));
        ?>
    <?php 
    }
}
?>

<div<?php 
echo $enableMicrodata ? ' itemprop="comment" itemscope itemtype="http://schema.org/Comment"' : '';
?>
 class="comment well well-sm<?php 
echo $newCssClass;
?>
"<?php 
echo $margin != 0 ? ' style="margin-left: ' . $margin . 'px"' : '';
?>