function showPrePostTest(&$crpt, $lPPTestID, &$pptest, $lNumQuests)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $bPublished = $pptest->bPublished;
    if ($bPublished) {
        $strLinkEdit = '';
        $strLinkAddQues = '';
    } else {
        $strLinkEdit = strLinkEdit_CPPTest($lPPTestID, 'Edit pre/post test', true) . ' ' . strLinkEdit_CPPTest($lPPTestID, 'Edit pre/post test', false) . '          ' . strLinkRem_CPPTest($lPPTestID, 'Remove pre/post test', true, true);
        $strLinkAddQues = '     ' . strLinkAdd_CPPQuestion($lPPTestID, 'Add question', true) . ' ' . strLinkAdd_CPPQuestion($lPPTestID, 'Add question', false);
    }
    if ($lNumQuests > 0) {
        $strLinkViewQuest = strLinkView_CPPQuestions($lPPTestID, 'View questions associated with this test', true);
    } else {
        $strLinkViewQuest = '';
    }
    openBlock('Client Pre/Post Test', $strLinkEdit);
    echoT($crpt->openReport() . $crpt->openRow() . $crpt->writeLabel('Pre/Post Test ID:') . $crpt->writeCell(str_pad($lPPTestID, 5, '0', STR_PAD_LEFT)) . $crpt->closeRow() . $crpt->openRow() . $crpt->writeLabel('Category:') . $crpt->writeCell(htmlspecialchars($pptest->strPPTestCat)) . $crpt->closeRow() . $crpt->openRow() . $crpt->writeLabel('Test Name:') . $crpt->writeCell(htmlspecialchars($pptest->strTestName)) . $crpt->closeRow());
    //------------------
    // description
    //------------------
    echoT($crpt->openRow() . $crpt->writeLabel('Description:') . $crpt->writeCell(nl2br(htmlspecialchars($pptest->strDescription))) . $crpt->closeRow());
    //------------------
    // # of Questions
    //------------------
    echoT($crpt->openRow() . $crpt->writeLabel('# of Questions:') . $crpt->writeCell($lNumQuests . $strLinkViewQuest . $strLinkAddQues) . $crpt->closeRow());
    //------------------
    // Visibility
    //------------------
    echoT($crpt->openRow() . $crpt->writeLabel('Visibility:') . $crpt->writeCell(($pptest->bHidden ? 'Hidden' : 'Visible') . ' ' . strSpecial_CPPHideShow($lPPTestID, !$pptest->bHidden, true)) . $crpt->closeRow());
    //------------------
    // Published?
    //------------------
    echoT($crpt->openRow() . $crpt->writeLabel('Published?:') . $crpt->writeCell($pptest->bPublished ? 'Yes' : 'No') . $crpt->closeRow());
    echoT($crpt->closeReport());
    closeBlock();
}
<?php

echoT($strTestSummary . '<br>');
$cUpDown = new up_down_top_bottom();
$cUpDown->lMax = $lNumQuestions;
$bPublished = $pptest->bPublished;
$lPPTestID = $pptest->lKeyID;
if (!$bPublished) {
    echoT(strLinkAdd_CPPQuestion($lPPTestID, 'Add question', true) . '&nbsp;' . strLinkAdd_CPPQuestion($lPPTestID, 'Add question', false) . '<br><br>');
}
if ($lNumQuestions == 0) {
    echoT('<br><i>There are no questions defined for this pre/post test.</i></br><br>');
    return;
}
$strLinkBase = '<a href="' . base_url() . "index.php/cpre_post_tests/ppquest_add_edit/moveQuest/{$lPPTestID}/";
openQuestionTable();
$idx = 0;
foreach ($quests as $quest) {
    writeQuestionRow($quest, $bPublished, $lPPTestID, $cUpDown, $strLinkBase, $idx);
    ++$idx;
}
closeQuestionTable();
function writeQuestionRow(&$quest, $bPublished, $lPPTestID, &$cUpDown, $strLinkBase, $idx)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $lQuestID = $quest->lKeyID;
    if ($bPublished) {
        $strLinkEdit = '';
        $strLinkRemove = '';