Example #1
0
 public static function confirmNotification($ticket_id, $update_id, $type)
 {
     $ticket = new Ticket(array('id' => $ticket_id));
     $output = $ticket->getOwner();
     $owner = $output[0]['wluser'];
     if ($owner == $_SESSION['user']['username']) {
         switch ($type) {
             case 'message':
                 //get id for message from somewhere, not from client
                 $msg = new Message(array('ticket_id' => $ticket_id));
                 $msg->clearNotification();
                 $ticket->clearNotification();
                 break;
             case 'addition':
                 $update = new Update(array('id' => $update_id));
                 $update->clearNotification();
                 $ticket->clearNotification();
                 break;
             case 'answer':
                 $update = new Update(array('id' => $update_id));
                 $update->clearNotification();
                 $ticket->clearNotification();
                 break;
             default:
                 throw new Exception('Wrong type for notification');
         }
     }
 }