コード例 #1
0
ファイル: showtest.php プロジェクト: ericvanboven/IMathAS
                     //$colors = scorestocolors($rawscores[$next], '', $qi[$questions[$next]]['answeights'], $noraw);
                     if (strpos($rawscores[$next], '~') !== false) {
                         $colors = explode('~', $rawscores[$next]);
                     } else {
                         $colors = array($rawscores[$next]);
                     }
                 } else {
                     $colors = array();
                 }
                 $qshowans = $showansafterlast && $qi[$questions[$next]]['showans'] == '0' || $qi[$questions[$next]]['showans'] == 'F' || $qi[$questions[$next]]['showans'] == 'J' || $showansduring && $qi[$questions[$next]]['showans'] == '0' && $attempts[$next] >= $testsettings['showans'];
                 if ($qshowans) {
                     displayq($next, $qi[$questions[$next]]['questionsetid'], $seeds[$next], 2, false, $attempts[$next], false, false, false, $colors);
                 } else {
                     displayq($next, $qi[$questions[$next]]['questionsetid'], $seeds[$next], false, false, $attempts[$next], false, false, false, $colors);
                 }
                 $contactlinks = showquestioncontactlinks($next);
                 if ($contactlinks != '') {
                     echo '<div class="review">' . $contactlinks . '</div>';
                 }
             }
             echo "</div>\n";
         }
     }
 }
 if (isset($_GET['done'])) {
     //are all done
     $shown = showscores($questions, $attempts, $testsettings);
     endtest($testsettings);
     if ($shown) {
         leavetestmsg();
     }
コード例 #2
0
ファイル: testutil.php プロジェクト: ericvanboven/IMathAS
function seqshowqinfobar($qn, $toshow)
{
    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 ($qi[$questions[$qn]]['withdrawn'] == 1) {
        $qlinktxt = "<span class=\"withdrawn\">" . _('Question') . ' ' . ($qn + 1) . "</span>";
    } else {
        $qlinktxt = _('Question') . ' ' . ($qn + 1);
    }
    if ($qn == $toshow) {
        echo '<div class="seqqinfocur">';
        if (unans($scores[$qn]) && $attempts[$qn] == 0 || $noindivscores && amreattempting($qn)) {
            if (isset($CFG['TE']['navicons'])) {
                echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['untried']}\"/> ";
            } else {
                echo "<img src=\"{$imasroot}/img/q_fullbox.gif\"/> ";
            }
        } else {
            if (isset($CFG['TE']['navicons'])) {
                if ($thisscore == 0 || $noindivscores) {
                    echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['canretrywrong']}\"/> ";
                } else {
                    echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['canretrypartial']}\"/> ";
                }
            } else {
                echo "<img src=\"{$imasroot}/img/q_halfbox.gif\"/> ";
            }
        }
        echo "<span class=current><a name=\"curq\">{$qlinktxt}</a></span>  ";
    } else {
        $thisscore = getpts($bestscores[$qn]);
        if (unans($scores[$qn]) && $attempts[$qn] == 0 || $noindivscores && amreattempting($qn)) {
            echo '<div class="seqqinfoavail">';
            if (isset($CFG['TE']['navicons'])) {
                echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['untried']}\"/> ";
            } else {
                echo "<img src=\"{$imasroot}/img/q_fullbox.gif\"/> ";
            }
            echo "<a href=\"showtest.php?action=seq&to={$qn}#curq\" onclick=\"return confirm('", _('Are you sure you want to jump to this question, discarding any work you have not submitted?'), "');\">{$qlinktxt}</a>.  ";
            $qavail = true;
        } else {
            if (canimprove($qn) && !$noindivscores) {
                echo '<div class="seqqinfoavail">';
                if (isset($CFG['TE']['navicons'])) {
                    if ($thisscore == 0 || $noindivscores) {
                        echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['canretrywrong']}\"/> ";
                    } else {
                        echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['canretrypartial']}\"/> ";
                    }
                } else {
                    echo "<img src=\"{$imasroot}/img/q_halfbox.gif\"/> ";
                }
                echo "<a href=\"showtest.php?action=seq&to={$qn}#curq\" onclick=\"return confirm('", _('Are you sure you want to jump to this question, discarding any work you have not submitted?'), "');\">{$qlinktxt}</a>.  ";
                $qavail = true;
            } else {
                if ($reattemptsremain) {
                    echo '<div class="seqqinfoinactive">';
                    if (isset($CFG['TE']['navicons'])) {
                        if (!$showeachscore) {
                            echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['noretry']}\"/> ";
                        } else {
                            if ($thisscore == $qi[$questions[$qn]]['points']) {
                                echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['correct']}\"/> ";
                            } else {
                                if ($thisscore == 0) {
                                    echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['wrong']}\"/> ";
                                } else {
                                    echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['partial']}\"/> ";
                                }
                            }
                        }
                    } else {
                        echo "<img src=\"{$imasroot}/img/q_emptybox.gif\"/> ";
                    }
                    echo "<a href=\"showtest.php?action=seq&to={$qn}#curq\" onclick=\"return confirm('", _('Are you sure you want to jump to this question, discarding any work you have not submitted?'), "');\">{$qlinktxt}</a>.  ";
                } else {
                    echo '<div class="seqqinfoinactive">';
                    if (isset($CFG['TE']['navicons'])) {
                        if (!$showeachscore) {
                            echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['noretry']}\"/> ";
                        } else {
                            if ($thisscore == $qi[$questions[$qn]]['points']) {
                                echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['correct']}\"/> ";
                            } else {
                                if ($thisscore == 0) {
                                    echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['wrong']}\"/> ";
                                } else {
                                    echo "<img src=\"{$imasroot}/img/{$CFG['TE']['navicons']['partial']}\"/> ";
                                }
                            }
                        }
                    } else {
                        echo "<img src=\"{$imasroot}/img/q_emptybox.gif\"/> ";
                    }
                    echo "{$qlinktxt}.  ";
                }
            }
        }
    }
    if ($qi[$questions[$qn]]['withdrawn'] == 1) {
        echo "<span class=\"red\">", _('Question Withdrawn'), "</span> ";
    }
    if ($showeachscore) {
        $pts = getpts($bestscores[$qn]);
        if ($pts < 0) {
            $pts = 0;
        }
        echo sprintf(_('Points: %1$d out of %2$d possible.'), $pts, $qi[$questions[$qn]]['points']), "  ";
        if ($qn == $toshow) {
            printf(_('%d available on this attempt.'), $pointsremaining);
        }
    } else {
        if ($pointsremaining == $qi[$questions[$qn]]['points']) {
            echo _('Points possible:'), " ", $qi[$questions[$qn]]['points'];
        } else {
            printf(_('Points available on this attempt: %1$d of original %2$d'), $pointsremaining, $qi[$questions[$qn]]['points']);
        }
    }
    if ($qn == $toshow && $attempts[$qn] < $qi[$questions[$qn]]['attempts']) {
        if ($qi[$questions[$qn]]['attempts'] == 0) {
            echo ".  ", _('Unlimited attempts');
        } else {
            echo '.  ', sprintf(_('This is attempt %1$d of %2$d.'), $attempts[$qn] + 1, $qi[$questions[$qn]]['attempts']);
        }
    }
    if ($testsettings['showcat'] > 0 && $qi[$questions[$qn]]['category'] != '0') {
        echo "  ", _('Category:'), " {$qi[$questions[$qn]]['category']}.";
    }
    $contactlinks = showquestioncontactlinks($qn);
    if ($contactlinks != '') {
        echo '<br/>' . $contactlinks;
    }
    echo '</div>';
    return $qavail;
}