Update ParticipantListing.php

Removed assignments from inside if statements to remove ambiguity. This is recommended by the CiviCRM code standards.

Also refactored some copied and pasted code.