Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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"' : '';
?>