mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
Tabs are out.
(all the module was using them, please change your editor settings to 4 spaces)
This commit is contained in:
parent
894ff63f8f
commit
271fea974f
15 changed files with 1808 additions and 1810 deletions
|
@ -1,83 +1,83 @@
|
|||
<?php
|
||||
/************** add branch table ************************************/
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
|
||||
// set of jump array
|
||||
$jump = array();
|
||||
$jump[0] = get_string("thispage", "lesson");
|
||||
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
|
||||
//// CDC-FLAG /////
|
||||
$jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
|
||||
if (!isset($_GET['firstpage'])) {
|
||||
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
|
||||
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
|
||||
error("Add page: first page not found");
|
||||
}
|
||||
while (true) {
|
||||
if ($apageid) {
|
||||
$title = get_field("lesson_pages", "title", "id", $apageid);
|
||||
$jump[$apageid] = $title;
|
||||
$apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//// CDC-FLAG /////
|
||||
// give teacher a blank proforma
|
||||
print_heading_with_help(get_string("addabranchtable", "lesson"), "overview", "lesson");
|
||||
?>
|
||||
<form name="form" method="post" action="lesson.php" />
|
||||
<input type="hidden" name="id" value="<?PHP echo $cm->id ?>" />
|
||||
<input type="hidden" name="action" value="insertpage">
|
||||
<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 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>
|
||||
<?PHP
|
||||
echo "<tr><td><b>";
|
||||
echo get_string("pagecontents", "lesson").":</b><br />\n";
|
||||
print_textarea($usehtmleditor, 25,70, 630, 400, "contents");
|
||||
use_html_editor("contents");
|
||||
echo "</td></tr>\n";
|
||||
/// CDC-FLAG /// 6/16/04
|
||||
echo "<tr><td>\n";
|
||||
echo "<center><input name=\"layout\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
|
||||
echo get_string("arrangebuttonshorizontally", "lesson")."\n";
|
||||
echo "<br><input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
|
||||
echo get_string("displayinleftmenu", "lesson");
|
||||
echo "</center>\n";
|
||||
echo "</td></tr>\n";
|
||||
/// CDC-FLAG ///
|
||||
for ($i = 0; $i < $lesson->maxanswers; $i++) {
|
||||
$iplus1 = $i + 1;
|
||||
echo "<tr><td><b>".get_string("description", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$i]"); // made the default set to off also removed use_html_editor(); line from down below, which made all textareas turn into html editors
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
if ($i) {
|
||||
// answers 2, 3, 4... jumpto this page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
} else {
|
||||
// answer 1 jumpto next page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
}
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
// close table and form
|
||||
?>
|
||||
</table><br />
|
||||
<input type="submit" value="<?php print_string("addabranchtable", "lesson") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
</center>
|
||||
</form>
|
||||
// set of jump array
|
||||
$jump = array();
|
||||
$jump[0] = get_string("thispage", "lesson");
|
||||
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
|
||||
//// CDC-FLAG /////
|
||||
$jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
|
||||
if (!isset($_GET['firstpage'])) {
|
||||
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
|
||||
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
|
||||
error("Add page: first page not found");
|
||||
}
|
||||
while (true) {
|
||||
if ($apageid) {
|
||||
$title = get_field("lesson_pages", "title", "id", $apageid);
|
||||
$jump[$apageid] = $title;
|
||||
$apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//// CDC-FLAG /////
|
||||
// give teacher a blank proforma
|
||||
print_heading_with_help(get_string("addabranchtable", "lesson"), "overview", "lesson");
|
||||
?>
|
||||
<form name="form" method="post" action="lesson.php" />
|
||||
<input type="hidden" name="id" value="<?PHP echo $cm->id ?>" />
|
||||
<input type="hidden" name="action" value="insertpage">
|
||||
<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 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>
|
||||
<?PHP
|
||||
echo "<tr><td><b>";
|
||||
echo get_string("pagecontents", "lesson").":</b><br />\n";
|
||||
print_textarea($usehtmleditor, 25,70, 630, 400, "contents");
|
||||
use_html_editor("contents");
|
||||
echo "</td></tr>\n";
|
||||
/// CDC-FLAG /// 6/16/04
|
||||
echo "<tr><td>\n";
|
||||
echo "<center><input name=\"layout\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
|
||||
echo get_string("arrangebuttonshorizontally", "lesson")."\n";
|
||||
echo "<br><input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\" />";
|
||||
echo get_string("displayinleftmenu", "lesson");
|
||||
echo "</center>\n";
|
||||
echo "</td></tr>\n";
|
||||
/// CDC-FLAG ///
|
||||
for ($i = 0; $i < $lesson->maxanswers; $i++) {
|
||||
$iplus1 = $i + 1;
|
||||
echo "<tr><td><b>".get_string("description", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$i]"); // made the default set to off also removed use_html_editor(); line from down below, which made all textareas turn into html editors
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
if ($i) {
|
||||
// answers 2, 3, 4... jumpto this page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
} else {
|
||||
// answer 1 jumpto next page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
}
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
// close table and form
|
||||
?>
|
||||
</table><br />
|
||||
<input type="submit" value="<?php print_string("addabranchtable", "lesson") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
</center>
|
||||
</form>
|
||||
|
|
|
@ -2,65 +2,65 @@
|
|||
|
||||
/************** add end of branch ************************************/
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
confirm_sesskey();
|
||||
confirm_sesskey();
|
||||
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
|
||||
$timenow = time();
|
||||
$timenow = time();
|
||||
|
||||
// the new page is not the first page (end of branch always comes after an existing page)
|
||||
if (!$page = get_record("lesson_pages", "id", $pageid)) {
|
||||
error("Add end of branch: page record not found");
|
||||
}
|
||||
// chain back up to find the (nearest branch table)
|
||||
$btpageid = $pageid;
|
||||
if (!$btpage = get_record("lesson_pages", "id", $btpageid)) {
|
||||
error("Add end of branch: btpage record not found");
|
||||
}
|
||||
while (($btpage->qtype != LESSON_BRANCHTABLE) AND ($btpage->prevpageid > 0)) {
|
||||
$btpageid = $btpage->prevpageid;
|
||||
if (!$btpage = get_record("lesson_pages", "id", $btpageid)) {
|
||||
error("Add end of branch: btpage record not found");
|
||||
}
|
||||
}
|
||||
if ($btpage->qtype == LESSON_BRANCHTABLE) {
|
||||
$newpage = new stdClass;
|
||||
$newpage->lessonid = $lesson->id;
|
||||
$newpage->prevpageid = $pageid;
|
||||
$newpage->nextpageid = $page->nextpageid;
|
||||
$newpage->qtype = LESSON_ENDOFBRANCH;
|
||||
$newpage->timecreated = $timenow;
|
||||
$newpage->title = get_string("endofbranch", "lesson");
|
||||
$newpage->contents = get_string("endofbranch", "lesson");
|
||||
if (!$newpageid = insert_record("lesson_pages", $newpage)) {
|
||||
error("Insert page: new page not inserted");
|
||||
}
|
||||
// update the linked list...
|
||||
if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
|
||||
error("Add end of branch: unable to update link");
|
||||
}
|
||||
if ($page->nextpageid) {
|
||||
// the new page is not the last page
|
||||
if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
|
||||
error("Insert page: unable to update previous link");
|
||||
}
|
||||
}
|
||||
// ..and the single "answer"
|
||||
$newanswer = new stdClass;
|
||||
$newanswer->lessonid = $lesson->id;
|
||||
$newanswer->pageid = $newpageid;
|
||||
$newanswer->timecreated = $timenow;
|
||||
$newanswer->jumpto = $btpageid;
|
||||
if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
|
||||
error("Add end of branch: answer record not inserted");
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('addedanendofbranch', 'lesson'));
|
||||
} else {
|
||||
notice(get_string("nobranchtablefound", "lesson"), "view.php?id=$cm->id");
|
||||
}
|
||||
?>
|
||||
// the new page is not the first page (end of branch always comes after an existing page)
|
||||
if (!$page = get_record("lesson_pages", "id", $pageid)) {
|
||||
error("Add end of branch: page record not found");
|
||||
}
|
||||
// chain back up to find the (nearest branch table)
|
||||
$btpageid = $pageid;
|
||||
if (!$btpage = get_record("lesson_pages", "id", $btpageid)) {
|
||||
error("Add end of branch: btpage record not found");
|
||||
}
|
||||
while (($btpage->qtype != LESSON_BRANCHTABLE) AND ($btpage->prevpageid > 0)) {
|
||||
$btpageid = $btpage->prevpageid;
|
||||
if (!$btpage = get_record("lesson_pages", "id", $btpageid)) {
|
||||
error("Add end of branch: btpage record not found");
|
||||
}
|
||||
}
|
||||
if ($btpage->qtype == LESSON_BRANCHTABLE) {
|
||||
$newpage = new stdClass;
|
||||
$newpage->lessonid = $lesson->id;
|
||||
$newpage->prevpageid = $pageid;
|
||||
$newpage->nextpageid = $page->nextpageid;
|
||||
$newpage->qtype = LESSON_ENDOFBRANCH;
|
||||
$newpage->timecreated = $timenow;
|
||||
$newpage->title = get_string("endofbranch", "lesson");
|
||||
$newpage->contents = get_string("endofbranch", "lesson");
|
||||
if (!$newpageid = insert_record("lesson_pages", $newpage)) {
|
||||
error("Insert page: new page not inserted");
|
||||
}
|
||||
// update the linked list...
|
||||
if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
|
||||
error("Add end of branch: unable to update link");
|
||||
}
|
||||
if ($page->nextpageid) {
|
||||
// the new page is not the last page
|
||||
if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
|
||||
error("Insert page: unable to update previous link");
|
||||
}
|
||||
}
|
||||
// ..and the single "answer"
|
||||
$newanswer = new stdClass;
|
||||
$newanswer->lessonid = $lesson->id;
|
||||
$newanswer->pageid = $newpageid;
|
||||
$newanswer->timecreated = $timenow;
|
||||
$newanswer->jumpto = $btpageid;
|
||||
if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
|
||||
error("Add end of branch: answer record not inserted");
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('addedanendofbranch', 'lesson'));
|
||||
} else {
|
||||
notice(get_string("nobranchtablefound", "lesson"), "view.php?id=$cm->id");
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -2,240 +2,240 @@
|
|||
|
||||
/************** add page ************************************/
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
// first get the preceeding page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
|
||||
// set of jump array
|
||||
$jump = array();
|
||||
$jump[0] = get_string("thispage", "lesson");
|
||||
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
|
||||
//// CDC-FLAG 6/18/04 /////
|
||||
$jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
|
||||
if(lesson_display_branch_jumps($lesson->id, $pageid)) {
|
||||
$jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson");
|
||||
$jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson");
|
||||
}
|
||||
if(lesson_display_cluster_jump($lesson->id, $pageid)) {
|
||||
$jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
if (!isset($_GET['firstpage'])) {
|
||||
$linkadd = "";
|
||||
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
|
||||
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
|
||||
error("Add page: first page not found");
|
||||
}
|
||||
while (true) {
|
||||
if ($apageid) {
|
||||
$title = get_field("lesson_pages", "title", "id", $apageid);
|
||||
$jump[$apageid] = strip_tags(format_string($title,true));
|
||||
$apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$linkadd = "&firstpage=1";
|
||||
}
|
||||
// set of jump array
|
||||
$jump = array();
|
||||
$jump[0] = get_string("thispage", "lesson");
|
||||
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
|
||||
//// CDC-FLAG 6/18/04 /////
|
||||
$jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
|
||||
if(lesson_display_branch_jumps($lesson->id, $pageid)) {
|
||||
$jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson");
|
||||
$jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson");
|
||||
}
|
||||
if(lesson_display_cluster_jump($lesson->id, $pageid)) {
|
||||
$jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
if (!isset($_GET['firstpage'])) {
|
||||
$linkadd = "";
|
||||
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
|
||||
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
|
||||
error("Add page: first page not found");
|
||||
}
|
||||
while (true) {
|
||||
if ($apageid) {
|
||||
$title = get_field("lesson_pages", "title", "id", $apageid);
|
||||
$jump[$apageid] = strip_tags(format_string($title,true));
|
||||
$apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$linkadd = "&firstpage=1";
|
||||
}
|
||||
|
||||
// give teacher a blank proforma
|
||||
print_heading_with_help(get_string("addaquestionpage", "lesson"), "overview", "lesson");
|
||||
?>
|
||||
<form name="form" method="post" action="lesson.php">
|
||||
<input type="hidden" name="id" value="<?PHP echo $cm->id ?>">
|
||||
<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>
|
||||
<?php
|
||||
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 "<b>".get_string("casesensitive", "lesson").":</b> \n";
|
||||
} else {
|
||||
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,
|
||||
"lesson.php?id=$cm->id&action=addpage&pageid=".$pageid.$linkadd);
|
||||
echo "<br><br><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");
|
||||
}
|
||||
?>
|
||||
<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>
|
||||
<?PHP
|
||||
echo "<tr><td><b>";
|
||||
echo get_string("pagecontents", "lesson").":</b><br />\n";
|
||||
print_textarea($usehtmleditor, 25,70, 630, 400, "contents");
|
||||
use_html_editor("contents");
|
||||
echo "</td></tr>\n";
|
||||
if (isset($_GET['qtype'])) {
|
||||
switch ($_GET['qtype']) {
|
||||
case LESSON_TRUEFALSE :
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
$iplus1 = $i + 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
if ($i) {
|
||||
// answers 2, 3, 4... jumpto this page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
} else {
|
||||
// answer 1 jumpto next page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
}
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
/// CDC-FLAG ///
|
||||
if($lesson->custom) {
|
||||
if ($i) {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\">";
|
||||
} else {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
|
||||
}
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
case LESSON_ESSAY :
|
||||
echo "<tr><td><B>".get_string("jump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[0]", LESSON_NEXTPAGE, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_MATCHING :
|
||||
for ($i = 0; $i < $lesson->maxanswers+2; $i++) {
|
||||
$icorrected = $i - 1;
|
||||
if ($i == 0) {
|
||||
echo "<tr><td><b>".get_string("correctresponse", "lesson").":</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
} elseif ($i == 1) {
|
||||
echo "<tr><td><b>".get_string("wrongresponse", "lesson").":</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
} else {
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $icorrected:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("matchesanswer", "lesson")." $icorrected:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
if ($i == 2) {
|
||||
echo "<tr><td><B>".get_string("correctanswerjump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
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";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LESSON_SHORTANSWER :
|
||||
case LESSON_NUMERICAL :
|
||||
case LESSON_MULTICHOICE :
|
||||
// default code
|
||||
for ($i = 0; $i < $lesson->maxanswers; $i++) {
|
||||
$iplus1 = $i + 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
if ($i) {
|
||||
// answers 2, 3, 4... jumpto this page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
} else {
|
||||
// answer 1 jumpto next page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
}
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
/// CDC-FLAG ///
|
||||
if($lesson->custom) {
|
||||
if ($i) {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\">";
|
||||
} else {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
|
||||
}
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < $lesson->maxanswers; $i++) {
|
||||
$iplus1 = $i + 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
if ($i) {
|
||||
// answers 2, 3, 4... jumpto this page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
} else {
|
||||
// answer 1 jumpto next page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
}
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
/// CDC-FLAG ///
|
||||
if($lesson->custom) {
|
||||
if ($i) {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\">";
|
||||
} else {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
|
||||
}
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
// close table and form
|
||||
?>
|
||||
</table><br />
|
||||
<input type="submit" value="<?php print_string("addaquestionpage", "lesson") ?>">
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>">
|
||||
</center>
|
||||
</form>
|
||||
// give teacher a blank proforma
|
||||
print_heading_with_help(get_string("addaquestionpage", "lesson"), "overview", "lesson");
|
||||
?>
|
||||
<form name="form" method="post" action="lesson.php">
|
||||
<input type="hidden" name="id" value="<?PHP echo $cm->id ?>">
|
||||
<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>
|
||||
<?php
|
||||
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 "<b>".get_string("casesensitive", "lesson").":</b> \n";
|
||||
} else {
|
||||
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,
|
||||
"lesson.php?id=$cm->id&action=addpage&pageid=".$pageid.$linkadd);
|
||||
echo "<br><br><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");
|
||||
}
|
||||
?>
|
||||
<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>
|
||||
<?PHP
|
||||
echo "<tr><td><b>";
|
||||
echo get_string("pagecontents", "lesson").":</b><br />\n";
|
||||
print_textarea($usehtmleditor, 25,70, 630, 400, "contents");
|
||||
use_html_editor("contents");
|
||||
echo "</td></tr>\n";
|
||||
if (isset($_GET['qtype'])) {
|
||||
switch ($_GET['qtype']) {
|
||||
case LESSON_TRUEFALSE :
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
$iplus1 = $i + 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
if ($i) {
|
||||
// answers 2, 3, 4... jumpto this page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
} else {
|
||||
// answer 1 jumpto next page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
}
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
/// CDC-FLAG ///
|
||||
if($lesson->custom) {
|
||||
if ($i) {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\">";
|
||||
} else {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
|
||||
}
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
case LESSON_ESSAY :
|
||||
echo "<tr><td><B>".get_string("jump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[0]", LESSON_NEXTPAGE, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_MATCHING :
|
||||
for ($i = 0; $i < $lesson->maxanswers+2; $i++) {
|
||||
$icorrected = $i - 1;
|
||||
if ($i == 0) {
|
||||
echo "<tr><td><b>".get_string("correctresponse", "lesson").":</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
} elseif ($i == 1) {
|
||||
echo "<tr><td><b>".get_string("wrongresponse", "lesson").":</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
} else {
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $icorrected:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("matchesanswer", "lesson")." $icorrected:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
if ($i == 2) {
|
||||
echo "<tr><td><B>".get_string("correctanswerjump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
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";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LESSON_SHORTANSWER :
|
||||
case LESSON_NUMERICAL :
|
||||
case LESSON_MULTICHOICE :
|
||||
// default code
|
||||
for ($i = 0; $i < $lesson->maxanswers; $i++) {
|
||||
$iplus1 = $i + 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
if ($i) {
|
||||
// answers 2, 3, 4... jumpto this page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
} else {
|
||||
// answer 1 jumpto next page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
}
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
/// CDC-FLAG ///
|
||||
if($lesson->custom) {
|
||||
if ($i) {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\">";
|
||||
} else {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
|
||||
}
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < $lesson->maxanswers; $i++) {
|
||||
$iplus1 = $i + 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
if ($i) {
|
||||
// answers 2, 3, 4... jumpto this page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
} else {
|
||||
// answer 1 jumpto next page
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
|
||||
}
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
/// CDC-FLAG ///
|
||||
if($lesson->custom) {
|
||||
if ($i) {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"0\" size=\"5\">";
|
||||
} else {
|
||||
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
|
||||
}
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
// close table and form
|
||||
?>
|
||||
</table><br />
|
||||
<input type="submit" value="<?php print_string("addaquestionpage", "lesson") ?>">
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>">
|
||||
</center>
|
||||
</form>
|
||||
|
|
|
@ -2,30 +2,30 @@
|
|||
|
||||
/******************* confirm delete ************************************/
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
confirm_sesskey();
|
||||
confirm_sesskey();
|
||||
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
if (!$thispage = get_record("lesson_pages", "id", $pageid)) {
|
||||
error("Confirm delete: the page record not found");
|
||||
}
|
||||
print_heading(get_string("deletingpage", "lesson", format_string($thispage->title)));
|
||||
// print the jumps to this page
|
||||
if ($answers = get_records_select("lesson_answers", "lessonid = $lesson->id AND jumpto = $pageid + 1")) {
|
||||
print_heading(get_string("thefollowingpagesjumptothispage", "lesson"));
|
||||
echo "<p align=\"center\">\n";
|
||||
foreach ($answers as $answer) {
|
||||
if (!$title = get_field("lesson_pages", "title", "id", $answer->pageid)) {
|
||||
error("Confirm delete: page title not found");
|
||||
}
|
||||
echo $title."<br />\n";
|
||||
}
|
||||
}
|
||||
notice_yesno(get_string("confirmdeletionofthispage","lesson"),
|
||||
"lesson.php?action=delete&id=$cm->id&pageid=$pageid&sesskey=".$USER->sesskey,
|
||||
"view.php?id=$cm->id");
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
if (!$thispage = get_record("lesson_pages", "id", $pageid)) {
|
||||
error("Confirm delete: the page record not found");
|
||||
}
|
||||
print_heading(get_string("deletingpage", "lesson", format_string($thispage->title)));
|
||||
// print the jumps to this page
|
||||
if ($answers = get_records_select("lesson_answers", "lessonid = $lesson->id AND jumpto = $pageid + 1")) {
|
||||
print_heading(get_string("thefollowingpagesjumptothispage", "lesson"));
|
||||
echo "<p align=\"center\">\n";
|
||||
foreach ($answers as $answer) {
|
||||
if (!$title = get_field("lesson_pages", "title", "id", $answer->pageid)) {
|
||||
error("Confirm delete: page title not found");
|
||||
}
|
||||
echo $title."<br />\n";
|
||||
}
|
||||
}
|
||||
notice_yesno(get_string("confirmdeletionofthispage","lesson"),
|
||||
"lesson.php?action=delete&id=$cm->id&pageid=$pageid&sesskey=".$USER->sesskey,
|
||||
"view.php?id=$cm->id");
|
||||
?>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,59 +2,59 @@
|
|||
|
||||
/******************* delete ************************************/
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
confirm_sesskey();
|
||||
confirm_sesskey();
|
||||
|
||||
if (empty($_GET['pageid'])) {
|
||||
error("Delete: pageid missing");
|
||||
}
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
if (!$thispage = get_record("lesson_pages", "id", $pageid)) {
|
||||
error("Delete: page record not found");
|
||||
}
|
||||
if (empty($_GET['pageid'])) {
|
||||
error("Delete: pageid missing");
|
||||
}
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
if (!$thispage = get_record("lesson_pages", "id", $pageid)) {
|
||||
error("Delete: page record not found");
|
||||
}
|
||||
|
||||
print_string("deleting", "lesson");
|
||||
// first delete all the associated records...
|
||||
delete_records("lesson_attempts", "pageid", $pageid);
|
||||
// ...now delete the answers...
|
||||
delete_records("lesson_answers", "pageid", $pageid);
|
||||
// ..and the page itself
|
||||
delete_records("lesson_pages", "id", $pageid);
|
||||
print_string("deleting", "lesson");
|
||||
// first delete all the associated records...
|
||||
delete_records("lesson_attempts", "pageid", $pageid);
|
||||
// ...now delete the answers...
|
||||
delete_records("lesson_answers", "pageid", $pageid);
|
||||
// ..and the page itself
|
||||
delete_records("lesson_pages", "id", $pageid);
|
||||
|
||||
// repair the hole in the linkage
|
||||
if (!$thispage->prevpageid) {
|
||||
// this is the first page...
|
||||
if (!$page = get_record("lesson_pages", "id", $thispage->nextpageid)) {
|
||||
error("Delete: next page not found");
|
||||
}
|
||||
if (!set_field("lesson_pages", "prevpageid", 0, "id", $page->id)) {
|
||||
error("Delete: unable to set prevpage link");
|
||||
}
|
||||
} elseif (!$thispage->nextpageid) {
|
||||
// this is the last page...
|
||||
if (!$page = get_record("lesson_pages", "id", $thispage->prevpageid)) {
|
||||
error("Delete: prev page not found");
|
||||
}
|
||||
if (!set_field("lesson_pages", "nextpageid", 0, "id", $page->id)) {
|
||||
error("Delete: unable to set nextpage link");
|
||||
}
|
||||
} else {
|
||||
// page is in the middle...
|
||||
if (!$prevpage = get_record("lesson_pages", "id", $thispage->prevpageid)) {
|
||||
error("Delete: prev page not found");
|
||||
}
|
||||
if (!$nextpage = get_record("lesson_pages", "id", $thispage->nextpageid)) {
|
||||
error("Delete: next page not found");
|
||||
}
|
||||
if (!set_field("lesson_pages", "nextpageid", $nextpage->id, "id", $prevpage->id)) {
|
||||
error("Delete: unable to set next link");
|
||||
}
|
||||
if (!set_field("lesson_pages", "prevpageid", $prevpage->id, "id", $nextpage->id)) {
|
||||
error("Delete: unable to set prev link");
|
||||
}
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('deletedpage', 'lesson'));
|
||||
?>
|
||||
// repair the hole in the linkage
|
||||
if (!$thispage->prevpageid) {
|
||||
// this is the first page...
|
||||
if (!$page = get_record("lesson_pages", "id", $thispage->nextpageid)) {
|
||||
error("Delete: next page not found");
|
||||
}
|
||||
if (!set_field("lesson_pages", "prevpageid", 0, "id", $page->id)) {
|
||||
error("Delete: unable to set prevpage link");
|
||||
}
|
||||
} elseif (!$thispage->nextpageid) {
|
||||
// this is the last page...
|
||||
if (!$page = get_record("lesson_pages", "id", $thispage->prevpageid)) {
|
||||
error("Delete: prev page not found");
|
||||
}
|
||||
if (!set_field("lesson_pages", "nextpageid", 0, "id", $page->id)) {
|
||||
error("Delete: unable to set nextpage link");
|
||||
}
|
||||
} else {
|
||||
// page is in the middle...
|
||||
if (!$prevpage = get_record("lesson_pages", "id", $thispage->prevpageid)) {
|
||||
error("Delete: prev page not found");
|
||||
}
|
||||
if (!$nextpage = get_record("lesson_pages", "id", $thispage->nextpageid)) {
|
||||
error("Delete: next page not found");
|
||||
}
|
||||
if (!set_field("lesson_pages", "nextpageid", $nextpage->id, "id", $prevpage->id)) {
|
||||
error("Delete: unable to set next link");
|
||||
}
|
||||
if (!set_field("lesson_pages", "prevpageid", $prevpage->id, "id", $nextpage->id)) {
|
||||
error("Delete: unable to set prev link");
|
||||
}
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('deletedpage', 'lesson'));
|
||||
?>
|
||||
|
|
|
@ -2,468 +2,468 @@
|
|||
|
||||
/************** edit page ************************************/
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
// get the page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
if (!$page = get_record("lesson_pages", "id", $pageid)) {
|
||||
error("Edit page: page record not found");
|
||||
}
|
||||
// get the page
|
||||
$pageid = required_param('pageid', PARAM_INT);
|
||||
if (!$page = get_record("lesson_pages", "id", $pageid)) {
|
||||
error("Edit page: page record not found");
|
||||
}
|
||||
|
||||
if (isset($_GET['qtype'])) {
|
||||
$page->qtype = required_param('qtype', PARAM_INT);
|
||||
}
|
||||
if (isset($_GET['qtype'])) {
|
||||
$page->qtype = required_param('qtype', PARAM_INT);
|
||||
}
|
||||
|
||||
// set of jump array
|
||||
$jump = array();
|
||||
$jump[0] = get_string("thispage", "lesson");
|
||||
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
|
||||
//// CDC-FLAG 6/18/04 /////
|
||||
$jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
|
||||
if(lesson_display_branch_jumps($lesson->id, $page->id)) {
|
||||
$jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson");
|
||||
$jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson");
|
||||
}
|
||||
if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_BRANCHTABLE) {
|
||||
$jump[LESSON_RANDOMBRANCH] = get_string("randombranch", "lesson");
|
||||
}
|
||||
if(lesson_display_cluster_jump($lesson->id, $page->id) && $page->qtype != LESSON_BRANCHTABLE && $page->qtype != LESSON_ENDOFCLUSTER) {
|
||||
$jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");
|
||||
}
|
||||
//// CDC-FLAG /////
|
||||
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
|
||||
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
|
||||
error("Edit page: first page not found");
|
||||
}
|
||||
while (true) {
|
||||
if ($apageid) {
|
||||
if (!$apage = get_record("lesson_pages", "id", $apageid)) {
|
||||
error("Edit page: apage record not found");
|
||||
}
|
||||
/// CDC-FLAG /// 6/15/04 removed != LESSON_ENDOFBRANCH...
|
||||
if (trim($page->title)) { // ...nor nuffin pages
|
||||
$jump[$apageid] = strip_tags(format_string($apage->title,true));
|
||||
}
|
||||
$apageid = $apage->nextpageid;
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
// give teacher a proforma
|
||||
?>
|
||||
<form name="editpage" method="post" action="lesson.php">
|
||||
<input type="hidden" name="id" value="<?PHP echo $cm->id ?>">
|
||||
<input type="hidden" name="action" value="updatepage">
|
||||
<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>
|
||||
<?php
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MULTICHOICE :
|
||||
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 "<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 "</p>\n";
|
||||
break;
|
||||
case LESSON_SHORTANSWER :
|
||||
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 "<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 "</p>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE :
|
||||
case LESSON_ESSAY :
|
||||
case LESSON_MATCHING :
|
||||
case LESSON_NUMERICAL :
|
||||
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();");
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<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>
|
||||
</tr>
|
||||
<?PHP
|
||||
echo "<tr><td><b>";
|
||||
echo get_string("pagecontents", "lesson").":</b><br />\n";
|
||||
print_textarea($usehtmleditor, 25, 70, 630, 400, "contents", $page->contents);
|
||||
use_html_editor("contents"); // always the editor
|
||||
echo "</td></tr>\n";
|
||||
$n = 0;
|
||||
switch ($page->qtype) {
|
||||
case LESSON_BRANCHTABLE :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\">\n";
|
||||
/// CDC-FLAG /// 6/16/04
|
||||
echo "<tr><td>\n";
|
||||
echo "<center>";
|
||||
if ($page->layout) {
|
||||
echo "<input checked=\"checked\" name=\"layout\" type=\"checkbox\" value=\"1\">";
|
||||
} else {
|
||||
echo "<input name=\"layout\" type=\"checkbox\" value=\"1\">";
|
||||
}
|
||||
echo get_string("arrangebuttonshorizontally", "lesson")."<center>\n";
|
||||
echo "<br>";
|
||||
if ($page->display) {
|
||||
echo "<center><input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\">";
|
||||
} else {
|
||||
echo "<center><input name=\"display\" type=\"checkbox\" value=\"1\">";
|
||||
}
|
||||
echo get_string("displayinleftmenu", "lesson")."<center>\n";
|
||||
echo "</td></tr>\n";
|
||||
/// CDC-FLAG ///
|
||||
echo "<tr><td><b>".get_string("branchtable", "lesson")."</b> \n";
|
||||
break;
|
||||
case LESSON_CLUSTER :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\">\n";
|
||||
echo "<tr><td><b>".get_string("clustertitle", "lesson")."</b> \n";
|
||||
break;
|
||||
case LESSON_ENDOFCLUSTER :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\">\n";
|
||||
echo "<tr><td><b>".get_string("endofclustertitle", "lesson")."</b> \n";
|
||||
break;
|
||||
case LESSON_ENDOFBRANCH :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\">\n";
|
||||
echo "<tr><td><b>".get_string("endofbranch", "lesson")."</b> \n";
|
||||
break;
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
// get the answers in a set order, the id order
|
||||
if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) {
|
||||
foreach ($answers as $answer) {
|
||||
$flags = intval($answer->flags); // force into an integer
|
||||
$nplus1 = $n + 1;
|
||||
echo "<input type=\"hidden\" name=\"answerid[$n]\" value=\"$answer->id\">\n";
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MATCHING:
|
||||
if ($n == 0) {
|
||||
echo "<tr><td><b>".get_string("correctresponse", "lesson").":</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">"; //CDC hidden label.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
} elseif ($n == 1) {
|
||||
echo "<tr><td><b>".get_string("wrongresponse", "lesson").":</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">"; //CDC hidden label.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
} else {
|
||||
$ncorrected = $n - 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $ncorrected:</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">"; //CDC hidden label.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("matchesanswer", "lesson")." $ncorrected:</b>\n";
|
||||
if ($flags & LESSON_RESPONSE_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response);
|
||||
use_html_editor("response[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $nplus1:</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">"; //CDC hidden label.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $nplus1:</b>\n";
|
||||
if ($flags & LESSON_RESPONSE_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response);
|
||||
use_html_editor("response[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_BRANCHTABLE:
|
||||
echo "<tr><td><b>".get_string("description", "lesson")." $nplus1:</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor CDC-FLAG added in this line... editor would not turn on w/o it
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"answereditor[$n]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MATCHING :
|
||||
if ($n == 2) {
|
||||
echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
if ($n == 3) {
|
||||
echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
|
||||
lesson_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";
|
||||
break;
|
||||
case LESSON_ESSAY :
|
||||
echo "<tr><td><b>".get_string("jump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><b>".get_string("jump", "lesson")." $nplus1:</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_BRANCHTABLE:
|
||||
case LESSON_CLUSTER:
|
||||
case LESSON_ENDOFCLUSTER:
|
||||
case LESSON_ENDOFBRANCH:
|
||||
echo "<tr><td><b>".get_string("jump", "lesson")." $nplus1:</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
$n++;
|
||||
if ($page->qtype == LESSON_ESSAY) {
|
||||
break; // only one answer for essays
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($page->qtype != LESSON_ENDOFBRANCH && $page->qtype != LESSON_CLUSTER && $page->qtype != LESSON_ENDOFCLUSTER) { /// CDC-FLAG 6/17/04 added to the condition ///
|
||||
if ($page->qtype == LESSON_MATCHING) {
|
||||
$maxanswers = $lesson->maxanswers + 2;
|
||||
} else {
|
||||
$maxanswers = $lesson->maxanswers;
|
||||
}
|
||||
for ($i = $n; $i < $maxanswers; $i++) {
|
||||
if ($page->qtype == LESSON_TRUEFALSE && $i > 1) {
|
||||
break; // stop printing answers... only need two for true/false
|
||||
}
|
||||
$iplus1 = $i + 1;
|
||||
echo "<input type=\"hidden\" name=\"answerid[$i]\" value=\"0\">\n";
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MATCHING:
|
||||
$icorrected = $i - 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $icorrected:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("matchesanswer", "lesson")." $icorrected:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"responseeditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"responseeditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_BRANCHTABLE:
|
||||
echo "<tr><td><b>".get_string("description", "lesson")." $iplus1:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
switch ($page->qtype) {
|
||||
case LESSON_ESSAY :
|
||||
if ($i < 1) {
|
||||
echo "<tr><td><B>".get_string("jump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
case LESSON_MATCHING :
|
||||
if ($i == 2) {
|
||||
echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
if ($i == 3) {
|
||||
echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
// set of jump array
|
||||
$jump = array();
|
||||
$jump[0] = get_string("thispage", "lesson");
|
||||
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
|
||||
//// CDC-FLAG 6/18/04 /////
|
||||
$jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
|
||||
if(lesson_display_branch_jumps($lesson->id, $page->id)) {
|
||||
$jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson");
|
||||
$jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson");
|
||||
}
|
||||
if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_BRANCHTABLE) {
|
||||
$jump[LESSON_RANDOMBRANCH] = get_string("randombranch", "lesson");
|
||||
}
|
||||
if(lesson_display_cluster_jump($lesson->id, $page->id) && $page->qtype != LESSON_BRANCHTABLE && $page->qtype != LESSON_ENDOFCLUSTER) {
|
||||
$jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");
|
||||
}
|
||||
//// CDC-FLAG /////
|
||||
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
|
||||
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
|
||||
error("Edit page: first page not found");
|
||||
}
|
||||
while (true) {
|
||||
if ($apageid) {
|
||||
if (!$apage = get_record("lesson_pages", "id", $apageid)) {
|
||||
error("Edit page: apage record not found");
|
||||
}
|
||||
/// CDC-FLAG /// 6/15/04 removed != LESSON_ENDOFBRANCH...
|
||||
if (trim($page->title)) { // ...nor nuffin pages
|
||||
$jump[$apageid] = strip_tags(format_string($apage->title,true));
|
||||
}
|
||||
$apageid = $apage->nextpageid;
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
// give teacher a proforma
|
||||
?>
|
||||
<form name="editpage" method="post" action="lesson.php">
|
||||
<input type="hidden" name="id" value="<?PHP echo $cm->id ?>">
|
||||
<input type="hidden" name="action" value="updatepage">
|
||||
<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>
|
||||
<?php
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MULTICHOICE :
|
||||
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 "<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 "</p>\n";
|
||||
break;
|
||||
case LESSON_SHORTANSWER :
|
||||
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 "<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 "</p>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE :
|
||||
case LESSON_ESSAY :
|
||||
case LESSON_MATCHING :
|
||||
case LESSON_NUMERICAL :
|
||||
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();");
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<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>
|
||||
</tr>
|
||||
<?PHP
|
||||
echo "<tr><td><b>";
|
||||
echo get_string("pagecontents", "lesson").":</b><br />\n";
|
||||
print_textarea($usehtmleditor, 25, 70, 630, 400, "contents", $page->contents);
|
||||
use_html_editor("contents"); // always the editor
|
||||
echo "</td></tr>\n";
|
||||
$n = 0;
|
||||
switch ($page->qtype) {
|
||||
case LESSON_BRANCHTABLE :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\">\n";
|
||||
/// CDC-FLAG /// 6/16/04
|
||||
echo "<tr><td>\n";
|
||||
echo "<center>";
|
||||
if ($page->layout) {
|
||||
echo "<input checked=\"checked\" name=\"layout\" type=\"checkbox\" value=\"1\">";
|
||||
} else {
|
||||
echo "<input name=\"layout\" type=\"checkbox\" value=\"1\">";
|
||||
}
|
||||
echo get_string("arrangebuttonshorizontally", "lesson")."<center>\n";
|
||||
echo "<br>";
|
||||
if ($page->display) {
|
||||
echo "<center><input name=\"display\" type=\"checkbox\" value=\"1\" checked=\"checked\">";
|
||||
} else {
|
||||
echo "<center><input name=\"display\" type=\"checkbox\" value=\"1\">";
|
||||
}
|
||||
echo get_string("displayinleftmenu", "lesson")."<center>\n";
|
||||
echo "</td></tr>\n";
|
||||
/// CDC-FLAG ///
|
||||
echo "<tr><td><b>".get_string("branchtable", "lesson")."</b> \n";
|
||||
break;
|
||||
case LESSON_CLUSTER :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\">\n";
|
||||
echo "<tr><td><b>".get_string("clustertitle", "lesson")."</b> \n";
|
||||
break;
|
||||
case LESSON_ENDOFCLUSTER :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\">\n";
|
||||
echo "<tr><td><b>".get_string("endofclustertitle", "lesson")."</b> \n";
|
||||
break;
|
||||
case LESSON_ENDOFBRANCH :
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$page->qtype\">\n";
|
||||
echo "<tr><td><b>".get_string("endofbranch", "lesson")."</b> \n";
|
||||
break;
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
// get the answers in a set order, the id order
|
||||
if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) {
|
||||
foreach ($answers as $answer) {
|
||||
$flags = intval($answer->flags); // force into an integer
|
||||
$nplus1 = $n + 1;
|
||||
echo "<input type=\"hidden\" name=\"answerid[$n]\" value=\"$answer->id\">\n";
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MATCHING:
|
||||
if ($n == 0) {
|
||||
echo "<tr><td><b>".get_string("correctresponse", "lesson").":</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">"; //CDC hidden label.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
} elseif ($n == 1) {
|
||||
echo "<tr><td><b>".get_string("wrongresponse", "lesson").":</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">"; //CDC hidden label.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
} else {
|
||||
$ncorrected = $n - 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $ncorrected:</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">"; //CDC hidden label.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("matchesanswer", "lesson")." $ncorrected:</b>\n";
|
||||
if ($flags & LESSON_RESPONSE_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response);
|
||||
use_html_editor("response[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $nplus1:</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\"answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">"; //CDC hidden label.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $nplus1:</b>\n";
|
||||
if ($flags & LESSON_RESPONSE_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "response[$n]", $answer->response);
|
||||
use_html_editor("response[$n]"); // switch on the editor
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_BRANCHTABLE:
|
||||
echo "<tr><td><b>".get_string("description", "lesson")." $nplus1:</b>\n";
|
||||
if ($flags & LESSON_ANSWER_EDITOR) {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" name=\"answereditor[$n]\" value=\"1\"
|
||||
checked=\"checked\">"; //CDC hidden label added.
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
use_html_editor("answer[$n]"); // switch on the editor CDC-FLAG added in this line... editor would not turn on w/o it
|
||||
} else {
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"answereditor[$n]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$n]", $answer->answer);
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MATCHING :
|
||||
if ($n == 2) {
|
||||
echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
if ($n == 3) {
|
||||
echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
|
||||
lesson_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";
|
||||
break;
|
||||
case LESSON_ESSAY :
|
||||
echo "<tr><td><b>".get_string("jump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><b>".get_string("jump", "lesson")." $nplus1:</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_BRANCHTABLE:
|
||||
case LESSON_CLUSTER:
|
||||
case LESSON_ENDOFCLUSTER:
|
||||
case LESSON_ENDOFBRANCH:
|
||||
echo "<tr><td><b>".get_string("jump", "lesson")." $nplus1:</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$n]", $answer->jumpto, "");
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
$n++;
|
||||
if ($page->qtype == LESSON_ESSAY) {
|
||||
break; // only one answer for essays
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($page->qtype != LESSON_ENDOFBRANCH && $page->qtype != LESSON_CLUSTER && $page->qtype != LESSON_ENDOFCLUSTER) { /// CDC-FLAG 6/17/04 added to the condition ///
|
||||
if ($page->qtype == LESSON_MATCHING) {
|
||||
$maxanswers = $lesson->maxanswers + 2;
|
||||
} else {
|
||||
$maxanswers = $lesson->maxanswers;
|
||||
}
|
||||
for ($i = $n; $i < $maxanswers; $i++) {
|
||||
if ($page->qtype == LESSON_TRUEFALSE && $i > 1) {
|
||||
break; // stop printing answers... only need two for true/false
|
||||
}
|
||||
$iplus1 = $i + 1;
|
||||
echo "<input type=\"hidden\" name=\"answerid[$i]\" value=\"0\">\n";
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MATCHING:
|
||||
$icorrected = $i - 1;
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $icorrected:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("matchesanswer", "lesson")." $icorrected:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"responseeditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"responseeditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "response[$i]");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_BRANCHTABLE:
|
||||
echo "<tr><td><b>".get_string("description", "lesson")." $iplus1:</b>\n";
|
||||
echo " [".get_string("useeditor", "lesson").": ".
|
||||
"<input type=\"checkbox\" name=\"answereditor[$i]\" value=\"1\">";
|
||||
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
|
||||
echo "]<br />\n";
|
||||
print_textarea(false, 10, 70, 630, 300, "answer[$i]");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
switch ($page->qtype) {
|
||||
case LESSON_ESSAY :
|
||||
if ($i < 1) {
|
||||
echo "<tr><td><B>".get_string("jump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
case LESSON_MATCHING :
|
||||
if ($i == 2) {
|
||||
echo "<tr><td><b>".get_string("correctanswerjump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
if ($i == 3) {
|
||||
echo "<tr><td><b>".get_string("wronganswerjump", "lesson").":</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", $answer->jumpto, "");
|
||||
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\">";
|
||||
}
|
||||
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_BRANCHTABLE :
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// close table and form
|
||||
?>
|
||||
</table><br />
|
||||
<input type="button" value="<?php print_string("redisplaypage", "lesson") ?>"
|
||||
onClick="document.editpage.redisplay.value=1;document.editpage.submit();" />
|
||||
<input type="submit" value="<?php print_string("savepage", "lesson") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
</center>
|
||||
</form>
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
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\">";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_BRANCHTABLE :
|
||||
echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
|
||||
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
|
||||
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// close table and form
|
||||
?>
|
||||
</table><br />
|
||||
<input type="button" value="<?php print_string("redisplaypage", "lesson") ?>"
|
||||
onClick="document.editpage.redisplay.value=1;document.editpage.submit();" />
|
||||
<input type="submit" value="<?php print_string("savepage", "lesson") ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
|
||||
</center>
|
||||
</form>
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
/// CDC-FLAG ///
|
||||
$newpage->title = clean_param($form->title, PARAM_CLEANHTML);
|
||||
$newpage->contents = clean_param(trim($form->contents), PARAM_CLEANHTML);
|
||||
$newpage->title = addslashes($newpage->title);
|
||||
$newpage->contents = addslashes($newpage->contents);
|
||||
$newpage->title = addslashes($newpage->title);
|
||||
$newpage->contents = addslashes($newpage->contents);
|
||||
$newpageid = insert_record("lesson_pages", $newpage);
|
||||
if (!$newpageid) {
|
||||
error("Insert page: new page not inserted");
|
||||
|
@ -88,7 +88,7 @@
|
|||
$newpage->title = clean_param($form->title, PARAM_CLEANHTML);
|
||||
$newpage->contents = clean_param(trim($form->contents), PARAM_CLEANHTML);
|
||||
$newpage->title = addslashes($newpage->title);
|
||||
$newpage->contents = addslashes($newpage->contents);
|
||||
$newpage->contents = addslashes($newpage->contents);
|
||||
$newpageid = insert_record("lesson_pages", $newpage);
|
||||
if (!$newpageid) {
|
||||
error("Insert page: new first page not inserted");
|
||||
|
@ -120,7 +120,7 @@
|
|||
$newpage->title = clean_param($form->title, PARAM_CLEANHTML);
|
||||
$newpage->contents = clean_param(trim($form->contents), PARAM_CLEANHTML);
|
||||
$newpage->title = addslashes($newpage->title);
|
||||
$newpage->contents = addslashes($newpage->contents);
|
||||
$newpage->contents = addslashes($newpage->contents);
|
||||
$newpageid = insert_record("lesson_pages", $newpage);
|
||||
if (!$newpageid) {
|
||||
error("Insert page: first page not inserted");
|
||||
|
@ -158,10 +158,10 @@
|
|||
$newanswer->pageid = $newpageid;
|
||||
$newanswer->timecreated = $timenow;
|
||||
$newanswer->answer = clean_param(trim($form->answer[$i]), PARAM_CLEANHTML);
|
||||
$newanswer->answer = addslashes($newanswer->answer);
|
||||
$newanswer->answer = addslashes($newanswer->answer);
|
||||
if (isset($form->response[$i])) {
|
||||
$newanswer->response = clean_param(trim($form->response[$i]), PARAM_CLEANHTML);
|
||||
$newanswer->response = addslashes($newanswer->response);
|
||||
$newanswer->response = addslashes($newanswer->response);
|
||||
}
|
||||
if (isset($form->jumpto[$i])) {
|
||||
$newanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT);
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
/// CDC-FLAG ///
|
||||
$page->title = clean_param($form->title, PARAM_CLEANHTML);
|
||||
$page->contents = clean_param(trim($form->contents), PARAM_CLEANHTML);
|
||||
$page->title = addslashes($page->title);
|
||||
$page->contents = addslashes($page->contents);
|
||||
$page->title = addslashes($page->title);
|
||||
$page->contents = addslashes($page->contents);
|
||||
if (!update_record("lesson_pages", $page)) {
|
||||
error("Update page: page not updated");
|
||||
}
|
||||
|
@ -80,10 +80,10 @@
|
|||
clean_param($form->responseeditor[$i], PARAM_INT) * LESSON_RESPONSE_EDITOR;
|
||||
$oldanswer->timemodified = $timenow;
|
||||
$oldanswer->answer = clean_param(trim($form->answer[$i]), PARAM_CLEANHTML);
|
||||
$oldanswer->answer = addslashes($oldanswer->answer);
|
||||
$oldanswer->answer = addslashes($oldanswer->answer);
|
||||
if (isset($form->response[$i])) {
|
||||
$oldanswer->response = clean_param(trim($form->response[$i]), PARAM_CLEANHTML);
|
||||
$oldanswer->response = addslashes($oldanswer->response);
|
||||
$oldanswer->response = addslashes($oldanswer->response);
|
||||
}
|
||||
$oldanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT);
|
||||
/// CDC-FLAG ///
|
||||
|
@ -103,10 +103,10 @@
|
|||
clean_param($form->responseeditor[$i], PARAM_INT) * LESSON_RESPONSE_EDITOR;
|
||||
$newanswer->timecreated = $timenow;
|
||||
$newanswer->answer = clean_param(trim($form->answer[$i]), PARAM_CLEANHTML);
|
||||
$newanswer->answer = addslashes($newanswer->answer);
|
||||
$newanswer->answer = addslashes($newanswer->answer);
|
||||
if (isset($form->response[$i])) {
|
||||
$newanswer->response = clean_param(trim($form->response[$i]), PARAM_CLEANHTML);
|
||||
$newanswer->answer = addslashes($newanswer->answer);
|
||||
$newanswer->answer = addslashes($newanswer->answer);
|
||||
}
|
||||
$newanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT);
|
||||
/// CDC-FLAG ///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue