Update ParticipantListing.php

Removed repeated instances of assignments in if statements. Refactored some copied and pasted code into a parameterised function.