44 lines
2.0 KiB
PHP
44 lines
2.0 KiB
PHP
<?php
|
|
|
|
/* displays user's grades */
|
|
|
|
$iOutOf = isset($_POST['outofvalue'])?$_POST['outofvalue']:20;
|
|
$aiConstraints = array('grade' => $_SESSION['grade'], 'class' => $_SESSION['class'], USER_TABLE => $_SESSION['user']);
|
|
$asResults = getResults($aiConstraints);
|
|
|
|
if(!$asResults)
|
|
{
|
|
$asDisplay = array('<tr><td colspan="3"><p class="noinfo">Aucune note.Vous avez répondu à aucun QCM</p></td></tr>', );
|
|
$sDisplayAverage = '<th colspan="3" class="bottom-left-rounded bottom-right-rounded">Moyenne : Aucune donnée disponible</th>';
|
|
}
|
|
else
|
|
{
|
|
$asResults = $asResults[$_SESSION['grade']][$_SESSION['class']][$_SESSION['user']];
|
|
$iUserGlobalAvg = getResultsAverage($iOutOf, $aiConstraints);
|
|
$aiConstraints[USER_TABLE] = false;
|
|
$aiConstraints[QCM_TABLE] = array_keys($asResults);
|
|
$iClassGlobalAvg = getResultsAverage($iOutOf, $aiConstraints);
|
|
foreach($asResults as $iQcmId => $asQcmResultInfo)
|
|
{
|
|
$aiConstraints[QCM_TABLE] = $iQcmId;
|
|
$iClassAvg = getResultsAverage($iOutOf, $aiConstraints);
|
|
$asDisplay[$iQcmId] = '<tr><td>'.$asQcmResultInfo[QCM_TABLE].'</td><td>'.roundMark($iOutOf, $asQcmResultInfo[RESULT_TABLE]).' / '.$iOutOf.'</td><td>'.$iClassAvg.' / '.$iOutOf.'</td></tr>';
|
|
}
|
|
$sDisplayAverage = '<th colspan="2" class="bottom-left-rounded">Moyenne : '.$iUserGlobalAvg.' / '.$iOutOf.'</th><th class="bottom-right-rounded">Moyenne de la classe : '.$iClassGlobalAvg.' / '.$iOutOf.'</th>';
|
|
}
|
|
?>
|
|
<table class="maxWidth">
|
|
<tr>
|
|
<td colspan="3" class="rounded"><p class="tresimportant">Les notes de <?php echo $_SESSION['firstName']." ".$_SESSION['lastName']; ?></p></td>
|
|
</tr>
|
|
<tr><td colspan="3" class="blank"></td></tr>
|
|
<tr>
|
|
<th class="top-left-rounded">QCM</th>
|
|
<th><?php echo getOutOfForm($iOutOf, false, '?page=stats', 'Note de '.$_SESSION['firstName'].' '.$_SESSION['lastName'].' :'); ?></th>
|
|
<th class="top-right-rounded">Moyenne de la classe</th>
|
|
</tr>
|
|
<?php echo implode("\n", $asDisplay); ?>
|
|
<tr>
|
|
<?php echo $sDisplayAverage; ?>
|
|
</tr>
|
|
</table>
|