Skip to content

Commit

Permalink
#541 -- Update protocol comments feature
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonmoura committed Oct 17, 2022
1 parent 2ce4d2a commit d68c6e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,10 @@
<th>{{ comment.created|date('d/m/Y H:i:s') }}</th>
<td>{{ comment.owner }}</td>
<td>{% if comment.isConfidential %}<i class='glyphicon glyphicon-ok'></i>{% endif %}</td>
<td>{{ comment.message|nl2br }}</td>
<td>{{ comment.message|nl2br }}</td>
<td>
{% if comment.filename %}
<a href='{{ asset(comment.uri) }}' target="_blank" class='btn btn-default btn-xs' target="_blank">
<i class='glyphicon glyphicon-eye-open'></i>
</a>
<a href='{{ asset(comment.uri) }}' target="_blank" class='btn btn-default btn-xs' data-toggle="tooltip" data-placement="top" title="{{ comment.realFilename }}" target="_blank"><i class='glyphicon glyphicon-eye-open'></i></a>
{% endif %}
</td>
</tr>
Expand Down Expand Up @@ -321,14 +319,12 @@
{% for comment in protocol.comment %}
{% if 'member-of-committee' == comment.role %}
<tr>
<th>{{ comment.created|date('d/m/Y H:i:s') }}</th>
<td>{{ comment.owner }}</td>
<td>{{ comment.message|nl2br }}</td>
<td>
<th>{{ comment.created|date('d/m/Y H:i:s') }}</th>
<td>{{ comment.owner }}</td>
<td>{{ comment.message|nl2br }}</td>
<td>
{% if comment.filename %}
<a href='{{ asset(comment.uri) }}' target="_blank" class='btn btn-default btn-xs' target="_blank">
<i class='glyphicon glyphicon-eye-open'></i>
</a>
<a href='{{ asset(comment.uri) }}' target="_blank" class='btn btn-default btn-xs' data-toggle="tooltip" data-placement="top" title="{{ comment.realFilename }}" target="_blank"><i class='glyphicon glyphicon-eye-open'></i></a>
{% endif %}
</td>
</tr>
Expand Down
10 changes: 4 additions & 6 deletions symphony/src/Proethos2/ModelBundle/Entity/ProtocolComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,16 @@ class ProtocolComment extends Base
*/
private $filepath;

public function __toString() {
return $this->getDate() . " - " . $this->getSubject();
}

public function getRealFilename() {
$filename = explode('_', $this->getFilename(), 2);
return end($filename);
}

public function getUploadDirectory() {

$upload_directory = __DIR__.'/../../../../uploads/comments';

$upload_directory = $upload_directory . "/" . str_pad($this->getProtocol()->getId(), 5, '0', STR_PAD_LEFT);

if(!is_dir($upload_directory)) {
mkdir($upload_directory);
}
Expand All @@ -113,7 +111,7 @@ public function setFile($file) {

public function getUri() {

return "/uploads/comments/" . $this->getFilename();
return "/uploads/comments/" . str_pad($this->getProtocol()->getId(), 5, '0', STR_PAD_LEFT) . "/" . $this->getFilename();
}

/**
Expand Down

0 comments on commit d68c6e2

Please sign in to comment.