]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7861, fixing various xhtml strict issues and formatting
authortoyomoyo <toyomoyo>
Wed, 3 Jan 2007 07:29:51 +0000 (07:29 +0000)
committertoyomoyo <toyomoyo>
Wed, 3 Jan 2007 07:29:51 +0000 (07:29 +0000)
mod/lesson/action/addpage.php
mod/lesson/action/editpage.php
mod/lesson/view.php

index 5fd2891f30c685c46f41a080175dfc9d1425f030..3f7ba74e2542206204b079aa818a8f40584053a7 100644 (file)
                     echo "</td></tr>\n";
                 }
                 if ($i == 2) {
-                    echo "<tr><td><B>".get_string("correctanswerjump", "lesson").":</b> \n";
+                    echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
                     choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
                     helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
                     if($lesson->custom) {
                     }
                     echo "</td></tr>\n";
                 } elseif ($i == 3) {
-                    echo "<tr><td><B>".get_string("wronganswerjump", "lesson").":</b> \n";
+                    echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
                     choose_from_menu($jump, "jumpto[$i]", 0, "");
                     helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
                     if($lesson->custom) {
index df96527d539d27e1071d3e20b247d4bdddd6de20..10efe0ef555401296e05c8722e87fd7a2e216e21 100644 (file)
                             print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
                         }
                     }
-                    echo "</td></tr>\n";
+                    echo "wtf</td></tr>\n";
                     break;
                 case LESSON_TRUEFALSE:
                 case LESSON_MULTICHOICE:
                         helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
                         if($lesson->custom)
                             echo get_string("correctanswerscore", "lesson").": <input type=\"text\" name=\"score[$n]\" value=\"$answer->score\" size=\"5\" />";
-                        }
+                        echo "</td></tr>\n";
+                    }
                     if ($n == 3) {
                         echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
                         choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
                         helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
                         if($lesson->custom)
                             echo get_string("wronganswerscore", "lesson").": <input type=\"text\" name=\"score[$n]\" value=\"$answer->score\" size=\"5\" />";
-                        }
-                    echo "</td></tr>\n";
+                        echo "</td></tr>\n";
+                    }
+                    //echo "</td></tr>\n";
                     break;
                 case LESSON_ESSAY :
                     echo "<tr><td><b>".get_string("jump", "lesson").":</b> \n";
                         echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
                         choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
                         helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
-                        if($lesson->custom)
+                        if ($lesson->custom) {
                             echo get_string("correctanswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"$answer->score\" size=\"5\" />";
                         }
+                        echo "</td></tr>\n";
+                    }
                     if ($i == 3) {
                         echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
                         choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
                         helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
-                        if($lesson->custom)
+                        if ($lesson->custom) {
                             echo get_string("wronganswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"$answer->score\" size=\"5\" />";
                         }
+                        echo "</td></tr>\n";
+                    }
 
-                    echo "</td></tr>\n";
                     break;
                 case LESSON_TRUEFALSE:
                 case LESSON_MULTICHOICE:
index a566029270df67018714122360b67ca0837ba43c..fe94dc6cabb7ce64d1f6701b1d1534e0dbd9e34d 100644 (file)
             }
         }
     }
-    
     if ($pageid != LESSON_EOL) {
         /// This is the code updates the lessontime for a timed test
         if ($startlastseen = optional_param('startlastseen', '', PARAM_ALPHA)) {  /// this deletes old records  not totally sure if this is necessary anymore
             $options = new stdClass;
             $options->para = false; // no <p></p>
             $options->noclean = true;
+            // echo "qtype is $page->qtype"; // debug
             switch ($page->qtype) {
                 case LESSON_SHORTANSWER :
                 case LESSON_NUMERICAL :
                     }       
                     echo '<tr><td align="center"><label for="answer">'.get_string('youranswer', 'lesson').'</label>'.
                         ": <input type=\"text\" id=\"answer\" name=\"answer\" size=\"50\" maxlength=\"200\" $value />\n";
-                    echo '</table>';
+                    echo '</td></tr></table>';
                     print_simple_box_end();
                     lesson_print_submit_link(get_string('pleaseenteryouranswerinthebox', 'lesson'), 'answerform');
                     break;
                             $responses[] = trim($answer->response);
                         }
                     }
-                    shuffle($responses);
-                    $responses = array_unique($responses);
                     
                     $responseoptions = array();
-                    foreach ($responses as $response) {
-                        $responseoptions[htmlspecialchars(trim($response))] = $response;
+                    if (!empty($responses)) {
+                        shuffle($responses);
+                        $responses = array_unique($responses);                     
+                        foreach ($responses as $response) {
+                            $responseoptions[htmlspecialchars(trim($response))] = $response;
+                        }
                     }
-                    
                     if (isset($USER->modattempts[$lesson->id])) {
                         $useranswers = explode(',', $attempt->useranswer);
                         $t = 0;
                             } 
                         }
                     }
-                    echo '</table></table>';
+                    echo '</table></td></tr></table>';
                     print_simple_box_end();
                     lesson_print_submit_link(get_string('pleasematchtheabovepairs', 'lesson'), 'answerform');
                     break;
-                case LESSON_BRANCHTABLE :
-                    echo '</form>';
+                case LESSON_BRANCHTABLE :                  
                     $options = new stdClass;
                     $options->para = false;
                     $buttons = array('next' => array(), 'prev' => array(), 'other' => array());
                     } else {
                         $value = "";
                     }
-                    echo '<tr><td align="center" valign="top" nowrap><label for="answer">'.get_string("youranswer", "lesson").'</label>:</td><td>'.
+                    echo '<tr><td align="center" valign="top" nowrap="nowrap"><label for="answer">'.get_string("youranswer", "lesson").'</label>:</td><td>'.
                          '<textarea id="answer" name="answer" rows="15" cols="60">'.$value."</textarea>\n";
                     echo '</td></tr></table>';
                     print_simple_box_end();
                     lesson_print_submit_link(get_string('pleaseenteryouranswerinthebox', 'lesson'), 'answerform');
                     break;
+                default: // close the tags MDL-7861
+                    echo ('</table>');
+                    print_simple_box_end();
+                break;
             }
             echo "</form>\n"; 
         } else {