/**
  * Returns list of attachments in this post. Result is cached.
  *
  * @param bool $reload True to reload attachments from server.
  * @return kyResultSet
  */
 public function getAttachments($reload = false)
 {
     if ($this->attachments === null || $reload) {
         $this->attachments = array();
         if ($this->has_attachments) {
             /*
              * Need to get all attachments, and then filter by post identifier.
              */
             $attachments = kyTicketAttachment::getAll($this->ticket_id);
             foreach ($attachments as $attachment) {
                 /* @var $attachment kyTicketAttachment */
                 if ($attachment->getTicketPostId() === $this->id) {
                     $this->attachments[] = $attachment;
                 }
             }
         }
     }
     /** @noinspection PhpParamsInspection */
     return new kyResultSet($this->attachments);
 }
Esempio n. 2
0
 /**
  * Returns list of attachments in all posts of this ticket.
  *
  * Result is cached till the end of script.
  *
  * @param bool $reload True to reload attachments from server.
  * @return kyTicketAttachment[]
  */
 public function getAttachments($reload = false)
 {
     if ($this->attachments === null || $reload) {
         $this->attachments = kyTicketAttachment::getAll($this->id)->getRawArray();
     }
     /** @noinspection PhpParamsInspection */
     return new kyResultSet($this->attachments);
 }
				</td>
			</tr>
		</table>
		<div class="clear"></div>
		<table id="post">
			<?php 
foreach ($ticket_details->getPosts() as $posts) {
    ?>
				<tr>
					<td colspan="3"><?php 
    echo $posts->getContents();
    ?>
</td>
					<td>
						<?php 
    foreach (kyTicketAttachment::getAll($ticket_details->getId()) as $key) {
        if ($posts->getId() == $key->getTicketPostId()) {
            echo "<a href='" . JURI::Root() . "tmp/" . $key->getFileName() . "'>" . $key->getFileName() . "</a>&nbsp;";
        } else {
            echo "&nbsp;";
        }
    }
    ?>
					</td>
				</tr>
				<tr class="ticketgeneralinfocontainer" id="post_details">
					<td>Posted on</td>
					<td><?php 
    echo date('M d, Y h:i A', strtotime($posts->getDateline()));
    ?>
</td>