Skip to content

Commit

Permalink
tried to make editing a lesson look nicer. Added generalbox class to …
Browse files Browse the repository at this point in the history
…tables and used tabs for selecting question types
  • Loading branch information
michaelpenne committed May 3, 2005
1 parent f5c864e commit 9638a1f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 36 deletions.
3 changes: 1 addition & 2 deletions mod/lesson/action/addbranchtable.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
<input type="hidden" name="pageid" value="<?PHP echo $pageid ?>" />
<input type="hidden" name="qtype" value="<?PHP echo LESSON_BRANCHTABLE ?>" />
<input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>" />
<center><table cellpadding=5 border=1>
<tr><td align="center">
<center><table class="generalbox" cellpadding=5 border=1>
<tr valign="top">
<td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br />
<!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value="" /></td></tr>
Expand Down
14 changes: 7 additions & 7 deletions mod/lesson/action/addpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,25 @@
<input type="hidden" name="action" value="insertpage">
<input type="hidden" name="pageid" value="<?PHP echo $pageid ?>">
<input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>">
<center><table cellpadding=5 border=1>
<center>
<?php
echo "<tr><td align=\"center\"><b>";
echo get_string("questiontype", "lesson").":</b> \n";
echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br>";
if (isset($_GET['qtype'])) {
$qtype = clean_param($_GET['qtype'], PARAM_INT);
lesson_qtype_menu($LESSON_QUESTION_TYPE, $qtype,
"lesson.php?id=$cm->id&action=addpage&pageid=".$pageid.$linkadd);
// NoticeFix rearraged
if ( $qtype == LESSON_SHORTANSWER || $qtype == LESSON_MULTICHOICE ) { // only display this option for Multichoice and shortanswer
echo '<p>';
if ($qtype == LESSON_SHORTANSWER) {
echo "<br><br><b>".get_string("casesensitive", "lesson").":</b> \n";
echo "<b>".get_string("casesensitive", "lesson").":</b> \n";
} else {
echo "<br><br><b>".get_string("multianswer", "lesson").":</b> \n";
echo "<b>".get_string("multianswer", "lesson").":</b> \n";
}
echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo '</p>';
}
} else {
lesson_qtype_menu($LESSON_QUESTION_TYPE, LESSON_MULTICHOICE,
Expand All @@ -77,9 +78,8 @@
echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
}
echo "</td></tr>\n";
?>
<tr><td align="center">
<table cellpadding="5" class="generalbox" border="1">
<tr valign="top">
<td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br />
<!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value=""></td></tr>
Expand Down
22 changes: 9 additions & 13 deletions mod/lesson/action/editpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,56 +60,52 @@
<input type="hidden" name="pageid" value="<?PHP echo $pageid ?>">
<input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>">
<input type="hidden" name="redisplay" value="0">
<center><table cellpadding=5 border=1>
<center>
<?php
switch ($page->qtype) {
case LESSON_MULTICHOICE :
echo "<tr><td align=\"center\"><b>";
echo get_string("questiontype", "lesson").":</b> \n";
echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br>";
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
"document.editpage.redisplay.value=1;document.editpage.submit();");
echo "<br><br><b>".get_string("multianswer", "lesson").":</b> \n";
echo "<p><b>".get_string("multianswer", "lesson").":</b> \n";
if ($page->qoption) {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\"/>"; //CDC hidden label added.
} else {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
}
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo "</td></tr>\n";
echo "</p>\n";
break;
case LESSON_SHORTANSWER :
echo "<tr><td align=\"center\"><b>";
echo get_string("questiontype", "lesson").":</b> \n";
echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
echo helpbutton("questiontype", get_string("questiontype", "lesson"), "lesson")."<br>";
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
"document.editpage.redisplay.value=1;document.editpage.submit();");
echo "<br><br><b>".get_string("casesensitive", "lesson").":</b> \n";
echo "<p><b>".get_string("casesensitive", "lesson").":</b> \n";
if ($page->qoption) {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\"/>"; //CDC hidden label added.
} else {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
}
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo "</td></tr>\n";
echo "</p>\n";
break;
case LESSON_TRUEFALSE :
case LESSON_ESSAY :
case LESSON_MATCHING :
case LESSON_NUMERICAL :
echo "<tr><td align=\"center\"><b>";
echo get_string("questiontype", "lesson").":</b> \n";
echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
echo helpbutton("questiontype", get_string("questiontype", "lesson"), "lesson")."<br>";
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
"document.editpage.redisplay.value=1;document.editpage.submit();");
echo "</td></tr>\n";
break;
}
?>
<tr><td align="center">
<table cellpadding="5" class="generalbox" border="1">
<tr valign="top">
<td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br />
<!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value="<?php p($page->title) ?>"></td>
Expand Down
22 changes: 9 additions & 13 deletions mod/lesson/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,20 +1113,16 @@ function lesson_calculate_ongoing_score($lesson, $userid, $retries, $return=fals
/*******************************************************************/
function lesson_qtype_menu($qtypes, $selected="", $link="", $onclick="") {
// prints the question types for when editing and adding a page

$output = "";
foreach ($qtypes as $value => $label) {
if ($value == $selected) {
$output .= "<b>$label</b>";
$output .= "<input type=\"hidden\" name=\"qtype\" value=\"$value\" /> \n";
} else {
$output .= "<a onClick=\"$onclick\" href=\"$link"."&qtype=$value\">$label</a>";
}
if ($label != end($qtypes)) {
$output .= " | ";
}
$tabs = array();
$tabrows = array();

foreach ($qtypes as $qtype => $qtypename) {
$tabrows[] = new tabobject($qtype, "$link&amp;qtype=$qtype\" onClick=\"$onclick\"", $qtypename);
}
echo $output;
$tabs[] = $tabrows;
print_tabs($tabs, $selected);
echo "<input type=\"hidden\" name=\"qtype\" value=\"$selected\" /> \n";

}

/*******************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion mod/lesson/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@
/// CDC-FLAG /// end tree code (note, there is an "}" below for an else above)
while (true) {
echo "<tr><td>\n";
echo "<table width=\"100%\" border=\"1\"><tr><th colspan=\"2\">".format_string($page->title)."&nbsp;&nbsp;\n";
echo "<table width=\"100%\" border=\"1\" class=\"generalbox\"><tr><th colspan=\"2\">".format_string($page->title)."&nbsp;&nbsp;\n";
if (isteacheredit($course->id)) {
if ($npages > 1) {
echo "<a title=\"".get_string("move")."\" href=\"lesson.php?id=$cm->id&amp;action=move&amp;pageid=$page->id\">\n".
Expand Down

0 comments on commit 9638a1f

Please sign in to comment.