コード例 #1
0
ファイル: showtest.php プロジェクト: ericvanboven/IMathAS
         showembedupdatescript();
     }
 }
 for ($i = $qmin; $i < $qmax; $i++) {
     if ($qi[$questions[$i]]['points'] == 0 || $qi[$questions[$i]]['withdrawn'] == 1) {
         $intro = str_replace('[QUESTION ' . ($i + 1) . ']', '', $intro);
         continue;
     }
     $quesout = '<div id="embedqwrapper' . $i . '" class="embedqwrapper"';
     if ($dovidcontrol) {
         $quesout .= ' style="position: absolute; width:100%; visibility:hidden; top:0px;left:-1000px;" ';
     }
     $quesout .= '>';
     ob_start();
     embedshowicon($i);
     if (hasreattempts($i)) {
         basicshowq($i, false);
         $quesout .= ob_get_clean();
         $quesout = substr($quesout, 0, -7) . '<br/><input type="button" class="btn" value="' . _('Submit') . '" onclick="assessbackgsubmit(' . $i . ',\'submitnotice' . $i . '\')" /><span id="submitnotice' . $i . '"></span></div>';
     } else {
         if (!$sessiondata['istutorial']) {
             echo '<div class="prequestion">';
             echo "<p>", _('No attempts remain on this problem.'), "</p>";
             if ($allowregen && $qi[$questions[$i]]['allowregen'] == 1) {
                 echo "<p><a href=\"showtest.php?regen={$i}\">", _('Try another similar question'), "</a></p>\n";
             }
             if ($showeachscore) {
                 //TODO i18n
                 $msg = "<p>This question, with your last answer";
                 if ($showansafterlast && $qi[$questions[$i]]['showans'] == '0' || $qi[$questions[$i]]['showans'] == 'F' || $qi[$questions[$i]]['showans'] == 'J') {
                     $msg .= " and correct answer";
コード例 #2
0
ファイル: testutil.php プロジェクト: ericvanboven/IMathAS
function embedshowicon($qn)
{
    global $qi, $questions, $attempts, $testsettings, $scores, $bestscores, $noindivscores, $showeachscore, $imasroot, $CFG, $sessiondata, $seeds, $isreview;
    $reattemptsremain = hasreattempts($qn);
    $pointsremaining = getremainingpossible($qn, $qi[$questions[$qn]], $testsettings, $attempts[$qn]);
    $qavail = false;
    if ($isreview) {
        $thisscore = getpts($scores[$qn]);
    } else {
        $thisscore = getpts($bestscores[$qn]);
    }
    if (unans($scores[$qn]) && $attempts[$qn] == 0 || $noindivscores && amreattempting($qn)) {
        if (isset($CFG['TE']['navicons'])) {
            echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['untried']}\"/> ";
        } else {
            echo "<img class=\"embedicon\" src=\"{$imasroot}/img/q_fullbox.gif\"/> ";
        }
    } else {
        if (canimprove($qn) && !$noindivscores) {
            if (isset($CFG['TE']['navicons'])) {
                if ($thisscore == 0 || $noindivscores) {
                    echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['canretrywrong']}\"/> ";
                } else {
                    echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['canretrypartial']}\"/> ";
                }
            } else {
                echo "<img class=\"embedicon\" src=\"{$imasroot}/img/q_halfbox.gif\"/> ";
            }
        } else {
            if ($reattemptsremain) {
                if (isset($CFG['TE']['navicons'])) {
                    if (!$showeachscore) {
                        echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['noretry']}\"/> ";
                    } else {
                        if ($thisscore == $qi[$questions[$qn]]['points']) {
                            echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['correct']}\"/> ";
                        } else {
                            if ($thisscore == 0) {
                                echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['wrong']}\"/> ";
                            } else {
                                echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['partial']}\"/> ";
                            }
                        }
                    }
                } else {
                    echo "<img class=\"embedicon\" src=\"{$imasroot}/img/q_emptybox.gif\"/> ";
                }
            } else {
                if (isset($CFG['TE']['navicons'])) {
                    if (!$showeachscore) {
                        echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['noretry']}\"/> ";
                    } else {
                        if ($thisscore == $qi[$questions[$qn]]['points']) {
                            echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['correct']}\"/> ";
                        } else {
                            if ($thisscore == 0) {
                                echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['wrong']}\"/> ";
                            } else {
                                echo "<img class=\"embedicon\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['partial']}\"/> ";
                            }
                        }
                    }
                } else {
                    echo "<img class=\"embedicon\" src=\"{$imasroot}/img/q_emptybox.gif\"/> ";
                }
            }
        }
    }
}