File:  [LON-CAPA] / loncom / homework / templates / randomvalueradio.problem
Revision 1.1: download - view: text, annotated - select for diffs
Thu Sep 2 15:32:30 2010 UTC (13 years, 8 months ago) by www
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, HEAD, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
After being asked often enough: randomizing the question stem for a radio
button response.

    1: <problem>
    2: 
    3: <parameter name="maxtries" id="11" type="int_pos" default="2" description="Maximum Number of Tries" />
    4: <script type="loncapa/perl">$idx=&random(0,3,1);
    5: $city=('Berlin','New York','Sao Paulo','Canberra')[$idx];
    6: $southern=('false','false','true','true')[$idx];
    7: $northern=('true','true','false','false')[$idx];
    8: $europe=('true','false','false','false')[$idx];
    9: $australia=('false','false','false','true')[$idx];
   10: if ($idx==2) { $anothercontinent='Asia'; } else { $anothercontinent='South America'; }</script>
   11: 
   12: <startouttext />
   13: Which one of the following statements is true for $city?
   14: <endouttext />
   15: 
   16: <radiobuttonresponse direction="vertical" max="3" id="12" randomize="yes">
   17:     <foilgroup>
   18:         <foil location="random" value="$europe" name="foil1">
   19:             <startouttext />In Europe<endouttext />
   20:         </foil>
   21:         <foil location="random" value="$australia" name="foil2">
   22:             <startouttext />In Australia<endouttext />
   23:         </foil>
   24:         <foil location="random" value="false" name="foil3">
   25:             <startouttext />In $anothercontinent<endouttext />
   26:         </foil>
   27:         <foil location="random" value="$southern" name="foil4">
   28:             <startouttext />In the Southern Hemisphere<endouttext />
   29:         </foil>
   30:         <foil location="random" value="$northern" name="foil5">
   31:             <startouttext />In the Northern Hemisphere<endouttext />
   32:         </foil>
   33:         <foil location="bottom" value="true" name="foil6">
   34:             <startouttext />None of the above<endouttext />
   35:         </foil>
   36:     </foilgroup>
   37: </radiobuttonresponse>
   38: </problem>
   39: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>