comment_card.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App;
  3. use App\Interfaces\CommentInterface;
  4. /**
  5. * @var CommentInterface $comment
  6. */
  7. $core = Core::getInstance();
  8. $user = $core->getUser();
  9. $comment_user = $comment->getUser();
  10. $is_internal = $comment->isInternal();
  11. $dt_created = $comment->getDateTimeCreated();
  12. $attachments = $comment->getAttachments();
  13. $html = $comment->getHtml();
  14. ?>
  15. <div id="ticket-comment-<?=$comment->id?>" class="card card-body mb-3">
  16. <div class="d-flex">
  17. <div class="flex-shrink-0">
  18. <img src="<?=htmlspecialchars($comment_user->getAvatarUrl())?>" alt="<?=htmlspecialchars($comment_user->getDisplayName())?>" />
  19. </div>
  20. <div class="flex-grow-1 ms-3">
  21. <div class="float-end">
  22. <?php
  23. if($is_internal) {
  24. ?>
  25. <span class="badge bg-primary">
  26. <?=htmlspecialchars(__("Internal Comment"))?>
  27. </span>
  28. <?php
  29. }
  30. if($comment_user->is($user)) {
  31. $comment->renderEditIcon();
  32. }
  33. ?>
  34. </div>
  35. <div>
  36. <i class="fa fa-fw fa-user-circle"></i>
  37. <?=htmlspecialchars($comment_user->getDisplayName())?> (<?=htmlspecialchars($comment_user->email)?>)
  38. </div>
  39. <div>
  40. <i class="fa fa-fw fa-clock"></i>
  41. <?=htmlspecialchars($user->formatDateTime($dt_created))?>
  42. </div>
  43. <hr />
  44. <?=$html?>
  45. <?php
  46. if($attachments) {
  47. ?>
  48. <hr />
  49. <h5><?=htmlspecialchars(__("Attachments"))?></h5>
  50. <?php
  51. foreach($attachments as $attachment) {
  52. $attachment->renderButton();
  53. }
  54. }
  55. ?>
  56. </div>
  57. </div>
  58. </div>