college-cwk-spelling-test/index.php

68 lines
1.6 KiB
PHP
Raw Normal View History

2014-03-04 05:08:11 -08:00
<?php
require "common/common.php";
2014-04-09 08:56:22 -07:00
// Require log in
2014-03-04 05:08:11 -08:00
auth(AUTH_PUPIL);
2014-04-09 08:56:22 -07:00
// Display page
2014-03-04 05:08:11 -08:00
showHeader("Dashboard");
2014-04-09 08:56:22 -07:00
// Display 404 - page not found message if necessary
if ($_GET['404']==1){
?>
<div style="background:red;color:white;padding:1em;margin:0.5em;margin-bottom:1em;border-radius:2px;">
That's a 404; We could not find that page :/
</div>
<?php
}
2014-04-09 08:56:22 -07:00
// Show the dashboard
2014-03-04 05:08:11 -08:00
?>
<h2>Dashboard</h2>
<?php
if ($current_user->isPupil()){
2014-04-09 08:56:22 -07:00
// Show pupil dash board
2014-03-04 05:08:11 -08:00
echo "<table id=\"testlist\">";
2014-04-09 08:56:22 -07:00
// Get all assignments this pupil has
$ass = $current_user->tests();
2014-03-04 05:08:11 -08:00
foreach ($ass as $a){
2014-04-09 08:56:22 -07:00
// Look for submitted results from this pupil, for the test.
// ie: see if the pupil has done this test yet
2014-03-08 07:37:25 -08:00
$res = Score::getfromusertest($current_user->id,$a->testID);
echo "<tr><td>".$a->test()->title."</td><td class=\"take\" style=\"width:120px;\">";
2014-04-09 08:56:22 -07:00
// Show correct button - retake or take.
2014-03-08 07:37:25 -08:00
if (!$res || count($res)==0)
echo "<a class=\"button\" href=\"".burl("test/take.php?id=".$a->test()->id)."\">Take</a>";
else
echo "<a class=\"button\" href=\"".burl("test/take.php?id=".$a->test()->id)."\">Retake</a>";
echo "</td></tr>";
2014-03-04 05:08:11 -08:00
}
}else if ($current_user->isStaff()){
2014-04-09 08:56:22 -07:00
// Show staff dash board
2014-03-04 05:08:11 -08:00
?>
<div class="dashbox">
<div class="dashbox_title">
Staff Panel
</div>
<div class="dashbox_content">
<ul>
<li><a href="<?php echo burl("users.php?rank=1");?>">Pupils</a></li>
<li><a href="<?php echo burl("test/?user=".$current_user->id);?>">My Tests</a></li>
2014-03-04 05:08:11 -08:00
<?php
2014-04-09 08:56:22 -07:00
if ($current_user->isAdmin())
echo "\t\t\t<li><a href=\"".burl("admin.php")."\">Admin Tools</a></li>";
2014-03-04 05:08:11 -08:00
?>
</ul>
</div>
</div>
<?php
}
?>
</table>