/** * Returns a list of single ballots with included tickets. * * Tickets ARE REQUIRED. A ballot without tickets will be unset. * * @param type $electionId * @param type $addCandidates * @return array */ public static function getListWithTickets($electionId, $addCandidates = true, $randomize = ELECTION_RANDOMIZE_TICKETS) { $singleList = self::getList($electionId); if (empty($singleList)) { return array(); } foreach ($singleList as $key => &$value) { $tickets = null; if ($addCandidates) { $tickets = Ticket::getListWithCandidates($value['id'], $randomize); } else { $tickets = Ticket::getList($value['id'], $randomize); } if (empty($tickets)) { unset($singleList[$key]); } else { $value['tickets'] = $tickets; } } return $singleList; }