Skip to content

Commit 81c802c

Browse files
committed
Add comments while editing packet
1 parent d6c6bd7 commit 81c802c

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/controllers/Packet/Edit.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace BNETDocs\Controllers\Packet;
44

55
use \BNETDocs\Libraries\Authentication;
6+
use \BNETDocs\Libraries\Comment;
67
use \BNETDocs\Libraries\EventTypes;
78
use \BNETDocs\Libraries\Exceptions\PacketNotFoundException;
89
use \BNETDocs\Libraries\Logger;
@@ -25,6 +26,7 @@ class Edit extends Controller {
2526
public function &run(Router &$router, View &$view, array &$args) {
2627
$data = $router->getRequestQueryArray();
2728
$model = new PacketEditModel();
29+
$model->comments = null;
2830
$model->deprecated = null;
2931
$model->error = null;
3032
$model->format = null;
@@ -51,6 +53,10 @@ public function &run(Router &$router, View &$view, array &$args) {
5153
if ($model->packet === null) {
5254
$model->error = 'NOT_FOUND';
5355
} else {
56+
$model->comments = Comment::getAll(
57+
Comment::PARENT_TYPE_PACKET, $model->packet_id
58+
);
59+
5460
$model->deprecated = $model->packet->isDeprecated();
5561
$model->id = $model->packet->getPacketId();
5662
$model->name = $model->packet->getPacketName();

src/models/News/Edit.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class Edit extends \BNETDocs\Models\ActiveUser
33
{
44
public $acl_allowed;
55
public $category;
6+
public $comments;
67
public $content;
78
public $error;
89
public $markdown;

src/models/Packet/Edit.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<?php
2-
32
namespace BNETDocs\Models\Packet;
4-
53
use \CarlBennett\MVC\Libraries\Model;
6-
7-
class Edit extends Model {
8-
4+
class Edit extends Model
5+
{
96
public $acl_allowed;
7+
public $comments;
108
public $error;
119
public $format;
1210
public $id;
@@ -19,5 +17,4 @@ class Edit extends Model {
1917
public $remarks;
2018
public $used_by;
2119
public $user;
22-
2320
}

src/templates/Packet/Edit.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */
22
namespace BNETDocs\Templates\Packet;
3+
use \BNETDocs\Libraries\Comment;
34
use \CarlBennett\MVC\Libraries\Common;
45
use \CarlBennett\MVC\Libraries\Pair;
56
$title = 'Edit Packet';
67
$description = 'This form allows an individual to edit a packet.';
78
$this->opengraph->attach(new Pair('url', '/packet/edit'));
89
$this->opengraph->attach(new Pair('type', 'article'));
10+
$comments = $this->getContext()->comments;
911
$error = $this->getContext()->error;
1012
switch ($error)
1113
{
@@ -90,7 +92,7 @@ require('./header.inc.phtml'); ?>
9092
<input class="btn btn-success" type="submit" value="Save" tabindex="9"/>
9193
</div>
9294
</form>
93-
<? } ?>
95+
<? $comment_parent_type = Comment::PARENT_TYPE_PACKET; $comment_parent_id = $packet_id; require('./Comment/Section.inc.phtml'); } ?>
9496
<? } else { ?>
9597
<h1 class="text-success">Edit Packet</h1>
9698
<div class="alert alert-success"><p class="mb-0">Your packet has been edited.</p></div>

0 commit comments

Comments
 (0)