|
2 | 2 | namespace BNETDocs\Templates; |
3 | 3 |
|
4 | 4 | use \BNETDocs\Libraries\Common; |
| 5 | +use \BNETDocs\Libraries\Gravatar; |
5 | 6 | use \BNETDocs\Libraries\Pair; |
6 | 7 |
|
| 8 | +$comments = $this->getContext()->comments; |
7 | 9 | $object_id = $this->getContext()->packet_id; |
8 | 10 | $object = $this->getContext()->packet; |
9 | 11 |
|
@@ -31,6 +33,7 @@ if ($object) { |
31 | 33 | } |
32 | 34 |
|
33 | 35 | $this->additional_css[] = "/a/packet.css"; |
| 36 | +$this->additional_css[] = "/a/comments.css"; |
34 | 37 | require("./header.inc.phtml"); |
35 | 38 | ?> |
36 | 39 | <article> |
@@ -67,8 +70,21 @@ require("./header.inc.phtml"); |
67 | 70 | <article> |
68 | 71 | <header>Comments</header> |
69 | 72 | <section> |
70 | | - <?php require("./NYI.inc.phtml"); ?> |
71 | | - <p class="center">If you'd like to leave a suggestion or concern, you can do so <a href="https://github.com/BNETDocs/bnetdocs-web/issues/new?labels[]=bnetdocs-phoenix&labels[]=question&body=<?php echo rawurlencode("Hi,\n\n<fill in your question here>\n\nThanks!\n\nReference: " . $url); ?>" rel="external">over on GitHub</a>. Sorry for the trouble!</p> |
| 73 | +<?php if (!$comments) { ?> |
| 74 | + <p class="center"><em>no one has commented yet.</em></p> |
| 75 | +<?php } else { ?> |
| 76 | + <table class="comments"><tbody> |
| 77 | +<?php foreach ($comments as $c) { |
| 78 | + $c_user = $c->getUser(); |
| 79 | + $c_user_name = $c_user->getName(); |
| 80 | + $c_user_id = $c->getUserId(); |
| 81 | + $c_user_url = Common::relativeUrlToAbsolute("/user/" . $c_user_id . "/" . Common::sanitizeForUrl($c_user_name, true)); |
| 82 | + $c_user_avatar = "https:" . (new Gravatar($c_user->getEmail()))->getUrl(22, "identicon"); |
| 83 | +?> |
| 84 | + <tr><td><a href="<?php echo $c_user_url; ?>"><img class="avatar" src="<?php echo $c_user_avatar; ?>"/> <?php echo htmlspecialchars($c_user_name, ENT_HTML5, "UTF-8"); ?></a><br/><time class="comment_timestamp" datetime="<?php echo $c->getCreatedDateTime()->format("c"); ?>"><?php echo $c->getCreatedDateTime()->format("D M j, Y g:ia T"); ?></time></td><td><?php echo $c->getContent(true); ?></td></tr> |
| 85 | +<?php } ?> |
| 86 | + </tbody></table> |
| 87 | +<?php } ?> |
72 | 88 | </section> |
73 | 89 | <?php } else { ?> |
74 | 90 | <header class="red"><?php echo htmlspecialchars($title, ENT_HTML5, "UTF-8"); ?></header> |
|
0 commit comments