<?php
/**
 * available variables:
 * header = headers for table
 * rows = rows for table
 * winner = show winner results
 * winner_message = show info if not empty
 */
?>
<div class="container">
	<?php if(!empty($winner_message)): ;?>
		<div id="winner-info" class="modal show" id="winner-modal" role="dialog">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">&times;</button>
					</div>
					<div class="modal-body">
						<div class="winner-message">
							<?= $winner_message['message']; ?>
						</div>
						<?php if (!empty($winner_reward)): ?>
							<div class="reward"><?= $winner_reward['message']; ?></div>
						<?php endif; ?>
						<?php if (!empty($winner_link)): ?>
							<div class="reward-link">
								<a href="<?= $winner_link['winner_link']; ?>"><?= $winner_link['winner_title'];?></a>
							</div>
						<?php endif; ?>
						<?php if (!empty($winner_pdf)): ?>
							<div class="reward-pdf">
								<a href="<?= $winner_pdf['pdf_winners']; ?>" target="_blank"><?= t("Pdf dla zwycięzcy"); ?></a>
							</div>
						<?php endif; ?>
					</div>
				</div>
			</div>
		</div>
	<?php endif; ?>
	<?php if (!empty($quiz_message)): ?>
		<div id="winner-info" class="modal show" id="winner-modal" role="dialog">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">&times;</button>
					</div>
					<div class="modal-body">
						<span><?= $quiz_message?></span>
					</div>
				</div>
			</div>
		</div>
	<?php endif; ?>
	<div class="table-overflow">
	<table class="table table-bordered">
		<thead>
		<tr>
			<?php foreach ($header as $column_name): ?>
				<th><?= $column_name ?></th>
			<?php endforeach; ?>
		</tr>
		</thead>
		<tbody>
			<?php foreach ($rows as $row): ?>
				<tr>
					<td><?= $row[0]; ?></td>
					<td><?= $row[1]; ?></td>
					<td><?= $row[2]; ?></td>
					<td><?= $row[3]; ?></td>
					<td><?= $row[4]; ?></td>
					<td><?= $row[5]; ?>*</td>
				</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
    <label class="my-results-caption"><small>* Odpowiedzi konkursu dostępne są dopiero po jego zakończeniu.</small></label>
	</div>
	<?php if (!empty($winner)): ?>
		<h2><?= t('Moje wygrane') ?></h2>
		<div class="table-overflow">
		<table class="table table-bordered">
			<thead>
				<th><?= t('Tytuł'); ?></th>
				<th><?= t('Warunek'); ?></th>
			</thead>
		<?php foreach($winner as $title => $win): ?>
			<tr>
				<td><?= $title; ?></td>
				<td><?= $win; ?></td>
			</tr>
		<?php endforeach; ?>
		</table>
	</div>
	<?php endif; ?>
</div>
