}
    $htmlout .= '</select></td></tr><tr><td>' . get_string('requiredgoal', 'mootyper') . '</td><td><input value="' . $goalPO . '" style="width: 20px;" type="text" name="requiredgoal"> % </td></tr>';
} else {
    if ($modePO == 1) {
        $htmlout .= '<option value="0">' . get_string('sflesson', 'mootyper') . '</option><option value="1" selected="true">' . get_string('isexamtext', 'mootyper') . '</option>';
        $htmlout .= '</select></td></tr><tr><td>';
        $htmlout .= get_string('flesson', 'mootyper') . '</td><td><select' . $disSelect . ' onchange="this.form.submit()" id="lesson" name="lesson">';
        for ($ij = 0; $ij < count($lessons); $ij++) {
            if ($lessons[$ij]['id'] == $lessonPO) {
                $htmlout .= '<option selected="true" value="' . $lessons[$ij]['id'] . '">' . $lessons[$ij]['lessonname'] . '</option>';
            } else {
                $htmlout .= '<option value="' . $lessons[$ij]['id'] . '">' . $lessons[$ij]['lessonname'] . '</option>';
            }
        }
        $htmlout .= '</select></td></tr>';
        $exercises = get_exercises_by_lesson($lessonPO);
        $htmlout .= '<tr><td>' . get_string('fexercise', 'mootyper') . '</td><td><select' . $disSelect . ' name="exercise" id="exercise">';
        for ($ik = 0; $ik < count($exercises); $ik++) {
            if ($exercises[$ik]['id'] == $exercisePO) {
                $htmlout .= '<option selected="true" value="' . $exercises[$ik]['id'] . '">' . $exercises[$ik]['exercisename'] . '</option>';
            } else {
                $htmlout .= '<option value="' . $exercises[$ik]['id'] . '">' . $exercises[$ik]['exercisename'] . '</option>';
            }
        }
        $htmlout .= '</select></td></tr>';
    }
}
$htmlout .= '<tr><td>' . get_string('showkeyboard', 'mootyper') . '</td><td>';
$show_keyboard_checked = $showKeyboardPO == 'on' ? ' checked="checked"' : '';
$htmlout .= '<input type="checkbox"' . $show_keyboard_checked . ' onchange="this.form.submit()" name="showkeyboard">';
$layouts = get_keyboard_layouts_db();
     $htmlout .= '<tr><td>' . get_string('student', 'mootyper') . '</td><td>';
     $htmlout .= '<select name="juser" onchange="this.form.submit()">';
     $htmlout .= '<option value="0">' . get_string('allstring', 'mootyper') . '</option>';
     if ($usrs != FALSE) {
         foreach ($usrs as $x) {
             if ($us == $x->id) {
                 $htmlout .= '<option value="' . $x->id . '" selected="true">' . $x->firstname . ' ' . $x->lastname . '</option>';
             } else {
                 $htmlout .= '<option value="' . $x->id . '">' . $x->firstname . ' ' . $x->lastname . '</option>';
             }
         }
     }
     $htmlout .= '</select>';
     $htmlout .= '</td></tr>';
 } else {
     $exes = get_exercises_by_lesson($mootyper->lesson);
     $htmlout .= '<tr><td>' . get_string('fexercise', 'mootyper') . '</td><td>';
     $htmlout .= '<select name="exercise" onchange="this.form.submit()">';
     $htmlout .= '<option value="0">' . get_string('allstring', 'mootyper') . '</option>';
     foreach ($exes as $x) {
         if ($se == $x['id']) {
             $htmlout .= '<option value="' . $x['id'] . '" selected="true">' . $x['exercisename'] . '</option>';
         } else {
             $htmlout .= '<option value="' . $x['id'] . '">' . $x['exercisename'] . '</option>';
         }
     }
     $htmlout .= '</select>';
     $htmlout .= '</td></tr>';
 }
 if ($des == -1) {
     $des = 0;
function get_new_snumber($lsn_id)
{
    $exes = get_exercises_by_lesson($lsn_id);
    if (count($exes) == 0) {
        return 1;
    }
    $max = $exes[0]['snumber'];
    for ($i = 0; $i < count($exes); $i++) {
        if ($exes[$i]['snumber'] > $max) {
            $max = $exes[$i]['snumber'];
        }
    }
    return $max + 1;
}