mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +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 ///
|
||||
|
|
|
@ -57,13 +57,13 @@
|
|||
"$navigation <a href=index.php?id=$course->id>$strlessons</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">".format_string($lesson->name,true)."</a>", "", "", true);
|
||||
|
||||
// include the appropriate action (check to make sure the file is there first)
|
||||
if (file_exists($CFG->dirroot.'/mod/lesson/action/'.$action.'.php')) {
|
||||
include($CFG->dirroot.'/mod/lesson/action/'.$action.'.php');
|
||||
} else {
|
||||
error("Fatal Error: Unknown action\n");
|
||||
}
|
||||
|
||||
// include the appropriate action (check to make sure the file is there first)
|
||||
if (file_exists($CFG->dirroot.'/mod/lesson/action/'.$action.'.php')) {
|
||||
include($CFG->dirroot.'/mod/lesson/action/'.$action.'.php');
|
||||
} else {
|
||||
error("Fatal Error: Unknown action\n");
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
|
|
|
@ -35,10 +35,10 @@ function lesson_add_instance($lesson) {
|
|||
unset($lesson->password);
|
||||
}
|
||||
/// CDC-FLAG ///
|
||||
if (!$lesson->id = insert_record("lesson", $lesson)) {
|
||||
return false; // bad
|
||||
}
|
||||
|
||||
if (!$lesson->id = insert_record("lesson", $lesson)) {
|
||||
return false; // bad
|
||||
}
|
||||
|
||||
if ($lesson->lessondefault) {
|
||||
$lessondefault = $lesson;
|
||||
unset($lessondefault->lessondefault);
|
||||
|
@ -130,8 +130,8 @@ function lesson_update_instance($lesson) {
|
|||
unset($lesson->lessondefault);
|
||||
}
|
||||
|
||||
// update the calendar events (credit goes to quiz module)
|
||||
if ($events = get_records_select('event', "modulename = 'lesson' and instance = '$lesson->id'")) {
|
||||
// update the calendar events (credit goes to quiz module)
|
||||
if ($events = get_records_select('event', "modulename = 'lesson' and instance = '$lesson->id'")) {
|
||||
foreach($events as $event) {
|
||||
delete_event($event->id);
|
||||
}
|
||||
|
@ -249,13 +249,13 @@ function lesson_delete_instance($id) {
|
|||
if (! delete_records("lesson_high_scores", "lessonid", "$lesson->id")) {
|
||||
$result = false;
|
||||
}
|
||||
if ($events = get_records_select('event', "modulename = 'lesson' and instance = '$lesson->id'")) {
|
||||
if ($events = get_records_select('event', "modulename = 'lesson' and instance = '$lesson->id'")) {
|
||||
foreach($events as $event) {
|
||||
delete_event($event->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*******************************************************************/
|
||||
|
|
|
@ -1027,12 +1027,11 @@ function lesson_calculate_ongoing_score($lesson, $userid, $retries, $return=fals
|
|||
}
|
||||
}
|
||||
$nviewed = count($temp); // this counts number of Questions the user viewed
|
||||
if ($nviewed != 0) {
|
||||
$thegrade = intval(100 * $ncorrect / $nviewed);
|
||||
} else {
|
||||
$thegrade = 0;
|
||||
}
|
||||
|
||||
if ($nviewed != 0) {
|
||||
$thegrade = intval(100 * $ncorrect / $nviewed);
|
||||
} else {
|
||||
$thegrade = 0;
|
||||
}
|
||||
|
||||
if ($return) {
|
||||
return $thegrade;
|
||||
|
@ -1113,15 +1112,15 @@ function lesson_calculate_ongoing_score($lesson, $userid, $retries, $return=fals
|
|||
/*******************************************************************/
|
||||
function lesson_qtype_menu($qtypes, $selected="", $link="", $onclick="") {
|
||||
// prints the question types for when editing and adding a page
|
||||
$tabs = array();
|
||||
$tabrows = array();
|
||||
|
||||
$tabs = array();
|
||||
$tabrows = array();
|
||||
|
||||
foreach ($qtypes as $qtype => $qtypename) {
|
||||
$tabrows[] = new tabobject($qtype, "$link&qtype=$qtype\" onClick=\"$onclick\"", $qtypename);
|
||||
$tabrows[] = new tabobject($qtype, "$link&qtype=$qtype\" onClick=\"$onclick\"", $qtypename);
|
||||
}
|
||||
$tabs[] = $tabrows;
|
||||
print_tabs($tabs, $selected);
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$selected\" /> \n";
|
||||
$tabs[] = $tabrows;
|
||||
print_tabs($tabs, $selected);
|
||||
echo "<input type=\"hidden\" name=\"qtype\" value=\"$selected\" /> \n";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -163,8 +163,8 @@
|
|||
$tries = $studentdata[$student->id];
|
||||
$studentname = "{$student->lastname}, $student->firstname";
|
||||
foreach ($tries as $try) {
|
||||
// start to build up the link
|
||||
$temp = "<a href=\"report.php?id=$cm->id&action=detail&userid=".$try["userid"]."&try=".$try["try"]."\">";
|
||||
// start to build up the link
|
||||
$temp = "<a href=\"report.php?id=$cm->id&action=detail&userid=".$try["userid"]."&try=".$try["try"]."\">";
|
||||
if ($try["grade"] != NULL) { // if NULL then not done yet
|
||||
// this is what the link does when the user has completed the try
|
||||
$timetotake = $try["timeend"] - $try["timestart"];
|
||||
|
@ -210,7 +210,7 @@
|
|||
$table->data[] = array($studentname, $attempts, $bestgrade."%");
|
||||
}
|
||||
}
|
||||
// print it all out !
|
||||
// print it all out !
|
||||
print_table($table);
|
||||
|
||||
// some stat calculations
|
||||
|
@ -783,7 +783,7 @@
|
|||
}
|
||||
$answerpages[] = $answerpage;
|
||||
}
|
||||
$pageid = $page->nextpageid;
|
||||
$pageid = $page->nextpageid;
|
||||
}
|
||||
|
||||
/// actually start printing something
|
||||
|
@ -798,18 +798,18 @@
|
|||
$table->align = array("right", "left");
|
||||
$table->size = array("*", "*");
|
||||
|
||||
if (!$grades = get_records_select("lesson_grades", "lessonid = $lesson->id and userid = $userid", "completed", "*", $try, 1)) {
|
||||
$grade = -1;
|
||||
} else {
|
||||
$grade = current($grades);
|
||||
$grade = $grade->grade;
|
||||
}
|
||||
if (!$times = get_records_select("lesson_timer", "lessonid = $lesson->id and userid = $userid", "starttime", "*", $try, 1)) {
|
||||
$timetotake = -1;
|
||||
} else {
|
||||
$timetotake = current($times);
|
||||
$timetotake = $timetotake->lessontime - $timetotake->starttime;
|
||||
}
|
||||
if (!$grades = get_records_select("lesson_grades", "lessonid = $lesson->id and userid = $userid", "completed", "*", $try, 1)) {
|
||||
$grade = -1;
|
||||
} else {
|
||||
$grade = current($grades);
|
||||
$grade = $grade->grade;
|
||||
}
|
||||
if (!$times = get_records_select("lesson_timer", "lessonid = $lesson->id and userid = $userid", "starttime", "*", $try, 1)) {
|
||||
$timetotake = -1;
|
||||
} else {
|
||||
$timetotake = current($times);
|
||||
$timetotake = $timetotake->lessontime - $timetotake->starttime;
|
||||
}
|
||||
|
||||
if ($timetotake == -1 || $completed == -1 || $grade == -1) {
|
||||
$table->align = array("center");
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
var my12_hour = 1;
|
||||
var stopclock = 0;
|
||||
var myclock = '';
|
||||
var timeleft, hours, minutes, secs;
|
||||
var timeleft, hours, minutes, secs;
|
||||
var javatimeDate = new Date();
|
||||
var javatime = javatimeDate.getTime();
|
||||
javatime = Math.floor(javatime/1000);
|
||||
|
@ -35,15 +35,15 @@
|
|||
starttime = starttime + difference;
|
||||
|
||||
var dn = "";
|
||||
var old = "";
|
||||
var old = "";
|
||||
|
||||
if (document.all||document.getElementById) {
|
||||
document.write('<span id="LiveClockIE" style="width:'+mywidth+'px;"></span>');
|
||||
} else if (document.layers) {
|
||||
document.write('<ilayer id="ClockPosNS"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>');
|
||||
} else {
|
||||
old = "true"; show_clock();
|
||||
}
|
||||
document.write('<span id="LiveClockIE" style="width:'+mywidth+'px;"></span>');
|
||||
} else if (document.layers) {
|
||||
document.write('<ilayer id="ClockPosNS"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>');
|
||||
} else {
|
||||
old = "true"; show_clock();
|
||||
}
|
||||
|
||||
/*function leave() { // feable attempt to run a script when someone leaves a timed test early, failed so far
|
||||
window.onunload = window.open('http://www.google.com','','toolbar=no,menubar=no,location=no,height=500,width=500');
|
||||
|
@ -69,10 +69,10 @@
|
|||
stopclock = 1;
|
||||
} else {
|
||||
timeleft = starttime + testlength - current;
|
||||
hours = Math.floor(timeleft/3600);
|
||||
timeleft = timeleft - (hours * 3600);
|
||||
minutes = Math.floor(timeleft/60);
|
||||
secs = timeleft - (minutes * 60);
|
||||
hours = Math.floor(timeleft/3600);
|
||||
timeleft = timeleft - (hours * 3600);
|
||||
minutes = Math.floor(timeleft/60);
|
||||
secs = timeleft - (minutes * 60);
|
||||
|
||||
if (secs < 10) {
|
||||
secs = "0"+secs;
|
||||
|
|
|
@ -182,31 +182,30 @@
|
|||
}
|
||||
break; // only look at the latest correct attempt
|
||||
}
|
||||
} else {
|
||||
$attempts = NULL;
|
||||
}
|
||||
} else {
|
||||
$attempts = NULL;
|
||||
}
|
||||
|
||||
if ($branchtables = get_records_select('lesson_branch',
|
||||
"lessonid = $lesson->id AND userid = $USER->id AND retry = $retries", 'timeseen DESC')) {
|
||||
// in here, user has viewed a branch table
|
||||
$lastbranchtable = current($branchtables);
|
||||
if ($attempts != NULL) {
|
||||
foreach($attempts as $attempt) {
|
||||
if ($lastbranchtable->timeseen > $attempt->timeseen) {
|
||||
// branch table was viewed later than the last attempt
|
||||
$lastpageseen = $lastbranchtable->pageid;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// hasnt answered any questions but has viewed a branch table
|
||||
$lastpageseen = $lastbranchtable->pageid;
|
||||
}
|
||||
|
||||
}
|
||||
if ($branchtables = get_records_select('lesson_branch',
|
||||
"lessonid = $lesson->id AND userid = $USER->id AND retry = $retries", 'timeseen DESC')) {
|
||||
// in here, user has viewed a branch table
|
||||
$lastbranchtable = current($branchtables);
|
||||
if ($attempts != NULL) {
|
||||
foreach($attempts as $attempt) {
|
||||
if ($lastbranchtable->timeseen > $attempt->timeseen) {
|
||||
// branch table was viewed later than the last attempt
|
||||
$lastpageseen = $lastbranchtable->pageid;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// hasnt answered any questions but has viewed a branch table
|
||||
$lastpageseen = $lastbranchtable->pageid;
|
||||
}
|
||||
}
|
||||
//if ($lastpageseen != $firstpageid) {
|
||||
if (isset($lastpageseen) and count_records('lesson_attempts', 'lessonid', $lesson->id, 'userid', $USER->id, 'retry', $retries) > 0) {
|
||||
// get the first page
|
||||
// get the first page
|
||||
if (!$firstpageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id,
|
||||
'prevpageid', 0)) {
|
||||
error('Navigation: first page not found');
|
||||
|
@ -223,7 +222,7 @@
|
|||
echo '<p align="center"><input type="button" value="'. get_string('continue', 'lesson').
|
||||
"\" onclick=\"document.queryform.pageid.value='$firstpageid';document.queryform.startlastseen.value='no';document.queryform.submit();\" /></p>\n"; /// CDC-FLAG added document.queryform.startlastseen.value='yes'
|
||||
echo '</form>' . "\n";
|
||||
echo '</div></div>';///CDC Chris Berri added close div tag
|
||||
echo '</div></div>';///CDC Chris Berri added close div tag
|
||||
} else {
|
||||
print_simple_box_start('center');
|
||||
echo '<div align="center">';
|
||||
|
@ -247,7 +246,7 @@
|
|||
echo "</form>\n"; echo "</div></div>";///CDC Chris Berri added close div tag
|
||||
}
|
||||
print_footer($course);
|
||||
exit();
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($grades) {
|
||||
|
@ -1065,7 +1064,7 @@
|
|||
// after all the grade processing, check to see if "Show Grades" is off for the course
|
||||
// if yes, redirect to the course page
|
||||
if (!$course->showgrades) {
|
||||
redirect($CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
redirect($CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
}
|
||||
|
||||
///CDC-FLAG /// high scores code
|
||||
|
@ -1133,54 +1132,54 @@
|
|||
elseif ($action == 'teacherview') {
|
||||
/// CDC-FLAG /// link to grade essay questions and to report
|
||||
if ($userattempts = get_records("lesson_attempts", "lessonid", $lesson->id)) { // just check to see if anyone has answered any questions.
|
||||
$usercount = array();
|
||||
foreach ($userattempts as $userattempts) {
|
||||
$usercount[$userattempts->userid] = 0;
|
||||
}
|
||||
$a = new stdClass;
|
||||
$a->users = count($usercount);
|
||||
$a->usersname = $course->students;
|
||||
echo "<div align=\"right\"><a href=\"report.php?id=$cm->id\">".get_string("viewlessonstats", "lesson", $a)."</a></div>";
|
||||
}
|
||||
$usercount = array();
|
||||
foreach ($userattempts as $userattempts) {
|
||||
$usercount[$userattempts->userid] = 0;
|
||||
}
|
||||
$a = new stdClass;
|
||||
$a->users = count($usercount);
|
||||
$a->usersname = $course->students;
|
||||
echo "<div align=\"right\"><a href=\"report.php?id=$cm->id\">".get_string("viewlessonstats", "lesson", $a)."</a></div>";
|
||||
}
|
||||
if ($essaypages = get_records_select("lesson_pages", "lessonid = $lesson->id AND qtype = ".LESSON_ESSAY)) { // get pages that are essay
|
||||
// get only the attempts that are in response to essay questions
|
||||
$essaypageids = implode(",", array_keys($essaypages)); // all the pageids in comma seperated list
|
||||
if ($essayattempts = get_records_select("lesson_attempts", "lessonid = $lesson->id AND pageid IN($essaypageids)")) {
|
||||
$studentessays = array();
|
||||
// makes an array that organizes essayattempts by grouping userid, then pageid, then try count
|
||||
foreach ($essayattempts as $essayattempt) {
|
||||
$studentessays[$essayattempt->userid][$essayattempt->pageid][$essayattempt->retry][] = $essayattempt;
|
||||
}
|
||||
$a = new stdClass;
|
||||
$a->notgradedcount = 0;
|
||||
$a->notsentcount = 0;
|
||||
foreach ($studentessays as $pages) { // students
|
||||
foreach ($pages as $tries) { // pages
|
||||
// go through each essay per page
|
||||
foreach($tries as $try) { // actual attempts
|
||||
// make sure they didn't answer it more than the max number of attmepts
|
||||
if (count($try) > $lesson->maxattempts) {
|
||||
$essay = $try[$lesson->maxattempts-1];
|
||||
} else {
|
||||
$essay = end($try);
|
||||
}
|
||||
$essayinfo = unserialize($essay->useranswer);
|
||||
if ($essayinfo->graded == 0) {
|
||||
$a->notgradedcount++;
|
||||
}
|
||||
if ($essayinfo->sent == 0) {
|
||||
$a->notsentcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "<div align=\"right\"><a href=\"view.php?id=$cm->id&action=essayview\">".get_string("gradeessay", "lesson", $a)."</a></div><br />";
|
||||
}
|
||||
}
|
||||
// get only the attempts that are in response to essay questions
|
||||
$essaypageids = implode(",", array_keys($essaypages)); // all the pageids in comma seperated list
|
||||
if ($essayattempts = get_records_select("lesson_attempts", "lessonid = $lesson->id AND pageid IN($essaypageids)")) {
|
||||
$studentessays = array();
|
||||
// makes an array that organizes essayattempts by grouping userid, then pageid, then try count
|
||||
foreach ($essayattempts as $essayattempt) {
|
||||
$studentessays[$essayattempt->userid][$essayattempt->pageid][$essayattempt->retry][] = $essayattempt;
|
||||
}
|
||||
$a = new stdClass;
|
||||
$a->notgradedcount = 0;
|
||||
$a->notsentcount = 0;
|
||||
foreach ($studentessays as $pages) { // students
|
||||
foreach ($pages as $tries) { // pages
|
||||
// go through each essay per page
|
||||
foreach($tries as $try) { // actual attempts
|
||||
// make sure they didn't answer it more than the max number of attmepts
|
||||
if (count($try) > $lesson->maxattempts) {
|
||||
$essay = $try[$lesson->maxattempts-1];
|
||||
} else {
|
||||
$essay = end($try);
|
||||
}
|
||||
$essayinfo = unserialize($essay->useranswer);
|
||||
if ($essayinfo->graded == 0) {
|
||||
$a->notgradedcount++;
|
||||
}
|
||||
if ($essayinfo->sent == 0) {
|
||||
$a->notsentcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "<div align=\"right\"><a href=\"view.php?id=$cm->id&action=essayview\">".get_string("gradeessay", "lesson", $a)."</a></div><br />";
|
||||
}
|
||||
}
|
||||
|
||||
print_heading_with_help(format_string($lesson->name,true), "overview", "lesson");
|
||||
|
||||
// get number of pages
|
||||
// get number of pages
|
||||
if ($page = get_record_select("lesson_pages", "lessonid = $lesson->id AND prevpageid = 0")) {
|
||||
$npages = 1;
|
||||
while (true) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue