<?php
echo $event->sender->menu->run();
// echo '<div>Step ' . $event->sender->currentStep . ' of ' . $event->sender->stepCount;
echo '<h3>' . $event->sender->getStepLabel($event->step) . '</h3>';
?>
<p>
Keskmine trükkimiskiirus <span id="keySpeed"></span>/<span id="symbolSpeed"></span>/<span id="correctSymbolSpeed"></span> klahvi/sümbolit/õiget sümbolit minutis.
Keskmiselt hoiti iga klahvi all <span id="averageDownTime"></span>ms
</p>

<table class="statstable">

	<tr>
		<th>Kiiremad</th>
		<td>
			<table>
				<tr>
					<td id="downLetter0"></td>
					<td id="downTime0"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="downLetter1"></td>
					<td id="downTime1"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="downLetter2"></td>
					<td id="downTime2"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<th>Aeglasemad</th>
		<td>
			<table>
				<tr>
					<td id="downLetter-3"></td>
					<td id="downTime-3"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="downLetter-2"></td>
					<td id="downTime-2"></td>
				</tr>
			</table>
		</td>
		<td>
			<table class="subtable">
				<tr>
					<td id="downLetter-1"></td>
					<td id="downTime-1"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<p>Keskmiselt kulus iga tähepaari vajutamiseks <span id="averagePairTime"></span>ms, mediaan <span id="medianPairTime"></span>ms</p>

<table class="statstable">
	<tr>
		<th>Kiiremad</th>
		<td>
			<table>
				<tr>
					<td id="pairSymbols0"></td>
					<td id="pairTime0"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="pairSymbols1"></td>
					<td id="pairTime1"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="pairSymbols2"></td>
					<td id="pairTime2"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="pairSymbols3"></td>
					<td id="pairTime3"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="pairSymbols4"></td>
					<td id="pairTime4"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr></tr>
	<tr>
		<th>Aeglasemad</th>
		<td>
			<table>
				<tr>
					<td id="pairSymbols-5"></td>
					<td id="pairTime-5"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="pairSymbols-4"></td>
					<td id="pairTime-4"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="pairSymbols-3"></td>
					<td id="pairTime-3"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="pairSymbols-2"></td>
					<td id="pairTime-2"></td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<tr>
					<td id="pairSymbols-1"></td>
					<td id="pairTime-1"></td>
				</tr>
			</table>
		</td>


	</tr>
</table>

<p>Tänan!</p>

<p>(Lehe värskendamine viib tagasi algusse.)</p>
<?php
echo CHtml::tag('div', array('class' => 'form'), $form);
$keyReader = $event->sender->read('KeyReader');
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/keyreader.js');

echo CHtml::form('', 'post', array('id' => 'errorForm'));
echo CHtml::hiddenField('PageError[message]', '', array('id' => 'errorFormMessage'));
echo CHtml::hiddenField('PageError[url]', '', array('id' => 'errorFormUrl'));
echo CHtml::hiddenField('PageError[linenumber]', '', array('id' => 'errorFormLineNumber'));
echo CHtml::hiddenField('PageError[useragent]', '', array('id' => 'errorFormUserAgent'));
echo CHtml::endForm();

echo CHtml::form('', 'post', array('id' => 'typeResultForm'));
echo CHtml::hiddenField('TypeResult[volunteerhash]', (isset($volunteerHash) ? $volunteerHash : ''), array('id' => 'typeResultFormVolunteerHash'));
echo CHtml::hiddenField('TypeResult[avgdowntime]', '', array('id' => 'typeResultFormAvgDownTime'));
echo CHtml::hiddenField('TypeResult[keypermin]', '', array('id' => 'typeResultFormKeyPerMin'));
echo CHtml::hiddenField('TypeResult[symbolpermin]', '', array('id' => 'typeResultFormSymbolPerMin'));
echo CHtml::hiddenField('TypeResult[correctsymbolpermin]', '', array('id' => 'typeResultFormCorrectSymbolPerMin'));
echo CHtml::hiddenField('TypeResult[avgpairtime]', '', array('id' => 'typeResultFormAvgPairTime'));
echo CHtml::hiddenField('TypeResult[medianpairtime]', '', array('id' => 'typeResultFormMedianPairTime'));
echo CHtml::endForm();
?>

<script type='text/javascript'>
var runData = <?= isset($keyReader['runData']) ? $keyReader['runData'] : '[]'; ?>;
SummaryPage.run();
</script>
