Skip to content

Commit

Permalink
MDL-19812 Upgraded calls to choose_from_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 18, 2009
1 parent e5f5d96 commit 955ee33
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions mod/lesson/action/addbranchtable.php
Expand Up @@ -65,10 +65,10 @@
echo "<tr><td><strong>".get_string("jump", "lesson")." $iplus1:</strong> \n";
if ($i) {
// answers 2, 3, 4... jumpto this page
choose_from_menu($jump, "jumpto[$i]", 0, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", 0, false));
} else {
// answer 1 jumpto next page
choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", LESSON_NEXTPAGE, false));
}
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
echo "</td></tr>\n";
Expand Down
14 changes: 7 additions & 7 deletions mod/lesson/action/addpage.php
Expand Up @@ -90,10 +90,10 @@
echo "<tr><td><b>".get_string("jump", "lesson")." $iplus1:</b> \n";
if ($i) {
// answers 2, 3, 4... jumpto this page
choose_from_menu($jump, "jumpto[$i]", 0, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", 0, false));
} else {
// answer 1 jumpto next page
choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", LESSON_NEXTPAGE, false));
}
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if($lesson->custom) {
Expand All @@ -108,7 +108,7 @@
break;
case LESSON_ESSAY :
echo "<tr><td><b>".get_string("jump", "lesson").":</b> \n";
choose_from_menu($jump, "jumpto[0]", LESSON_NEXTPAGE, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[0]", LESSON_NEXTPAGE, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if ($lesson->custom) {
echo get_string("score", "lesson").": <input type=\"text\" name=\"score[0]\" value=\"1\" size=\"5\" />";
Expand Down Expand Up @@ -136,15 +136,15 @@
}
if ($i == 2) {
echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", LESSON_NEXTPAGE, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if($lesson->custom) {
echo get_string("correctanswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\" />";
}
echo "</td></tr>\n";
} elseif ($i == 3) {
echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
choose_from_menu($jump, "jumpto[$i]", 0, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", 0, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if($lesson->custom) {
echo get_string("wronganswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\" />";
Expand All @@ -168,10 +168,10 @@
echo "<tr><td><b>".get_string("jump", "lesson")." $iplus1:</b> \n";
if ($i) {
// answers 2, 3, 4... jumpto this page
choose_from_menu($jump, "jumpto[$i]", 0, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", 0, false));
} else {
// answer 1 jumpto next page
choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", LESSON_NEXTPAGE, false));
}
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if($lesson->custom) {
Expand Down
20 changes: 10 additions & 10 deletions mod/lesson/action/editpage.php
Expand Up @@ -291,15 +291,15 @@
case LESSON_MATCHING :
if ($n == 2) {
echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$n]", $answer->jumpto, false));
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, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$n]", $answer->jumpto, false);
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\" />";
Expand All @@ -309,7 +309,7 @@
break;
case LESSON_ESSAY :
echo "<tr><td><b>".get_string("jump", "lesson").":</b> \n";
choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$n]", $answer->jumpto, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if($lesson->custom) {
echo get_string("score", "lesson").": <input type=\"text\" name=\"score[$n]\" value=\"$answer->score\" size=\"5\" />";
Expand All @@ -321,7 +321,7 @@
case LESSON_SHORTANSWER:
case LESSON_NUMERICAL:
echo "<tr><td><b>".get_string("jump", "lesson")." $nplus1:</b> \n";
choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$n]", $answer->jumpto, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if($lesson->custom) {
echo get_string("score", "lesson")." $nplus1: <input type=\"text\" name=\"score[$n]\" value=\"$answer->score\" size=\"5\" />";
Expand All @@ -333,7 +333,7 @@
case LESSON_ENDOFCLUSTER:
case LESSON_ENDOFBRANCH:
echo "<tr><td><b>".get_string("jump", "lesson")." $nplus1:</b> \n";
choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$n]", $answer->jumpto, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
echo "</td></tr>\n";
break;
Expand Down Expand Up @@ -412,7 +412,7 @@
case LESSON_ESSAY :
if ($i < 1) {
echo "<tr><td><b>".get_string("jump", "lesson").":</b> \n";
choose_from_menu($jump, "jumpto[$i]", 0, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", 0, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if($lesson->custom) {
echo get_string("score", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\" />";
Expand All @@ -423,7 +423,7 @@
case LESSON_MATCHING :
if ($i == 2) {
echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", $answer->jumpto, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if ($lesson->custom) {
echo get_string("correctanswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"$answer->score\" size=\"5\" />";
Expand All @@ -432,7 +432,7 @@
}
if ($i == 3) {
echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", $answer->jumpto, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if ($lesson->custom) {
echo get_string("wronganswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"$answer->score\" size=\"5\" />";
Expand All @@ -446,7 +446,7 @@
case LESSON_SHORTANSWER:
case LESSON_NUMERICAL:
echo "<tr><td><b>".get_string("jump", "lesson")." $iplus1:</b> \n";
choose_from_menu($jump, "jumpto[$i]", 0, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", 0, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
if($lesson->custom) {
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\" />";
Expand All @@ -455,7 +455,7 @@
break;
case LESSON_BRANCHTABLE :
echo "<tr><td><b>".get_string("jump", "lesson")." $iplus1:</b> \n";
choose_from_menu($jump, "jumpto[$i]", 0, "");
echo $OUTPUT->select(html_select::make($jump, "jumpto[$i]", 0, false));
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
echo "</td></tr>\n";
break;
Expand Down
4 changes: 3 additions & 1 deletion mod/lesson/essay.php
Expand Up @@ -369,7 +369,9 @@
$options[0] = get_string('nocredit', 'lesson');
$options[1] = get_string('credit', 'lesson');
}
$table->data[] = array(get_string('essayscore', 'lesson').': '.choose_from_menu($options, 'score', $essayinfo->score, '', '', '', true));
$select = html_select::make($options, 'score', $essayinfo->score, false);
$select->nothingvalue = '';
$table->data[] = array(get_string('essayscore', 'lesson').': '.$OUTPUT->select($select));

print_table($table);
echo '<div class="buttons">
Expand Down
2 changes: 1 addition & 1 deletion mod/lesson/import.php
Expand Up @@ -95,7 +95,7 @@
echo "<tr><td align=\"right\">";
print_string("fileformat", "lesson");
echo ":</td><td>";
choose_from_menu($fileformatnames, "format", "gift", "");
echo $OUTPUT->select(html_select::make($fileformatnames, "format", "gift", false));
echo "</td></tr>";

echo "<tr><td align=\"right\">";
Expand Down
4 changes: 2 additions & 2 deletions mod/lesson/view.php
Expand Up @@ -684,10 +684,10 @@

if (isset($USER->modattempts[$lesson->id])) {
$selected = htmlspecialchars(trim($answers[$useranswers[$t]]->response)); // gets the user's previous answer
choose_from_menu ($responseoptions, "response[$answer->id]", $selected);
echo $OUTPUT->select(html_select::make ($responseoptions, "response[$answer->id]", $selected));
$t++;
} else {
choose_from_menu ($responseoptions, "response[$answer->id]");
echo $OUTPUT->select(html_select::make ($responseoptions, "response[$answer->id]"));
}
echo '</td></tr>';
if ($answer != end($answers)) {
Expand Down

0 comments on commit 955ee33

Please sign in to comment.