Fixed some things
This commit is contained in:
parent
25d5d6e346
commit
655cdba9ca
@ -79,7 +79,7 @@ class Score {
|
||||
}
|
||||
}
|
||||
|
||||
// Get a score by their testID and userID
|
||||
// Get a score by their scoreID
|
||||
public static function get($id){
|
||||
global $handle;
|
||||
|
||||
@ -124,6 +124,13 @@ class Score {
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Get all scores for user and test
|
||||
public static function getfromusertest($userID,$testID){
|
||||
if (!is_numeric($userID) || !is_numeric($testID))
|
||||
return null;
|
||||
return Score::_search("WHERE userID = $userID AND testID = $testID");
|
||||
}
|
||||
|
||||
// Get all scores
|
||||
public static function all(){
|
||||
return Score::_search("");
|
||||
|
@ -113,14 +113,14 @@ $level = ($level==NULL) ? "" : $level;
|
||||
style="width:128px;";
|
||||
text-align: center;
|
||||
}
|
||||
.resultTable{
|
||||
.resultTable, #testlist{
|
||||
border: 1px solid black;
|
||||
width: 100%;
|
||||
}
|
||||
.resultTable th:first-of-type{
|
||||
width: 92px;
|
||||
}
|
||||
.resultTable td,.resultTable th{
|
||||
.resultTable td,.resultTable th,#testlist td,#testlist th{
|
||||
padding: 3px 1em 3px 1em;
|
||||
border: 1px solid black;
|
||||
text-align: center;
|
||||
@ -145,8 +145,8 @@ $level = ($level==NULL) ? "" : $level;
|
||||
echo "\t\t\t\t\t<li><a href=\"{$level}report.php\">My Report</a></li>\n";
|
||||
else if ($current_user->isStaff()){
|
||||
echo "\t\t\t\t\t<li><a href=\"{$level}users.php\">Users</a></li>\n";
|
||||
echo "\t\t\t\t\t<li><a href=\"{$level}test\">Tests</a></li>\n";
|
||||
}
|
||||
echo "\t\t\t\t\t<li><a href=\"{$level}test\">Tests</a></li>\n";
|
||||
echo "\t\t\t\t\t<li><a href=\"{$level}profile.php?id={$current_user->id}\">Profile</a></li>\n";
|
||||
}
|
||||
?>
|
||||
|
10
index.php
10
index.php
@ -21,7 +21,15 @@ if ($current_user->isPupil()){
|
||||
$ass = $current_user->tests();
|
||||
|
||||
foreach ($ass as $a){
|
||||
echo "<tr><td>".$a->test()->title."</td><td class=\"take\"><a href=\"".burl("test/take.php?id=".$a->test()->id)."\">Take</a></td></tr>";
|
||||
$res = Score::getfromusertest($current_user->id,$a->testID);
|
||||
echo "<tr><td>".$a->test()->title."</td><td class=\"take\" style=\"width:120px;\">";
|
||||
|
||||
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>";
|
||||
}
|
||||
}else if ($current_user->isStaff()){
|
||||
?>
|
||||
|
@ -28,7 +28,7 @@ showHeader("Test Search");
|
||||
|
||||
echo "<h1>Tests</h1>\n";
|
||||
|
||||
if ($author != $current_user->id){
|
||||
if ($author != $current_user->id && $current_user->isStaff()){
|
||||
echo "<a class=\"button\" href=\"?user={$current_user->id}\">My Tests</a><br><br>\n";
|
||||
}
|
||||
|
||||
@ -40,7 +40,17 @@ foreach ($tests as $t){
|
||||
//TODO
|
||||
}
|
||||
|
||||
echo "<tr><td style=\"width: 60%;\">{$t->title}</td><td><a href=\"edit.php?id={$t->id}\" class=\"button\">Edit</a> <a href=\"view.php?id={$t->id}\" class=\"button\">View Submissions</a></td></tr>\n";
|
||||
echo "<tr><td style=\"width: 60%;\">{$t->title}</td><td>";
|
||||
if ($current_user->isStaff())
|
||||
echo "<a href=\"edit.php?id={$t->id}\" class=\"button\">Edit</a> ";
|
||||
else{
|
||||
$res = Score::getfromusertest($current_user->id,$t->id);
|
||||
if (!$res || count($res)==0)
|
||||
echo "<a href=\"take.php?id={$t->id}\" class=\"button\">Take</a> ";
|
||||
else
|
||||
echo "<a href=\"take.php?id={$t->id}\" class=\"button\">Retake</a> ";
|
||||
}
|
||||
echo "<a href=\"view.php?id={$t->id}\" class=\"button\">View Submissions</a></td></tr>\n";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
Loading…
x
Reference in New Issue
Block a user