2014-03-04 13:08:11 +00:00
|
|
|
<?php
|
|
|
|
require "common/common.php";
|
|
|
|
|
2014-04-09 15:56:22 +00:00
|
|
|
// Require log in
|
2014-03-04 13:08:11 +00:00
|
|
|
auth(AUTH_PUPIL);
|
|
|
|
|
2014-04-09 15:56:22 +00:00
|
|
|
// Display page
|
2014-03-04 13:08:11 +00:00
|
|
|
showHeader("Dashboard");
|
2014-03-08 15:08:56 +00:00
|
|
|
|
2014-04-09 15:56:22 +00:00
|
|
|
|
|
|
|
// Display 404 - page not found message if necessary
|
2014-03-08 15:08:56 +00:00
|
|
|
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 15:56:22 +00:00
|
|
|
|
|
|
|
// Show the dashboard
|
2014-03-04 13:08:11 +00:00
|
|
|
?>
|
|
|
|
<h2>Dashboard</h2>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
if ($current_user->isPupil()){
|
2014-04-09 15:56:22 +00:00
|
|
|
// Show pupil dash board
|
2014-03-04 13:08:11 +00:00
|
|
|
echo "<table id=\"testlist\">";
|
|
|
|
|
2014-04-09 15:56:22 +00:00
|
|
|
// Get all assignments this pupil has
|
|
|
|
$ass = $current_user->tests();
|
2014-03-04 13:08:11 +00:00
|
|
|
foreach ($ass as $a){
|
2014-04-09 15:56:22 +00:00
|
|
|
// Look for submitted results from this pupil, for the test.
|
|
|
|
// ie: see if the pupil has done this test yet
|
2014-03-08 15:37:25 +00: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 15:56:22 +00:00
|
|
|
// Show correct button - retake or take.
|
2014-03-08 15:37:25 +00: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 13:08:11 +00:00
|
|
|
}
|
|
|
|
}else if ($current_user->isStaff()){
|
2014-04-09 15:56:22 +00:00
|
|
|
// Show staff dash board
|
2014-03-04 13:08:11 +00:00
|
|
|
?>
|
|
|
|
<div class="dashbox">
|
|
|
|
<div class="dashbox_title">
|
|
|
|
Staff Panel
|
|
|
|
</div>
|
|
|
|
<div class="dashbox_content">
|
|
|
|
<ul>
|
2014-03-08 15:08:56 +00:00
|
|
|
<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 13:08:11 +00:00
|
|
|
<?php
|
2014-04-09 15:56:22 +00:00
|
|
|
if ($current_user->isAdmin())
|
|
|
|
echo "\t\t\t<li><a href=\"".burl("admin.php")."\">Admin Tools</a></li>";
|
2014-03-04 13:08:11 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
</table>
|