You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TicketSolver.php 2.2KB

3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace Lc\SovBundle\Solver\Ticket;
  3. use Lc\SovBundle\Model\Ticket\TicketInterface;
  4. use Lc\SovBundle\Model\Ticket\TicketModel;
  5. class TicketSolver
  6. {
  7. public function getTypeChoices($context = 'backend'): array
  8. {
  9. return [
  10. TicketModel::TYPE_GENERAL_QUESTION,
  11. TicketModel::TYPE_TECHNICAL_PROBLEM,
  12. ];
  13. }
  14. public static function getStatusChoices(): array
  15. {
  16. return [
  17. TicketModel::TICKET_STATUS_OPEN,
  18. TicketModel::TICKET_STATUS_BEING_PROCESSED,
  19. TicketModel::TICKET_STATUS_PROCESSED,
  20. TicketModel::TICKET_STATUS_CLOSED,
  21. ];
  22. }
  23. public function getTypeLabel(TicketInterface $ticket): string
  24. {
  25. return 'entity.Ticket.fields.typeChoices.'.$ticket->getType();
  26. }
  27. public function getStatusLabel(TicketInterface $ticket): string
  28. {
  29. return 'entity.Ticket.fields.statusChoices.'.$ticket->getStatus();
  30. }
  31. public function getUsername(TicketInterface $ticket)
  32. {
  33. if ($ticket->getUser()) {
  34. return $ticket->getUser()->getName();
  35. } else {
  36. return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname();
  37. }
  38. }
  39. public function getUserInfosTicket(TicketInterface $ticket)
  40. {
  41. $user = $ticket->getUser();
  42. if ($user) {
  43. return '#'.$user->getId().' '.$user->getFirstname().' '.$user->getLastname(). ' '.$user->getEmail();
  44. } else {
  45. return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname().' '.$ticket->getVisitorEmail(
  46. );
  47. }
  48. }
  49. public function getEmail(TicketInterface $ticket)
  50. {
  51. if ($ticket->getUser()) {
  52. return $ticket->getUser()->getEmail();
  53. } else {
  54. return $ticket->getVisitorEmail();
  55. }
  56. }
  57. public function getVisitorInfos(TicketInterface $ticket)
  58. {
  59. return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname().' ('.$ticket->getVisitorEmail(
  60. ).')';
  61. }
  62. public function getLastMessage(TicketInterface $ticket)
  63. {
  64. return $ticket->getTicketMessages()->last();
  65. }
  66. }