phptest-users
[Top][All Lists]
Advanced

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

RE: [Phptest-users] Random answers solution!


From: Luis Lebron
Subject: RE: [Phptest-users] Random answers solution!
Date: Wed, 19 Feb 2003 10:43:03 -0600

I found a different solution. In qtypes/cmultiplechoice.inc.php, in the draw_test_question function I changed the line that read

$rand = mt_rand(1, 4); //right before the switch statement

to:
                               
if(strcasecmp($row->answer,"All of the above")==1)
        {                      
                $rand=3;
        }
if(strcasecmp($row->alt_1,"All of the above")==1)
        {                      
                $rand=4;
        }
if(strcasecmp($row->alt_2,"All of the above")==1)
        {                      
                $rand=1;
        }
if(strcasecmp($row->alt_3,"All of the above")==1)
        {                      
                $rand=2;
        }
if(strcasecmp($row->alt_3,"All of the above")!=1 && strcasecmp($row->alt_2,"All of the above")!=1 && strcasecmp($row->alt_1,"All of the above")!=1 && strcasecmp($row->answer,"All of the above")!=1)

        {
                $rand = mt_rand(1, 4);
        }


This will force a switch type if one of the choices is "All of the above" otherwise it will use the normal random function.


Luis

-----Original Message-----
From: TW [mailto:address@hidden]
Sent: Tuesday, February 18, 2003 8:23 PM
To: general phptest discussion
Subject: Re: [Phptest-users] Random answers


What I have done is make a new question type. It is a single entry answer
question so basically in the question you ask the user to pick either a, b,
c, and so on and the user enters the correct letter into the answer box. If
you want this you can download it from here:
http://www.technowizards.net/phptest/csingleanswer.zip

This file is meant to be used with the mods_1.zip file, you may need to
modify the csingleanswer file if you are not using it.

Cheers,

TW



----- Original Message -----
From: "Luis Lebron" <address@hidden>
To: "Phptest-Users (E-mail)" <address@hidden>
Sent: Tuesday, February 18, 2003 12:39 PM
Subject: [Phptest-users] Random answers


>
> Is there a way to disable the random order of answers. We have a customer
> that likes to use "All of the above" as one of their choices. This does
not
> work with PHPtest since the answers can be in any order.
>
>
> thanks,
>
>
>
> Luis R. Lebron
> Project Manager
> Sigmatech, Inc
>


----------------------------------------------------------------------------
----


> _______________________________________________
> Phptest-users mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/phptest-users
>


_______________________________________________
Phptest-users mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/phptest-users


reply via email to

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