Esempio n. 1
0
 /**
  * Displays details for a ticket
  *
  * @apiMethod GET
  * @apiUri    /support/{ticket}
  * @apiParameter {
  * 		"name":        "ticket",
  * 		"description": "Ticket identifier",
  * 		"type":        "integer",
  * 		"required":    true,
  * 		"default":     0
  * }
  * @return    void
  */
 public function readTask()
 {
     $this->requiresAuthentication();
     if (!$this->acl->check('read', 'tickets')) {
         throw new Exception(Lang::txt('Not authorized'), 403);
     }
     // Initiate class and bind data to database fields
     $ticket_id = Request::getInt('ticket', 0);
     // Initiate class and bind data to database fields
     $ticket = new \Components\Support\Models\Ticket($ticket_id);
     $response = new stdClass();
     $response->id = $ticket->get('id');
     $response->owner = new stdClass();
     $response->owner->username = $ticket->owner('username');
     $response->owner->name = $ticket->owner('name');
     $response->owner->id = $ticket->owner('id');
     $response->reporter = new stdClass();
     $response->reporter->name = $ticket->submitter('name');
     $response->reporter->username = $ticket->submitter('username');
     $response->reporter->email = $ticket->submitter('email');
     $response->status = new stdClass();
     $response->status->alias = $ticket->status('class');
     $response->status->title = $ticket->status('text');
     $response->status->id = $ticket->get('status');
     foreach (array('created', 'severity', 'os', 'browser', 'ip', 'hostname', 'uas', 'referrer', 'open', 'closed') as $prop) {
         $response->{$prop} = $ticket->get($prop);
     }
     $response->report = $ticket->content('raw');
     $response->url = str_replace('/api', '', rtrim(Request::base(), '/') . '/' . ltrim(Route::url('index.php?option=com_support&controller=tickets&task=tickets&id=' . $response->id), '/'));
     $response->comments = array();
     foreach ($ticket->comments() as $comment) {
         $c = new stdClass();
         $c->id = $comment->get('id');
         $c->created = $comment->get('created');
         $c->creator = new stdClass();
         $c->creator->username = $comment->creator('username');
         $c->creator->name = $comment->creator('name');
         $c->creator->id = $comment->creator('id');
         $c->private = $comment->access ? true : false;
         $c->content = $comment->content('raw');
         $response->comments[] = $c;
     }
     $this->send($response);
 }
Esempio n. 2
0
        echo ($row->isOpen() ? 'open' : 'closed') . ' ' . $row->status('class');
        ?>
 status">
											<?php 
        echo $row->status('text');
        echo !$row->isOpen() ? ' (' . $this->escape($row->get('resolved')) . ')' : '';
        ?>
										</span>
									</span>
								</td>
								<td colspan="6">
									<p>
										<span class="ticket-author">
											<?php 
        echo $this->escape($row->get('name'));
        echo $row->submitter()->get('id') ? ' (<a href="' . Route::url('index.php?option=com_members&id=' . $row->submitter()->get('id')) . '">' . $this->escape($row->get('login')) . '</a>)' : ($row->get('login') ? ' (' . $this->escape($row->get('login')) . ')' : '');
        ?>
										</span>
										<span class="ticket-datetime">
											@ <time datetime="<?php 
        echo $row->created();
        ?>
"><?php 
        echo $row->created('local');
        ?>
</time>
										</span>
										<?php 
        if ($lastcomment && $lastcomment != '0000-00-00 00:00:00') {
            ?>
											<span class="ticket-activity">