/** * function that creates a new ticket. * A new ticket will be created, in case the extra_info != 0 and the http request came from ingame, then a ticket_info page will be created. * A log entry will be written, depending on the $real_authors value. In case the for_support_group parameter is set, the ticket will be forwarded immediately. * Also the mail handler will create a new email that will be sent to the author to notify him that his ticket is freshly created. * @param $title the title we want to give to the ticket. * @param $content the content we want to give to the starting post of the ticket. * @param $category the id of the category that should be related to the ticket. * @param $author the person who's id will be stored in the database as creator of the ticket. * @param $real_author should be the same id, or a moderator/admin who creates a ticket for another user (this is used for logging purposes). * @param $for_support_group in case you directly want to forward the ticket after creating it. (default value = 0 = don't forward) * @param $extra_info used for creating an ticket_info page related to the ticket, this only happens when the ticket is made ingame. * @return the created tickets id. */ public static function create_Ticket($title, $content, $category, $author, $real_author, $for_support_group = 0, $extra_info = 0) { //create the new ticket! $ticket = new Ticket(); $values = array("Title" => $title, "Timestamp" => 0, "Status" => 1, "Queue" => 0, "Ticket_Category" => $category, "Author" => $author, "Priority" => 0); $ticket->set($values); $ticket->create(); $ticket_id = $ticket->getTId(); //if ingame then add an extra info if (Helpers::check_if_game_client() && $extra_info != 0) { $extra_info['Ticket'] = $ticket_id; Ticket_Info::create_Ticket_Info($extra_info); } //write a log entry if ($author == $real_author) { Ticket_Log::createLogEntry($ticket_id, $author, 1); } else { Ticket_Log::createLogEntry($ticket_id, $real_author, 2, $author); } Ticket_Reply::createReply($content, $author, $ticket_id, 0, $author); //forwards the ticket directly after creation to the supposed support group if ($for_support_group) { Ticket::forwardTicket(0, $ticket_id, $for_support_group); } //send email that new ticket has been created Mail_Handler::send_ticketing_mail($ticket->getAuthor(), $ticket, $content, "NEW", $ticket->getForwardedGroupId()); return $ticket_id; }