* Class that handles additional info sent by ticket creation ingame.
* If a user creates a ticket ingame, there are a lot of extra $_GET parameters being sent inside the http request that might have something todo with the ticket.
* for example the OS the user uses or the processor of it's computer, but also the current client version etc.
* This information can be stored and retrieved by using the ticket_info class.
* @author Daan Janssens, mentored by Matthew Lagoe
* @param $ticket_id the id of the ticket of which we want all related log entries returned.
* @return an array of ticket_log objects, be aware that the author in the ticket_log object is a ticket_user object on its own (so not a simple integer).
*/
public static function getLogsOfTicket( $ticket_id) {
$dbl = new DBLayer("lib");
$statement = $dbl->execute("SELECT * FROM ticket_log INNER JOIN ticket_user ON ticket_log.Author = ticket_user.TUserId and ticket_log.Ticket=:id ORDER BY ticket_log.TLogId ASC", array('id' => $ticket_id));
@ -47,7 +68,16 @@ class Ticket_Log{
return $result;
}
//Creates a log entry
/**
* create a new log entry.
* It will check if the $TICKET_LOGGING global var is true, this var is used to turn logging on and off. In case it's on, the log message will be stored.
* the action id and argument (which is -1 by default), will be json encoded and stored in the query field in the db.
* @param $ticket_id the id of the ticket related to the new log entry
* @param $author_id the id of the user that instantiated the logging.
* @param $action the action id (see the list in the class description)
* @param $arg argument for the action (default = -1)
*/
public static function createLogEntry( $ticket_id, $author_id, $action, $arg = -1) {
global $TICKET_LOGGING;
if($TICKET_LOGGING){
@ -59,14 +89,23 @@ class Ticket_Log{
}
//return constructed element based on TLogId
/**
* return constructed element based on TLogId
* @param $ticket_log id of the entry that we want to load into our object.
* @return constructed ticket_log object.
*/
public static function constr_TLogId( $id) {
$instance = new self();
$instance->setTLogId($id);
return $instance;
}
//returns list of all logs of a ticket
/**
* return all log entries related to a ticket.
* @param $ticket_id the id of the ticket of which we want all related log entries returned.
* @return an array of ticket_log objects, here the author is an integer.
* @todo only use one of the 2 comparable functions in the future and make the other depricated.
*/
public static function getAllLogs($ticket_id) {
$dbl = new DBLayer("lib");
$statement = $dbl->execute("SELECT * FROM ticket_log INNER JOIN ticket_user ON ticket_log.Author = ticket_user.TUserId and ticket_log.Ticket=:id", array('id' => $ticket_id));