Example #1
0
 /**
  * return all tickets of a specific user.
  * an array of all tickets created by a specific user are returned by this function.
  * @param $author the id of the user of whom we want all tickets from.
  * @return an array containing all ticket objects related to a user.
  */
 public static function getTicketsOf($author)
 {
     $dbl = new DBLayer("lib");
     $statement = $dbl->execute("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket_user.ExternId=:id", array('id' => $author));
     $row = $statement->fetchAll();
     $result = array();
     foreach ($row as $ticket) {
         $instance = new self();
         $instance->setTId($ticket['TId']);
         $instance->setTimestamp($ticket['Timestamp']);
         $instance->setTitle($ticket['Title']);
         $instance->setStatus($ticket['Status']);
         $instance->setQueue($ticket['Queue']);
         $instance->setTicket_Category($ticket['Ticket_Category']);
         $instance->setAuthor($ticket['Author']);
         $result[] = $instance;
     }
     return $result;
 }