phptest-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phptest-users] disabling view correct answers for user


From: John Lacey
Subject: [Phptest-users] disabling view correct answers for user
Date: Wed, 21 Aug 2002 06:58:00 -0600

Hi Alan,

I need to be able to do this as well.  You can easily change
that -- I assume you're currently running phpTest version
0.6.1.   Here's what I did and tested:

1. make a backup copy of view_results.php (in case I screw
up)
2. make two code changes -- both involve just moving a
single line of code.
3. about halfway down the view_results.php file in the block
of code beginning with the comment "// draw table"
4. move this line:
$table->th($strings['RESULTS_VIEW_ANSWERS']);

    down to the block of code right underneath it so that it
the $user->admin block now looks like:

if ($user->admin) {
$table->th($strings['RESULTS_VIEW_ANSWERS_XML']);
$table->th($strings['RESULTS_DELETE']);
$table->th($strings['RESULTS_VIEW_ANSWERS']);
}

5. you can put it at the beginning instead of the end, it
will just appear before the others on the view results menu
for the administrator

6. go down to this block of code beginning with the
following line:
while (@extract($db->fetch_array($result), EXTR_PREFIX_ALL,
'db')) {

7. move this line:

$table->td(make_href("view_answers.php?r_id=$db_r_id",
$strings['RESULTS_VIEW']));

    down to the block of code right underneath it so that it
the $user->admin block now looks like:

// give admins option to delete test results and view xml
results.
if ($user->admin) {
$table->td(make_href("xml_answers.php?r_id=$db_r_id",
$strings['RESULTS_VIEW']));
$table->td(make_href("$PHP_SELF?op=delete&r_id=$db_r_id"
, $strings['RESULTS_DELETE']));
$table->td(make_href("view_answers.php?r_id=$db_r_id",
$strings['RESULTS_VIEW']));
}

now, the user can't view the results, only their score, but
the administrator can view

hope this is what you had in mind,

John








reply via email to

[Prev in Thread] Current Thread [Next in Thread]