Пример #1
0
function shownavbar($questions, $scores, $current, $showcat)
{
    global $imasroot, $isdiag, $testsettings, $attempts, $qi, $allowregen, $bestscores, $isreview, $showeachscore, $noindivscores, $CFG;
    $todo = 0;
    $earned = 0;
    $poss = 0;
    echo "<a href=\"#beginquestions\"><img class=skipnav src=\"{$imasroot}/img/blank.gif\" alt=\"", _('Skip Navigation'), "\" /></a>\n";
    echo "<div class=navbar>";
    echo "<h4>", _('Questions'), "</h4>\n";
    echo "<ul class=qlist>\n";
    for ($i = 0; $i < count($questions); $i++) {
        echo "<li>";
        if ($current == $i) {
            echo "<span class=current>";
        }
        if (unans($scores[$i]) || amreattempting($i)) {
            $todo++;
        }
        /*
        $icon = '';
        if ($attempts[$i]==0) {
        	$icon = "full";
        } else if (hasreattempts($i)) {
        	$icon = "half";
        } else {
        	$icon = "empty";
        }
        echo "<img src=\"$imasroot/img/aicon/left$icon.gif\"/>";
        $icon = '';
        if (unans($bestscores[$i]) || getpts($bestscores[$i])==0) {
        	$icon .= "empty";
        } else if (getpts($bestscores[$i]) == $qi[$questions[$i]]['points']) {
        	$icon .= "full";
        } else {
        	$icon .= "half";
        }
        if (!canimprovebest($i) && !$allowregen && $icon!='full') {
        	$icon .= "ci";
        }
        echo "<img src=\"$imasroot/img/aicon/right$icon.gif\"/>";
        */
        if ($isreview) {
            $thisscore = getpts($scores[$i]);
        } else {
            $thisscore = getpts($bestscores[$i]);
        }
        if (unans($scores[$i]) && $attempts[$i] == 0 || $noindivscores && amreattempting($i)) {
            if (isset($CFG['TE']['navicons'])) {
                echo "<img alt=\"untried\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['untried']}\"/> ";
            } else {
                echo "<img alt=\"untried\" src=\"{$imasroot}/img/q_fullbox.gif\"/> ";
            }
        } else {
            if (canimprove($i) && !$noindivscores) {
                if (isset($CFG['TE']['navicons'])) {
                    if ($thisscore == 0 || $noindivscores) {
                        echo "<img alt=\"incorrect - can retry\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['canretrywrong']}\"/> ";
                    } else {
                        echo "<img alt=\"partially correct - can retry\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['canretrypartial']}\"/> ";
                    }
                } else {
                    echo "<img alt=\"can retry\" src=\"{$imasroot}/img/q_halfbox.gif\"/> ";
                }
            } else {
                if (isset($CFG['TE']['navicons'])) {
                    if (!$showeachscore) {
                        echo "<img alt=\"cannot retry\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['noretry']}\"/> ";
                    } else {
                        if ($thisscore == $qi[$questions[$i]]['points']) {
                            echo "<img alt=\"correct\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['correct']}\"/> ";
                        } else {
                            if ($thisscore == 0) {
                                echo "<img alt=\"incorrect - cannot retry\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['wrong']}\"/> ";
                            } else {
                                echo "<img alt=\"partially correct - cannot retry\" src=\"{$imasroot}/img/{$CFG['TE']['navicons']['partial']}\"/> ";
                            }
                        }
                    }
                } else {
                    echo "<img alt=\"cannot retry\" src=\"{$imasroot}/img/q_emptybox.gif\"/> ";
                }
            }
        }
        if ($showcat > 1 && $qi[$questions[$i]]['category'] != '0') {
            if ($qi[$questions[$i]]['withdrawn'] == 1) {
                echo "<a href=\"showtest.php?action=skip&amp;to={$i}\"><span class=\"withdrawn\">" . ($i + 1) . ") {$qi[$questions[$i]]['category']}</span></a>";
            } else {
                echo "<a href=\"showtest.php?action=skip&amp;to={$i}\">" . ($i + 1) . ") {$qi[$questions[$i]]['category']}</a>";
            }
        } else {
            if ($qi[$questions[$i]]['withdrawn'] == 1) {
                echo "<a href=\"showtest.php?action=skip&amp;to={$i}\"><span class=\"withdrawn\">Q " . ($i + 1) . "</span></a>";
            } else {
                echo "<a href=\"showtest.php?action=skip&amp;to={$i}\">Q " . ($i + 1) . "</a>";
            }
        }
        if ($showeachscore) {
            if ($isreview && canimprove($i) || !$isreview && canimprovebest($i)) {
                echo ' (';
            } else {
                echo ' [';
            }
            if ($isreview) {
                $thisscore = getpts($scores[$i]);
            } else {
                $thisscore = getpts($bestscores[$i]);
            }
            if ($thisscore < 0) {
                echo '0';
            } else {
                echo $thisscore;
                $earned += $thisscore;
            }
            echo '/' . $qi[$questions[$i]]['points'];
            $poss += $qi[$questions[$i]]['points'];
            if ($isreview && canimprove($i) || !$isreview && canimprovebest($i)) {
                echo ')';
            } else {
                echo ']';
            }
        }
        if ($current == $i) {
            echo "</span>";
        }
        echo "</li>\n";
    }
    echo "</ul>";
    if ($showeachscore) {
        if ($isreview) {
            echo "<p>", _('Review: ');
        } else {
            echo "<p>", _('Grade: ');
        }
        echo "{$earned}/{$poss}</p>";
    }
    if (!$isdiag && $testsettings['noprint'] == 0) {
        echo "<p><a href=\"#\" onclick=\"window.open('{$imasroot}/assessment/printtest.php','printver','width=400,height=300,toolbar=1,menubar=1,scrollbars=1,resizable=1,status=1,top=20,left='+(screen.width-420));return false;\">", _('Print Version'), "</a></p> ";
    }
    echo "</div>\n";
    return $todo;
}
Пример #2
0
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\"/> ";
                }
            }
        }
    }
}