_item.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * @var $model \app\models\base\Comments
  4. */
  5. /*
  6. * <div class="comment-item" data-author="<?=$model->author?>" id="comment-<?=$model->id?>">
  7. <div class="message"><?=$model->message?></div>
  8. <div class="meta"><?=$model->getPublishedAt()?>, <?=$model->author?>&nbsp;&nbsp;&nbsp;<a class="answer" href="javascript:void(0)" onclick="answer(this)">Ответить</a></div>
  9. </div>
  10. */
  11. $md = $model->getHash();
  12. $GLOBALS['umd_'.$md] = isset( $GLOBALS['umd_'.$md] )?$GLOBALS['umd_'.$md]:0;
  13. $GLOBALS['umd_'.$md]++;
  14. $message = $model->message;
  15. $message = str_replace(['[[',']]',"\n","\r"],['<span>','</span>','<br>',''],$message);
  16. $message = str_replace("</span><br>",'</span>',$message);
  17. //var_dump($model->islike);
  18. ?>
  19. <a href="javascript:void(0)" class="link-B disabled" name="<?=$md?>_<?=$GLOBALS['umd_'.$md]?>" aria-disabled="true" disabled></a>
  20. <?
  21. $lavel = ($lavel > 4)?4:$lavel;
  22. for( $i = 0; $i < $lavel; $i++){
  23. ?>
  24. <div class="ml-4">
  25. <?}?>
  26. <div class="media-block user-block" id="comment-<?=$model->id?>" data-author="<?=$model->author?>" data-id="<?=$model->id?>" data-time="<?=$model->getPublishedAt(true)?>">
  27. <a class="media-left" href="#<?=$md?>_<?=$GLOBALS['umd_'.$md]+1?>"><img class="rounded-circle mr-3" alt="Avatar Picture" loading="lazy" src="<?=$model->getAvatar()?>"></a>
  28. <div class="media-body">
  29. <div class="mar-btm">
  30. <a href="#<?=$md?>_<?=$GLOBALS['umd_'.$md]+1?>" class="btn-link text-semibold media-heading box-inline"><?=$model->author?></a>
  31. <p class="text-muted text-sm"><svg class="icon icon-comments" width="12px" height="12px"><use xlink:href="/svg/symbol/sprite-clear.svg#clock"></use></svg> <?=$model->getPublishedAt(true)?></p>
  32. </div>
  33. <p><?=$message?></p>
  34. <div class="pad-ver">
  35. <span class="tag tag-sm"><svg class="icon icon-comments" width="14px" height="14px"><use xlink:href="/svg/symbol/sprite-clear.svg#yy"></use></svg>&nbsp;&nbsp;<span id="cnt_<?=$model->id?>"><?=$model->likeed?></span> Нравится</span>
  36. <div class="btn-group">
  37. <a class="btn btn-sm btn-outline-secondary btn-hover-secondary btnlike<?=$model->islike?' disabled':''?>" href="javascript:void(0)" onclick="clike(1,<?=$model->id?>,this)"<?=$model->islike?' disabled':''?>>
  38. <svg class="icon icon-comments" width="15px" height="15px"><use xlink:href="/svg/symbol/sprite-clear.svg#up"></use></svg>
  39. </a>
  40. <a class="btn btn-sm btn-outline-secondary btn-hover-secondary btnlike<?=$model->islike?' disabled':''?>" href="javascript:void(0)" onclick="clike(-1,<?=$model->id?>,this)"<?=$model->islike?' disabled':''?>>
  41. <svg class="icon icon-comments" width="15px" height="15px"><use xlink:href="/svg/symbol/sprite-clear.svg#down"></use></svg></a>
  42. </div>
  43. <a class="btn btn-sm btn-outline-secondary" href="javascript:void(0)" onclick="answer(this)">Ответить</a>
  44. </div>
  45. <hr>
  46. </div>
  47. </div>
  48. <?
  49. for( $i = 0; $i < $lavel; $i++){
  50. ?>
  51. </div>
  52. <?}?>