NEW: Progress bar option. Now a progress bar can be optionally displayed at the bottom of the lesson page.

NEW: Display Left Menu IF.  The left menu will only display if the student has a grade better than the one set in the lesson settings.  This is nice to allow only students who are reviewing the lesson to have access to the left menu.

BUG FIX: In Windows IE, the content was being aligned center.  Now, the content is explicitly aligned to left as default.
BUG FIX: High Scores variable was not spelled correctly at the End of Lesson.

ADDED: Div tags around branch tables.  This will allow users to choose to display them or not or move them around

CHANGED: converted more of the links to the stylized button.  Also, removed a lot of forms and javascript and replaced it with links with the variables in the href.
CHANGED: the slide show styles have been moved to the style sheet.
CHANGED: removed the CDC comments

Other minor changes have been made to the code as well.
This commit is contained in:
michaelpenne
2005-10-24 23:06:43 +00:00
parent 96074defc5
commit 62eda6ea18
17 changed files with 387 additions and 204 deletions

View File

@@ -11,7 +11,6 @@
$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");
@@ -29,7 +28,6 @@
}
}
}
//// CDC-FLAG /////
// give teacher a blank proforma
print_heading_with_help(get_string("addabranchtable", "lesson"), "overview", "lesson");
?>
@@ -42,14 +40,13 @@
<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>
<!-- 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";
@@ -57,7 +54,6 @@
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";

View File

@@ -13,7 +13,6 @@
$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");
@@ -22,7 +21,6 @@
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");
@@ -67,7 +65,7 @@
} 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.
echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>";
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo '</p>';
}
@@ -75,14 +73,14 @@
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.
echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>";
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>
<!-- 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";
@@ -109,7 +107,6 @@
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\">";
@@ -117,7 +114,6 @@
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
}
}
/// CDC-FLAG ///
echo "</td></tr>\n";
}
break;
@@ -189,7 +185,6 @@
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\">";
@@ -197,7 +192,6 @@
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
}
}
/// CDC-FLAG ///
echo "</td></tr>\n";
}
break;
@@ -220,7 +214,6 @@
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\">";
@@ -228,7 +221,6 @@
echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
}
}
/// CDC-FLAG ///
echo "</td></tr>\n";
}
}

View File

@@ -4,6 +4,8 @@
confirm_sesskey();
// left menu code
// check to see if the user can see the left menu
$lesson->displayleft = lesson_displayleftif($lesson);
if ($lesson->displayleft) {
if($firstpageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0)) {
// print the pages
@@ -26,7 +28,7 @@
}
}
/// CDC-FLAG /// 6/21/04 This is the warning msg for teachers to inform them that cluster and unseen does not work while logged in as a teacher
// This is the warning msg for teachers to inform them that cluster and unseen does not work while logged in as a teacher
if(isteacher($course->id)) {
if (execute_teacherwarning($lesson->id)) {
$warningvars->cluster = get_string("clusterjump", "lesson");
@@ -34,9 +36,8 @@
echo "<p align=\"center\">".get_string("teacherjumpwarning", "lesson", $warningvars)."</p>";
}
}
/// CDC-FLAG ///
/// CDC-FLAG /// 6/14/04 -- This is the code updates the lesson time for a timed test
// This is the code updates the lesson time for a timed test
// get time information for this user
if (!isteacher($course->id)) {
if (!$timer = get_records_select('lesson_timer', "lessonid = $lesson->id AND userid = $USER->id", 'starttime')) {
@@ -84,7 +85,6 @@
error("Error: could not update lesson_timer table");
}
}
/// CDC-FLAG ///
// record answer (if necessary) and show response (if none say if answer is correct or not)
if (empty($_POST['pageid'])) {
@@ -101,7 +101,6 @@
$isessayquestion = false; // use this to turn off review button on essay questions
$newpageid = 0; // stay on the page
switch ($page->qtype) {
/// CDC-FLAG ///
case LESSON_ESSAY :
$isessayquestion = true;
if (!$useranswer = $_POST['answer']) {
@@ -209,7 +208,6 @@
if (lesson_iscorrect($pageid, $answer->jumpto)) {
$correctanswer = true;
}
/* CDC-FLAG */
if ($lesson->custom) {
if ($answer->score > 0) {
$correctanswer = true;
@@ -217,7 +215,6 @@
$correctanswer = false;
}
}
/// CDC-FLAG 6/21/04 ///
$newpageid = $answer->jumpto;
if (!$response = trim($answer->response)) {
if ($correctanswer) {
@@ -250,7 +247,7 @@
$nhits = 0;
$correctresponse = '';
$wrongresponse = '';
/// CDC-FLAG /// 6/11/04 this is for custom scores. If score on answer is positive, it is correct
// this is for custom scores. If score on answer is positive, it is correct
if ($lesson->custom) {
$ncorrect = 0;
$nhits = 0;
@@ -315,7 +312,6 @@
}
}
}
/// CDC-FLAG ///
if ((count($useranswers) == $ncorrect) and ($nhits == $ncorrect)) {
$correctanswer = true;
if (!$response = $correctresponse) {
@@ -341,7 +337,6 @@
if (lesson_iscorrect($pageid, $answer->jumpto)) {
$correctanswer = true;
}
/* CDC-FLAG */
if ($lesson->custom) {
if ($answer->score > 0) {
$correctanswer = true;
@@ -349,7 +344,6 @@
$correctanswer = false;
}
}
/// CDC-FLAG ///
$newpageid = $answer->jumpto;
if (!$response = trim($answer->response)) {
if ($correctanswer) {
@@ -360,8 +354,6 @@
}
}
break;
/// CDC-FLAG /// 6/14/04 -- added responses
case LESSON_MATCHING :
if (isset($_POST['response']) && is_array($_POST['response'])) { // only arrays should be submitted
$response = array();
@@ -417,7 +409,6 @@
break;
}
}
// NoticeFix
if (isset($correctpageid)) {
$newpageid = $correctpageid;
}
@@ -441,7 +432,6 @@
$answerid = $wronganswerid;
}
break;
/// CDC-FLAG ///
case LESSON_NUMERICAL :
// set defaults
@@ -475,7 +465,6 @@
if (lesson_iscorrect($pageid, $newpageid)) {
$correctanswer = true;
}
/// CDC-FLAG ///
if ($lesson->custom) {
if ($answer->score > 0) {
$correctanswer = true;
@@ -484,7 +473,6 @@
$correctanswer = false;
}
}
/// CDC-FLAG ///
break;
}
}
@@ -502,7 +490,7 @@
case LESSON_BRANCHTABLE:
$noanswer = false;
$newpageid = optional_param('jumpto', NULL, PARAM_INT);
/// CDC-FLAG /// 6/15/04 going to insert into lesson_branch
// going to insert into lesson_branch
if ($newpageid == LESSON_RANDOMBRANCH) {
$branchflag = 1;
} else {
@@ -525,17 +513,15 @@
if (!insert_record("lesson_branch", $branch)) {
error("Error: could not insert row into lesson_branch table");
}
/// CDC-FLAG ///
/// CDC-FLAG /// this is called when jumping to random from a branch table
// this is called when jumping to random from a branch table
if($newpageid == LESSON_UNSEENBRANCHPAGE) {
if (isteacher($course->id)) {
$newpageid = LESSON_NEXTPAGE;
} else {
$newpageid = lesson_unseen_question_jump($lesson->id, $USER->id, $pageid); // this may return 0 //CDC Chris Berri.....this is where it sets the next page id for unseen?
$newpageid = lesson_unseen_question_jump($lesson->id, $USER->id, $pageid); // this may return 0
}
}
/// CDC-FLAG 6/15/04 ///
// convert jumpto page into a proper page id
if ($newpageid == 0) {
$newpageid = $pageid;
@@ -544,14 +530,13 @@
// no nextpage go to end of lesson
$newpageid = LESSON_EOL;
}
/* CDC-FLAG */ } elseif ($newpageid == LESSON_PREVIOUSPAGE) {
} elseif ($newpageid == LESSON_PREVIOUSPAGE) {
$newpageid = $page->prevpageid;
} elseif ($newpageid == LESSON_RANDOMPAGE) {
$newpageid = lesson_random_question_jump($lesson->id, $pageid);
} elseif ($newpageid == LESSON_RANDOMBRANCH) { // 6/15/04
} elseif ($newpageid == LESSON_RANDOMBRANCH) {
$newpageid = lesson_unseen_branch_jump($lesson->id, $USER->id);
}
/// CDC-FLAG ///
// no need to record anything in lesson_attempts
redirect("view.php?id=$cm->id&amp;action=navigation&amp;pageid=$newpageid");
print_footer($course);
@@ -577,7 +562,7 @@
$attempt->useranswer = $userresponse;
}
$attempt->timeseen = time();
/// CDC-FLAG /// -- dont want to insert the attempt if they ran out of time
// dont want to insert the attempt if they ran out of time
if (!$outoftime) {
// if allow modattempts, then update the old attempt record, otherwise, insert new answer record
if (isset($USER->modattempts[$lesson->id])) {
@@ -587,7 +572,6 @@
error("Continue: attempt not inserted");
}
}
/// CDC-FLAG ///
if (!$correctanswer and ($newpageid == 0)) {
// wrong answer and student is stuck on this page - check how many attempts
// the student has had at this page/question
@@ -657,7 +641,7 @@
}
}
/// CDC-FLAG 6/21/04 /// this calculates the ongoing score
// this calculates the ongoing score
if ($lesson->ongoing) {
if (isteacher($course->id)) {
echo "<div align=\"center\">".get_string("teacherongoingwarning", "lesson")."</div><br>";
@@ -669,7 +653,6 @@
lesson_calculate_ongoing_score($lesson, $USER->id, $ntries);
}
}
/// CDC-FLAG ///
// display response (if there is one - there should be!)
if ($response) {
@@ -694,7 +677,7 @@
}
}
/// CDC-FLAG 6/18/04 /// - this is where some jump numbers are interpreted
// this is where some jump numbers are interpreted
if($outoftime) {
$newpageid = LESSON_EOL; // ran out of time for the test, so go to eol
} elseif (isset($USER->modattempts[$lesson->id])) {
@@ -761,6 +744,7 @@
}
}
// NOTE: Should this code be coverted from form/javascript to just longer links with the variables in the url?
echo "<form name=\"pageform\" method =\"post\" action=\"view.php\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"navigation\">\n";

View File

@@ -20,7 +20,6 @@
$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");
@@ -32,7 +31,6 @@
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");
@@ -42,7 +40,7 @@
if (!$apage = get_record("lesson_pages", "id", $apageid)) {
error("Edit page: apage record not found");
}
/// CDC-FLAG /// 6/15/04 removed != LESSON_ENDOFBRANCH...
// removed != LESSON_ENDOFBRANCH...
if (trim($page->title)) { // ...nor nuffin pages
$jump[$apageid] = strip_tags(format_string($apage->title,true));
}
@@ -71,9 +69,9 @@
"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.
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\"/>";
} else {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>";
}
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo "</p>\n";
@@ -86,9 +84,9 @@
"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.
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\"/>";
} else {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>";
}
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo "</p>\n";
@@ -108,7 +106,7 @@
<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>
<!-- 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>";
@@ -120,7 +118,6 @@
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) {
@@ -137,7 +134,6 @@
}
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 :
@@ -167,14 +163,14 @@
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.
checked=\"checked\">";
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.
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">";
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
echo "]<br />\n";
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
@@ -184,14 +180,14 @@
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.
checked=\"checked\">";
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.
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">";
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
echo "]<br />\n";
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
@@ -202,14 +198,14 @@
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.
checked=\"checked\">";
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.
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">";
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
echo "]<br />\n";
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
@@ -219,14 +215,14 @@
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.
checked=\"checked\">";
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.
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\">";
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
echo "]<br />\n";
print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
@@ -242,14 +238,14 @@
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.
checked=\"checked\">";
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.
"<label for=\"answereditor[$n]\" class=\"hidden-label\">answereditor[$n]</label><input type=\"checkbox\" id=\answereditor[$n]\" name=\"answereditor[$n]\" value=\"1\">";
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
echo "]<br />\n";
print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer);
@@ -259,14 +255,14 @@
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.
checked=\"checked\">";
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.
"<label for=\"responseeditor[$n]\" class=\"hidden-label\">responseeditor[$n]</label><input type=\"checkbox\" id=\"responseeditor[$n]\" name=\"responseeditor[$n]\" value=\"1\">";
helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson");
echo "]<br />\n";
print_textarea(false, 6, 70, 630, 300, "response[$n]", $answer->response);
@@ -278,11 +274,11 @@
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.
checked=\"checked\">";
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
use_html_editor("answer[$n]"); // switch on the editor
} else {
echo " [".get_string("useeditor", "lesson").": ".
"<input type=\"checkbox\" name=\"answereditor[$n]\" value=\"1\">";
@@ -348,7 +344,7 @@
}
}
}
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_ENDOFBRANCH && $page->qtype != LESSON_CLUSTER && $page->qtype != LESSON_ENDOFCLUSTER) {
if ($page->qtype == LESSON_MATCHING) {
$maxanswers = $lesson->maxanswers + 2;
} else {

View File

@@ -28,7 +28,6 @@
} else {
$newpage->qoption = 0;
}
/// CDC-FLAG /// 6/16/04
if (isset($form->layout)) {
$newpage->layout = clean_param($form->layout, PARAM_INT);
} else {
@@ -39,7 +38,6 @@
} else {
$newpage->display = 0;
}
/// CDC-FLAG ///
$newpage->title = clean_param($form->title, PARAM_CLEANHTML);
$newpage->contents = trim($form->contents);
$newpage->title = addslashes($newpage->title);
@@ -72,7 +70,6 @@
} else {
$newpage->qoption = 0;
}
/// CDC-FLAG /// 6/16/04
if (isset($form->layout)) {
$newpage->layout = clean_param($form->layout, PARAM_INT);
} else {
@@ -83,7 +80,6 @@
} else {
$newpage->display = 0;
}
/// CDC-FLAG ///
$newpage->title = clean_param($form->title, PARAM_CLEANHTML);
$newpage->contents = trim($form->contents);
$newpage->title = addslashes($newpage->title);
@@ -103,7 +99,6 @@
} else {
$newpage->qoption = 0;
}
/// CDC-FLAG /// 6/16/04
if (isset($form->layout)) {
$newpage->layout = clean_param($form->layout, PARAM_INT);
} else {
@@ -114,7 +109,6 @@
} else {
$newpage->display = 0;
}
/// CDC-FLAG ///
$newpage->title = clean_param($form->title, PARAM_CLEANHTML);
$newpage->contents = trim($form->contents);
$newpage->title = addslashes($newpage->title);
@@ -129,7 +123,6 @@
}
}
// now add the answers
/// CDC-FLAG 6/16/04 added new code to handle essays
if ($form->qtype == LESSON_ESSAY) {
$newanswer->lessonid = $lesson->id;
$newanswer->pageid = $newpageid;
@@ -161,13 +154,11 @@
if (isset($form->jumpto[$i])) {
$newanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT);
}
/// CDC-FLAG ///
if ($lesson->custom) {
if (isset($form->score[$i])) {
$newanswer->score = clean_param($form->score[$i], PARAM_INT);
}
}
/// CDC-FLAG ///
$newanswerid = insert_record("lesson_answers", $newanswer);
if (!$newanswerid) {
error("Insert Page: answer record $i not inserted");
@@ -189,6 +180,6 @@
}
}
}
/// CDC-FLAG ///
redirect("view.php?id=$cm->id", get_string('insertedpage', 'lesson'));
?>

View File

@@ -20,7 +20,6 @@
} else {
$page->qoption = 0;
}
/// CDC-FLAG /// 6/16/04
if (isset($form->layout)) {
$page->layout = clean_param($form->layout, PARAM_INT);
} else {
@@ -31,7 +30,6 @@
} else {
$page->display = 0;
}
/// CDC-FLAG ///
$page->title = clean_param($form->title, PARAM_CLEANHTML);
$page->contents = trim($form->contents);
$page->title = addslashes($page->title);
@@ -86,11 +84,9 @@
$oldanswer->response = '';
}
$oldanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT);
/// CDC-FLAG ///
if ($lesson->custom) {
$oldanswer->score = clean_param($form->score[$i], PARAM_INT);
}
/// CDC-FLAG ///
if (!update_record("lesson_answers", $oldanswer)) {
error("Update page: answer $i not updated");
}
@@ -107,9 +103,7 @@
$newanswer->response = trim($form->response[$i]);
}
$newanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT);
/// CDC-FLAG ///
$newanswer->score = clean_param($form->score[$i], PARAM_INT);
/// CDC-FLAG ///
$newanswerid = insert_record("lesson_answers", $newanswer);
if (!$newanswerid) {
error("Update page: answer record not inserted");

View File

@@ -202,6 +202,11 @@ function lesson_upgrade($oldversion) {
table_column('lesson', '', 'conditions', 'text', '', '', '', 'not null', 'dependency');
}
if ($oldversion < 2005101900) {
table_column('lesson', '', 'progressbar', 'tinyint', '3', 'unsigned', '0', 'not null', 'displayleft');
table_column('lesson', '', 'displayleftif', 'int', '3', 'unsigned', '0', 'not null', 'displayleft');
}
return true;
}

View File

@@ -34,6 +34,8 @@ CREATE TABLE `prefix_lesson` (
`height` INT(10) UNSIGNED NOT NULL DEFAULT '480',
`bgcolor` CHAR(7) NOT NULL DEFAULT '#FFFFFF',
`displayleft` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`displayleftif` INT(3) UNSIGNED NOT NULL DEFAULT '0',
`progressbar` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`highscores` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`maxhighscores` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`available` int(10) unsigned NOT NULL default '0',

View File

@@ -283,6 +283,11 @@ function lesson_upgrade($oldversion) {
table_column('lesson', '', 'conditions', 'text', '', '', '', 'not null', 'dependency');
}
if ($oldversion < 2005101900) {
table_column('lesson', '', 'progressbar', 'INT', '3', 'unsigned', '0', 'not null', 'displayleft');
table_column('lesson', '', 'displayleftif', 'INT', '3', 'unsigned', '0', 'not null', 'displayleft');
}
return true;
}

View File

@@ -28,6 +28,8 @@ CREATE TABLE prefix_lesson (
height INT8 NOT NULL DEFAULT '480',
bgcolor VARCHAR(7) NOT NULL DEFAULT '#FFFFFF',
displayleft INT NOT NULL DEFAULT '0',
displayleftif INT NOT NULL DEFAULT '0',
progressbar INT NOT NULL DEFAULT '0',
highscores INT NOT NULL DEFAULT '0',
maxhighscores INT8 NOT NULL DEFAULT '0',
available INT8 NOT NULL default '0',

View File

@@ -5,7 +5,7 @@
addbranchtable
addendofbranch
addcluster /// CDC-FLAG /// added two new items
addcluster
addendofcluster
addpage
confirmdelete

View File

@@ -1,5 +1,5 @@
<?PHP // $Id$
// modified by mnielsen @ CDC
// modified by mnielsen
/// Update: The lib.php now contains only the functions that are
/// used outside of the lesson module. All functions (I hope) that are only local
/// are now in locallib.php.
@@ -429,7 +429,7 @@ function lesson_grades($lessonid) {
}
// convert grades from percentages and tidy the numbers
if (!$lesson->practice) { // dont display practice lessons CDC-FLAG
if (!$lesson->practice) { // dont display practice lessons
if ($grades) {
foreach ($grades as $userid => $grade) {
$return->grades[$userid] = number_format($grade * $lesson->grade / 100.0, 1);

View File

@@ -1,5 +1,5 @@
<?php
/// mnielsen @ CDC
/// mnielsen
/// locallib.php is the new lib file for lesson module.
/// including locallib.php is the same as including the old lib.php
@@ -21,7 +21,6 @@ if (!defined("LESSON_NEXTPAGE")) {
if (!defined("LESSON_EOL")) {
define("LESSON_EOL", -9); // End of Lesson
}
/// CDC-FLAG 6/14/04 ///
if (!defined("LESSON_UNSEENBRANCHPAGE")) {
define("LESSON_UNSEENBRANCHPAGE", -50); // Unseen branch page
}
@@ -37,7 +36,6 @@ if (!defined("LESSON_RANDOMBRANCH")) {
if (!defined("LESSON_CLUSTERJUMP")) {
define("LESSON_CLUSTERJUMP", -80); // random within a cluster
}
/// CDC-FLAG ///
if (!defined("LESSON_UNDEFINED")) {
define("LESSON_UNDEFINED", -99); // undefined
}
@@ -69,7 +67,6 @@ if (!defined("LESSON_NUMERICAL")) {
if (!defined("LESSON_MULTIANSWER")) {
define("LESSON_MULTIANSWER", "9");
}
/// CDC-FLAG /// 6/16/04
if (!defined("LESSON_ESSAY")) {
define("LESSON_ESSAY", "10");
}
@@ -79,14 +76,13 @@ if (!defined("LESSON_CLUSTER")) {
if (!defined("LESSON_ENDOFCLUSTER")) {
define("LESSON_ENDOFCLUSTER", "31");
}
/// CDC-FLAG ///
$LESSON_QUESTION_TYPE = array ( LESSON_MULTICHOICE => get_string("multichoice", "quiz"),
LESSON_TRUEFALSE => get_string("truefalse", "quiz"),
LESSON_SHORTANSWER => get_string("shortanswer", "quiz"),
LESSON_NUMERICAL => get_string("numerical", "quiz"),
LESSON_MATCHING => get_string("match", "quiz"),
LESSON_ESSAY => get_string("essay", "lesson") /// CDC-FLAG 6/16/04
LESSON_ESSAY => get_string("essay", "lesson")
// LESSON_DESCRIPTION => get_string("description", "quiz"),
// LESSON_RANDOM => get_string("random", "quiz"),
// LESSON_RANDOMSAMATCH => get_string("randomsamatch", "quiz"),
@@ -263,7 +259,7 @@ function lesson_save_question_options($question) {
$answer->pageid = $question->id;
$answer->timecreated = $timenow;
$answer->grade = $question->fraction[$key] * 100;
/// CDC-FLAG changed some defaults
// changed some defaults
/* Original Code
if ($answer->grade > 50 ) {
$answer->jumpto = LESSON_NEXTPAGE;
@@ -434,7 +430,7 @@ function lesson_choose_from_menu ($options, $name, $selected="", $nothing="choos
$javascript = "";
}
$output = "<label for=$name class=hidden-label>$name</label><SELECT id=$name NAME=$name $javascript>\n"; //CDC hidden label added.
$output = "<label for=$name class=hidden-label>$name</label><SELECT id=$name NAME=$name $javascript>\n";
if ($nothing) {
$output .= " <OPTION VALUE=\"$nothingvalue\"\n";
if ($nothingvalue == $selected) {
@@ -477,14 +473,12 @@ function lesson_iscorrect($pageid, $jumpto) {
return false;
} elseif ($jumpto == LESSON_NEXTPAGE) {
return true;
/// CDC-FLAG 6/21/04 ///
} elseif ($jumpto == LESSON_UNSEENBRANCHPAGE) {
return true;
} elseif ($jumpto == LESSON_RANDOMPAGE) {
return true;
} elseif ($jumpto == LESSON_CLUSTERJUMP) {
return true;
/// CDC-FLAG ///
} elseif ($jumpto == LESSON_EOL) {
return true;
}
@@ -503,7 +497,6 @@ function lesson_iscorrect($pageid, $jumpto) {
return false; // should never be reached
}
/// CDC-FLAG ///
/*******************************************************************/
function lesson_display_branch_jumps($lesson_id, $pageid) {
// this fucntion checks to see if a page is a branch or is
@@ -986,12 +979,12 @@ function lesson_print_tree($pageid, $lessonid, $cmid, $pixpath) {
echo $output;
if (count($pages) > 1) {
echo "<a title=\"move\" href=\"lesson.php?id=$cmid&action=move&pageid=".$pages[$pageid]->id."\">\n".
"<img src=\"$pixpath/t/move.gif\" hspace=\"2\" height=11 width=11 alt=\"move\" border=0></a>\n"; //CDC alt text added.
"<img src=\"$pixpath/t/move.gif\" hspace=\"2\" height=11 width=11 alt=\"move\" border=0></a>\n";
}
echo "<a title=\"update\" href=\"lesson.php?id=$cmid&amp;action=editpage&amp;pageid=".$pages[$pageid]->id."\">\n".
"<img src=\"$pixpath/t/edit.gif\" hspace=\"2\" height=11 width=11 alt=\"edit\" border=0></a>\n".
"<a title=\"delete\" href=\"lesson.php?id=$cmid&amp;sesskey=".$USER->sesskey."&amp;action=confirmdelete&amp;pageid=".$pages[$pageid]->id."\">\n".
"<img src=\"$pixpath/t/delete.gif\" hspace=\"2\" height=11 width=11 alt=\"delete\" border=0></a>\n"; //CDC alt text added.
"<img src=\"$pixpath/t/delete.gif\" hspace=\"2\" height=11 width=11 alt=\"delete\" border=0></a>\n";
echo "</tr></td>";
$pageid = $pages[$pageid]->nextpageid;
@@ -1141,6 +1134,138 @@ function lesson_check_nickname($name) {
return true;
}
/// CDC-FLAG ///
/**
* Prints out a Progress Bar which depicts a user's progress within a lesson.
*
* Currently works best with a linear lesson. Clusters are counted as a single page.
* Also, only viewed branch tables and questions that have been answered correctly count
* toward lesson completion (or progress). Only Students can see the Progress bar as well.
*
* @param object $lesson The lesson that the user is currently taking.
* @param object $course The course that the to which the lesson belongs.
* @return boolean The return is not significant as of yet. Will return true/false.
* @author Mark Nielsen
**/
function lesson_print_progress_bar($lesson, $course) {
global $CFG, $USER;
// lesson setting to turn progress bar on or off
if (!$lesson->progressbar) {
return false;
}
// catch teachers
if (isteacher($course->id)) {
notify(get_string('progressbarteacherwarning', 'lesson', $course->teachers));
return false;
}
// all of the lesson pages
if (!$pages = get_records('lesson_pages', 'lessonid', $lesson->id)) {
return false;
} else {
foreach ($pages as $page) {
if ($page->prevpageid == 0) {
$pageid = $page->id; // find the first page id
break;
}
}
}
// current attempt number
if (!$ntries = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id)) {
$ntries = 0; // may not be necessary
}
$viewedpageids = array();
// collect all of the correctly answered questions
if ($viewedpages = get_records_select("lesson_attempts", "lessonid = $lesson->id AND userid = $USER->id AND retry = $ntries AND correct = 1", 'timeseen DESC', 'pageid, id')) {
$viewedpageids = array_keys($viewedpages);
}
// collect all of the branch tables viewed
if ($viewedbranches = get_records_select("lesson_branch", "lessonid = $lesson->id AND userid = $USER->id AND retry = $ntries", 'timeseen DESC', 'pageid, id')) {
$viewedpageids = array_merge($viewedpageids, array_keys($viewedbranches));
}
// Filter out the following pages:
// End of Cluster
// End of Branch
// Pages found inside of Clusters
// Do not filter out Cluster Page(s) because we count a cluster as one.
// By keeping the cluster page, we get our 1
$validpages = array();
while ($pageid != 0) {
if ($pages[$pageid]->qtype == LESSON_CLUSTER) {
$clusterpageid = $pageid; // copy it
$validpages[$clusterpageid] = 1; // add the cluster page as a valid page
$pageid = $pages[$pageid]->nextpageid; // get next page
// now, remove all necessary viewed paged ids from the viewedpageids array.
while ($pages[$pageid]->qtype != LESSON_ENDOFCLUSTER and $pageid != 0) {
if (in_array($pageid, $viewedpageids)) {
unset($viewedpageids[array_search($pageid, $viewedpageids)]); // remove it
// since the user did see one page in the cluster, add the cluster pageid to the viewedpageids
if (!in_array($clusterpageid, $viewedpageids)) {
$viewedpageids[] = $clusterpageid;
}
}
$pageid = $pages[$pageid]->nextpageid;
}
} elseif ($pages[$pageid]->qtype == LESSON_ENDOFCLUSTER or $pages[$pageid]->qtype == LESSON_ENDOFBRANCH) {
// dont count these, just go to next
$pageid = $pages[$pageid]->nextpageid;
} else {
// a counted page
$validpages[$pageid] = 1;
$pageid = $pages[$pageid]->nextpageid;
}
}
// progress calculation as a percent
$progress = round(count($viewedpageids)/count($validpages), 2) * 100;
// print out the Progress Bar. Attempted to put as much as possible in the style sheets.
echo '<div class="progress_bar" align="center">';
echo '<table class="progress_bar_table"><tr>';
if ($progress != 0) { // some browsers do not repsect the 0 width.
echo '<td width="'.$progress.'%" class="progress_bar_completed">';
echo '</td>';
}
echo '<td class="progress_bar_todo">';
echo '<div class="progress_bar_token"></div>';
echo '</td>';
echo '</tr></table>';
echo '</div>';
return true;
}
/**
* Determines if a user can view the left menu. The determining factor
* is whether a user has a grade greater than or equal to the lesson setting
* of displayleftif
*
* @param object $lesson Lesson object of the current lesson
* @return boolean 0 if the user cannot see, or $lesson->displayleft to keep displayleft unchanged
* @author Mark Nielsen
**/
function lesson_displayleftif($lesson) {
global $CFG, $USER;
if (!empty($lesson->displayleftif)) {
// get the current user's max grade for this lesson
if ($maxgrade = get_record_sql('SELECT userid, MAX(grade) AS maxgrade FROM '.$CFG->prefix.'lesson_grades WHERE userid = '.$USER->id.' AND lessonid = '.$lesson->id.' GROUP BY userid')) {
if ($maxgrade->maxgrade < $lesson->displayleftif) {
return 0; // turn off the displayleft
}
} else {
return 0; // no grades
}
}
// if we get to here, keep the original state of displayleft lesson setting
return $lesson->displayleft;
}
?>

View File

@@ -47,7 +47,6 @@ if ($form->mode == "add") {
$currentdate = usergetdate(time());
$form->deadline = gmmktime($currentdate["hours"], $currentdate["minutes"], $currentdate["seconds"], $currentdate["mon"]+1, $currentdate["mday"], $currentdate["year"]);
}
/// CDC-FLAG ///
if (!isset($form->usepassword)) {
$form->usepassword = 0;
}
@@ -81,6 +80,12 @@ if ($form->mode == "add") {
if (!isset($form->displayleft)) {
$form->displayleft = 0;
}
if (!isset($form->displayleftif)) {
$form->displayleftif = 0;
}
if (!isset($form->progressbar)) {
$form->progressbar = 0;
}
if (!isset($form->highscores)) {
$form->highscores = 0;
}
@@ -118,7 +123,6 @@ if ($form->mode == "add") {
$form->deleteattempts = "";
/// CDC-FLAG ///
?>
<div class="mod-lesson">
<form name="form" method="post" action="mod.php">
@@ -135,7 +139,7 @@ if ($form->mode == "add") {
<tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td>
<td>
<!-- //CDC hidden label added. --><label for="name" class="hidden-label">Name</label><input type="text" id="name" name="name" size="30" value="<?php p($form->name) ?>" />
<!-- hidden label added. --><label for="name" class="hidden-label">Name</label><input type="text" id="name" name="name" size="30" value="<?php p($form->name) ?>" />
</td>
</tr>
@@ -381,15 +385,35 @@ if ($form->mode == "add") {
<tr>
<td align="right"><b><?php print_string("displayleftmenu", "lesson"); ?>:</b></td>
<td>
<?PHP
<?php
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "displayleft", $form->displayleft, "");
echo ' ';
print_string("displayleftif", "lesson", $course->student);
$options = array();
for($i = 100; $i >= 0; $i--) {
$options[$i] = $i.'%';
}
choose_from_menu($options, "displayleftif", $form->displayleftif, "");
helpbutton("displayleft", get_string("displayleftmenu", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("progressbar", "lesson"); ?>:</b></td>
<td>
<?php
$options = array();
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "progressbar", $form->progressbar, "");
helpbutton("progressbar", get_string("progressbar", "lesson"), "lesson");
?>
</td>
</tr>
<tr>
<td>
<br/><?php print_heading(get_string("accesscontrol", "lesson"), "left", 4); ?>

View File

@@ -1,3 +1,24 @@
/***
*** Style for page contents (display to student)
***/
.mod-lesson .contents {
text-align: left;
}
/***
*** Slide show Style
***/
/* NOTE: background color, height and width are set in the lesson settings */
.mod-lesson .slideshow {
overflow: auto;
padding-right: 16px; /* for the benefit of macIE5 only */
/* \ commented backslash hack - recover from macIE5 workarounds, it will ignore the following rule */
padding-right: 0;
padding: 15px;
}
/***
*** Hide Label Class
***/
@@ -96,3 +117,70 @@
.mod-lesson .branchbuttoncontainer {
text-align: center;
}
/* branchslidetop and branchslidebottom classes are wrapped around the branch buttons (branchslidetop around
top ones and branchslidebottom around the bottom ones)
that are printed out with the branch table in slide show mode. */
.mod-lesson .branchslidetop {
/* You could float them out of the slide
position: absolute;
top: 60px;*/
/* You may choose to not show them at all
display: none;*/
}
.mod-lesson .branchslidebottom {
/* You may choose to not show them at all
display: none;*/
}
/***
*** Lesson Progress Bar
*** Default styles for this are very basic right now.
*** User is supposed to configure this to their liking (like using pictures)
***/
.mod-lesson .progress_bar {
padding: 20px;
}
.mod-lesson .progress_bar_table {
width: 80%;
padding: 0px;
margin: 0px;
}
.mod-lesson .progress_bar_completed {
/* Example Use of Image
background-image: url(<?php echo $CFG->wwwroot ?>/mod/lesson/completed.gif);
background-position: center;
background-repeat: repeat-x;
*/
background-color: green;
padding: 0px;
margin: 0px;
}
.mod-lesson .progress_bar_todo {
/* Example Use of Image
background-image: url(<?php echo $CFG->wwwroot ?>/mod/lesson/todo.gif);
background-repeat: repeat-x;
background-position: center;
*/
background-color: red;
text-align: left;
padding: 0px;
margin: 0px;
}
.mod-lesson .progress_bar_token {
/* Example Use of Image
background-image: url(<?php echo $CFG->wwwroot ?>/mod/lesson/token.gif);
background-repeat: repeat-none;
*/
background-color: #000000;
height: 20px;
width: 5px;
padding: 0px;
margin: 0px;
}

View File

@@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005063000; // The current module version (Date: YYYYMMDDXX)
$module->version = 2005101900; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005021600; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)

View File

@@ -35,7 +35,7 @@
$strlessons = get_string('modulenameplural', 'lesson');
$strlesson = get_string('modulename', 'lesson');
/// CDC-FLAG moved the action up because I needed to know what the action will be before the header is printed
// moved the action up because I needed to know what the action will be before the header is printed
if (empty($action)) {
if (isteacher($course->id)) {
$action = 'teacherview';
@@ -47,7 +47,7 @@
print_simple_box_start('center');
echo '<div align="center">';
echo get_string('lessonopen', 'lesson', userdate($lesson->available)).'<br />';
echo '<a href="../../course/view.php?id='. $course->id .'">'. get_string('returnmainmenu', 'lesson') .'</a>';
echo '<div class="lessonbutton standardbutton" style="padding: 5px;"><a href="../../course/view.php?id='. $course->id .'">'. get_string('returnmainmenu', 'lesson') .'</a></div>';
echo '</div>';
print_simple_box_end();
print_footer($course);
@@ -59,7 +59,7 @@
print_simple_box_start('center');
echo '<div align="center">';
echo get_string('lessonclosed', 'lesson', userdate($lesson->deadline)) .'<br />';
echo '<a href="../../course/view.php?id='. $course->id. '">'. get_string('returnmainmenu', 'lesson') .'</a>';
echo '<div class="lessonbutton standardbutton" style="padding: 5px;"><a href="../../course/view.php?id='. $course->id. '">'. get_string('returnmainmenu', 'lesson') .'</a></div>';
echo '</div>';
print_simple_box_end();
print_footer($course);
@@ -71,7 +71,7 @@
}
}
/// CDC-FLAG changed the update_module_button and added another button when a teacher is checking the navigation of the lesson
// changed the update_module_button and added another button when a teacher is checking the navigation of the lesson
if (isteacheredit($course->id)) {
$button = '<table><tr><td>';
$button .= '<form target="'. $CFG->framename .'" method="get" action="'. $CFG->wwwroot .'/course/mod.php">'.
@@ -109,7 +109,7 @@
/************** navigation **************************************/
if ($action == 'navigation') {
/// CDC-FLAG /// password protected lesson code
// password protected lesson code
if ($lesson->usepassword && !isteacher($course->id)) {
$correctpass = false;
if (isset($_POST['userpassword'])) {
@@ -134,8 +134,8 @@
echo '<tr align="center"><td>'. get_string('enterpassword', 'lesson').' <input type="password" name="userpassword" /></td></tr>';
echo '<tr align="center"><td>';
echo '<input type="button" value="'. get_string('cancel', 'lesson') .'" onclick="parent.location=\'../../course/view.php?id='. $course->id .'\';" /> ';
echo '<input type="button" value="'. get_string('continue', 'lesson') .'" onclick="document.password.submit();" />';
echo '<span class="lessonbutton standardbutton"><a href="'.$CFG->wwwroot.'/course/view.php?id='. $course->id .'">'. get_string('cancel', 'lesson') .'</a></span> ';
echo ' <span class="lessonbutton standardbutton"><a href="javascript:document.password.submit();">'. get_string('continue', 'lesson') .'</a></span>';
echo '</td></tr></table>';
print_simple_box_end();
exit();
@@ -288,40 +288,33 @@
'prevpageid', 0)) {
error('Navigation: first page not found');
}
/// CDC-FLAG ///
if ($lesson->timed) {
if ($lesson->retake) {
echo '<form name="queryform" method ="post" action="view.php">' . "\n";
echo '<input type="hidden" name="id" value="'. $cm->id .'" />' . "\n";
echo '<input type="hidden" name="action" value="navigation" />' . "\n";
echo '<input type="hidden" name="pageid" />' . "\n";
echo '<input type="hidden" name="startlastseen" />' . "\n"; /// CDC-FLAG added this line
print_simple_box('<p align="center">'. get_string('leftduringtimed', 'lesson') .'</p>', 'center');
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 align="center" class="lessonbutton standardbutton">'.
'<a href="view.php?id='.$cm->id.'&amp;action=navigation&amp;pageid='.$firstpageid.'&amp;startlastseen=no">'.
get_string('continue', 'lesson').'</a></div>';
} else {
print_simple_box_start('center');
echo '<div align="center">';
echo get_string('leftduringtimednoretake', 'lesson');
echo '<br /><br /><a href="../../course/view.php?id='. $course->id .'">'. get_string('returntocourse', 'lesson') .'</a>';
echo '<br /><br /><div class="lessonbutton standardbutton"><a href="../../course/view.php?id='. $course->id .'">'. get_string('returntocourse', 'lesson') .'</a></div>';
echo '</div>';
print_simple_box_end();
}
} else {
echo "<form name=\"queryform\" method =\"post\" action=\"view.php\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
echo "<input type=\"hidden\" name=\"action\" value=\"navigation\" />\n";
echo "<input type=\"hidden\" name=\"pageid\" />\n";
echo "<input type=\"hidden\" name=\"startlastseen\" />\n"; /// CDC-FLAG added this line
print_simple_box("<p align=\"center\">".get_string('youhaveseen','lesson').'</p>',
"center");
echo "<p align=\"center\"><input type=\"button\" value=\"".get_string('yes').
"\" onclick=\"document.queryform.pageid.value='$lastpageseen';document.queryform.startlastseen.value='yes';document.queryform.submit();\" />&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\"".get_string("no"). /// CDC-FLAG 6/11/04 ///
"\" 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 align="center">';
echo '<span class="lessonbutton standardbutton">'.
'<a href="view.php?id='.$cm->id.'&amp;action=navigation&amp;pageid='.$lastpageseen.'&amp;startlastseen=yes">'.
get_string('yes').'</a></span>&nbsp;&nbsp;&nbsp;';
echo '<span class="lessonbutton standardbutton">'.
'<a href="view.php?id='.$cm->id.'&amp;action=navigation&amp;pageid='.$firstpageid.'&amp;startlastseen=no">'.
get_string('no').'</a></div>';
echo '</span>';
}
print_footer($course);
exit();
@@ -336,7 +329,7 @@
print_simple_box_start('center');
echo "<div align=\"center\">";
echo get_string("noretake", "lesson");
echo "<br /><br /><a href=\"../../course/view.php?id=$course->id\">".get_string('returntocourse', 'lesson').'</a>';
echo "<br /><br /><div class=\"lessonbutton standardbutton\"><a href=\"../../course/view.php?id=$course->id\">".get_string('returntocourse', 'lesson').'</a></div>';
echo "</div>";
print_simple_box_end();
print_footer($course);
@@ -385,15 +378,14 @@
if ($pageid != LESSON_EOL) {
/// This is the code updates the lessontime for a timed test
if (isset($_POST['startlastseen'])) { /// this deletes old records not totally sure if this is necessary anymore
if ($_POST['startlastseen'] == 'no') {
if ($startlastseen = optional_param('startlastseen', '', PARAM_ALPHA)) { /// this deletes old records not totally sure if this is necessary anymore
if ($startlastseen == 'no') {
if ($grades = get_records_select('lesson_grades', "lessonid = $lesson->id AND userid = $USER->id",
'grade DESC')) {
$retries = count($grades);
} else {
$retries = 0;
}
// NoticeFix big fix on the two delete_records
if (!delete_records('lesson_attempts', 'userid', $USER->id, 'lessonid', $lesson->id, 'retry', $retries)) {
error('Error: could not delete old attempts');
}
@@ -433,6 +425,10 @@
redirect("view.php?id=$cm->id&amp;action=navigation&amp;pageid=$nextpageid", get_string('endofclustertitle', 'lesson'));
}
// check to see if the user can see the left menu
$lesson->displayleft = lesson_displayleftif($lesson);
// start of left menu
if ($lesson->displayleft) {
echo '<table><tr valign="top"><td>';
@@ -465,15 +461,10 @@
// starts the slideshow div
if($lesson->slideshow && $page->qtype == LESSON_BRANCHTABLE) {
echo "<div style=\"
echo "<div class=\"slideshow\" style=\"
background-color: $lesson->bgcolor;
height: ".$lesson->height."px;
width: ".$lesson->width."px;
overflow: auto;
padding-right: 16px; /* for the benefit of macIE5 only */
/* \ commented backslash hack - recover from macIE5 workarounds, it will ignore the following rule */
padding-right: 0;
padding: 15px;
\">\n";
echo "<table align=\"center\" width=\"100%\" border=\"0\"><tr><td>\n";
} else {
@@ -569,7 +560,6 @@
// print_heading(get_string('endofbranch', 'lesson'));
foreach ($answers as $answer) {
// just need the first answer
/// CDC-FLAG 6/21/04 ///
if ($answer->jumpto == LESSON_RANDOMBRANCH) {
$answer->jumpto = lesson_unseen_branch_jump($lesson->id, $USER->id);
} elseif ($answer->jumpto == LESSON_CLUSTERJUMP) {
@@ -582,10 +572,18 @@
$answer->jumpto = $page->nextpageid;
}
}
} else if ($answer->jumpto = LESSON_NEXTPAGE) {
if ($page->nextpageid == 0) {
$answer->jumpto = LESSON_EOL;
} else {
$answer->jumpto = $page->nextpageid;
}
} else if ($answer->jumpto = 0) {
$answer->jumpto = $page->id;
} else if ($answer->jumpto = LESSON_PREVIOUSPAGE) {
$answer->jumpto = $page->prevpageid;
}
/// CDC-FLAG ///
redirect("view.php?id=$cm->id&amp;action=navigation&amp;pageid=$answer->jumpto",
get_string("endofbranch", "lesson"));
redirect("view.php?id=$cm->id&amp;action=navigation&amp;pageid=$answer->jumpto");// REMOVED: , get_string("endofbranch", "lesson")
break;
}
print_footer($course);
@@ -661,7 +659,9 @@
if (!$lesson->slideshow) {
$options = new stdClass;
$options->noclean = true;
print_simple_box(format_text($page->contents, FORMAT_MOODLE, $options), 'center');
print_simple_box('<div class="contents">'.
format_text($page->contents, FORMAT_MOODLE, $options).
'</div>', 'center');
}
echo "<br />\n";
@@ -698,7 +698,7 @@
$value = "";
}
echo "<tr><td align=\"center\">".get_string("youranswer", "lesson").
": <label for=\"answer\" class=\"hidden-label\">Answer</label><input type=\"text\" id=\"answer\" name=\"answer\" size=\"50\" maxlength=\"200\" $value />\n"; //CDC hidden label added.
": <label for=\"answer\" class=\"hidden-label\">Answer</label><input type=\"text\" id=\"answer\" name=\"answer\" size=\"50\" maxlength=\"200\" $value />\n";
echo '</table>';
print_simple_box_end();
echo "<div align=\"center\" class=\"lessonbutton standardbutton\"><a href=\"javascript:document.answerform.submit();\">".
@@ -713,7 +713,7 @@
} else {
$checked = "";
}
echo "<label for=\"answerid\" class=\"hidden-label\">Answer ID</label><input type=\"radio\" id=\"answerid\" name=\"answerid\" value=\"{$answer->id}\" $checked />"; //CDC hidden label added.
echo "<label for=\"answerid\" class=\"hidden-label\">Answer ID</label><input type=\"radio\" id=\"answerid\" name=\"answerid\" value=\"{$answer->id}\" $checked />";
echo "</td><td>";
$options = new stdClass;
$options->para = false; // no <p></p>
@@ -745,7 +745,7 @@
}
}
// more than one answer allowed
echo "<label for=\"answer[$i]\" class=\"hidden-label\">answer[$i]</label><input type=\"checkbox\" id=\"answer[$i]\" name=\"answer[$i]\" value=\"{$answer->id}\" $checked />"; //CDC hidden label added.
echo "<label for=\"answer[$i]\" class=\"hidden-label\">answer[$i]</label><input type=\"checkbox\" id=\"answer[$i]\" name=\"answer[$i]\" value=\"{$answer->id}\" $checked />";
} else {
if (isset($USER->modattempts[$lesson->id]) && $answer->id == $attempt->answerid) {
$checked = "checked=\"checked\"";
@@ -753,7 +753,7 @@
$checked = "";
}
// only one answer allowed
echo "<label for=\"answerid\" class=\"hidden-label\">answer id</label><input type=\"radio\" id=\"answerid\" name=\"answerid\" value=\"{$answer->id}\" $checked />"; //CDC hidden label added.
echo "<label for=\"answerid\" class=\"hidden-label\">answer id</label><input type=\"radio\" id=\"answerid\" name=\"answerid\" value=\"{$answer->id}\" $checked />";
}
echo "</td><td>";
$options = new stdClass;
@@ -777,7 +777,6 @@
}
break;
/// CDC-FLAG /// 6/14/04 --- changed how matching works
case LESSON_MATCHING :
echo "<tr><td><table width=\"100%\">";
// don't suffle answers (could be an option??)
@@ -801,7 +800,7 @@
$options->para = false;
$options->noclean = true;
echo "<b>".format_text($answer->answer,FORMAT_MOODLE,$options).": </b></td><td valign=\"bottom\">";
echo "<label for=\"response[$answer->id]\" class=\"hidden-label\">response[$answer->id]</label><select id=\"response[$answer->id]\" name=\"response[$answer->id]\">"; //CDC hidden label added.
echo "<label for=\"response[$answer->id]\" class=\"hidden-label\">response[$answer->id]</label><select id=\"response[$answer->id]\" name=\"response[$answer->id]\">";
if (isset($USER->modattempts[$lesson->id])) {
$selected = trim($answers[$useranswers[$t]]->response);
echo "<option value=\"".htmlspecialchars($response)."\" selected=\"selected\">$selected</option>";
@@ -880,10 +879,10 @@
$fullbuttonhtml .= "</div>\n";
if ($lesson->slideshow) {
echo $fullbuttonhtml . '<br />';
echo '<div class="branchslidetop">' . $fullbuttonhtml . '</div>';
$options = new stdClass;
$options->noclean = true;
echo format_text($page->contents, FORMAT_MOODLE, $options);
echo '<div class="contents">'.format_text($page->contents, FORMAT_MOODLE, $options).format_text($page->contents).'</div>';;
echo "</table></div><table cellpadding=\"5\" cellspacing=\"5\" align=\"center\">";
} else {
echo "<tr><td><table width=\"100%\">";
@@ -901,7 +900,7 @@
echo '</table></table>';
print_simple_box_end();
} else {
echo $fullbuttonhtml;
echo '<div class="branchslidebottom">' . $fullbuttonhtml . '</div>';
}
break;
case LESSON_ESSAY :
@@ -912,7 +911,7 @@
$value = "";
}
echo "<tr><td align=\"center\" valign=\"top\" nowrap>".get_string("youranswer", "lesson").":</td><td>".
"<label for=\"answer\" class=\"hidden-label\">Answer</label><textarea id=\"answer\" name=\"answer\" rows=\"15\" cols=\"60\">$value</textarea>\n"; //CDC hidden label added.
"<label for=\"answer\" class=\"hidden-label\">Answer</label><textarea id=\"answer\" name=\"answer\" rows=\"15\" cols=\"60\">$value</textarea>\n";
echo "</td></tr></table>";
print_simple_box_end();
echo "<div align=\"center\" class=\"lessonbutton standardbutton\"><a href=\"javascript:document.answerform.submit();\">".
@@ -974,10 +973,10 @@
get_string("continue", "lesson")."\" /></p>\n";
echo "</form>\n";
}
lesson_print_progress_bar($lesson, $course);
echo "</table>\n";
} else {
// end of lesson reached work out grade
/// CDC-FLAG ///
if ($lesson->timed && !isteacher($course->id)) {
if (isset($_GET["outoftime"])) {
if ($_GET["outoftime"] == "normal") {
@@ -1011,7 +1010,6 @@
if (isstudent($course->id)) {
if ($nviewed = count_records("lesson_attempts", "lessonid", $lesson->id, "userid",
$USER->id, "retry", $ntries)) {
/// CDC-FLAG /// 6/11/04
if (!$lesson->custom) {
$ncorrect = 0;
$temp = array();
@@ -1111,7 +1109,6 @@
" (".get_string("outof", "lesson", $lesson->grade).")</p>\n";
}
/// CDC-FLAG ///
$grade->lessonid = $lesson->id;
$grade->userid = $USER->id;
$grade->grade = $thegrade;
@@ -1169,7 +1166,7 @@
redirect($CFG->wwwroot.'/course/view.php?id='.$course->id);
}
///CDC-FLAG /// high scores code
// high scores code
if ($lesson->highscores && !isteacher($course->id) && !$lesson->practice) {
echo "<div align=\"center\"><br>";
if (!$grades = get_records_select("lesson_grades", "lessonid = $lesson->id", "completed")) {
@@ -1177,8 +1174,8 @@
echo "<a href=\"view.php?id=$cm->id&amp;action=nameforhighscores\">".get_string("clicktopost", "lesson")."</a><br>";
} else {
if (!$highscores = get_records_select("lesson_high_scores", "lessonid = $lesson->id")) {
echo get_string("youmadehighscore", "lesson", $lesson->maxhighsores)."<br>";
echo "<a href=\"view.php?id=$cm->id&amp;action=nameforhighscores\">".get_string("clicktopost", "lesson")."</a><br>";
echo get_string("youmadehighscore", "lesson", $lesson->maxhighscores)."<br>";
echo "<div class=\"lessonbutton standardbutton\"><a href=\"view.php?id=$cm->id&amp;action=nameforhighscores\">".get_string("clicktopost", "lesson")."</a></div><br/>";
} else {
// get all the high scores into an array
foreach ($highscores as $highscore) {
@@ -1191,16 +1188,16 @@
if ($thegrade >= $lowscore || count($topscores) <= $lesson->maxhighscores) {
echo get_string("youmadehighscore", "lesson", $lesson->maxhighscores)."<br>";
echo "<a href=\"view.php?id=$cm->id&amp;action=nameforhighscores\">".get_string("clicktopost", "lesson")."</a><br>";
echo "<div class=\"lessonbutton standardbutton\"><a href=\"view.php?id=$cm->id&amp;action=nameforhighscores\">".get_string("clicktopost", "lesson")."</a></div><br />";
} else {
echo get_string("nothighscore", "lesson", $lesson->maxhighscores)."<br>";
}
}
}
echo "<br><a href=\"view.php?id=$cm->id&amp;action=highscores&link=1\">".get_string("viewhighscores", "lesson")."</a>";
echo "<br /><div style=\"padding: 5px;\" class=\"lessonbutton standardbutton\"><a href=\"view.php?id=$cm->id&amp;action=highscores&link=1\">".get_string("viewhighscores", "lesson").'</a></div>';
echo "</div>";
}
/// CDC-FLAG ///
if ($lesson->modattempts && !isteacher($course->id)) {
// make sure if the student is reviewing, that he/she sees the same pages/page path that he/she saw the first time
// look at the attempt records to find the first QUESTION page that the user answered, then use that page id
@@ -1215,15 +1212,12 @@
// sure that the student can leave the lesson via pushing the continue button.
$lastattempt = end($attempts);
$USER->modattempts[$lesson->id] = $lastattempt->pageid;
echo "<form name=\"reviewform\" method=\"post\" action=\"view.php?id=$cm->id\">";
echo "<input type=\"hidden\" name=\"pageid\" value=\"$pageid\" />";
echo "</form>";
echo "<p align=\"center\"><a href=\"javascript:document.reviewform.submit();\">".get_string("reviewlesson", "lesson")."</a></p>\n";
echo "<div align=\"center\" style=\"padding: 5px;\" class=\"lessonbutton standardbutton\"><a href=\"view.php?id=$cm->id&amp;pageid=$pageid\">".get_string("reviewlesson", "lesson")."</a></div>\n";
} elseif ($lesson->modattempts && isteacher($course->id)) {
echo "<p align=\"center\">".get_string("modattemptsnoteacher", "lesson")."</p>";
}
echo "<p align=\"center\"><a href=\"../../course/view.php?id=$course->id\">".get_string("mainmenu", "lesson")."</a></p>\n"; //CDC Back to the menu (course view).
echo "<p align=\"center\"><a href=\"../../grade/index.php?id=$course->id\">".get_string("viewgrades", "lesson")."</a></p>\n"; //CDC view grades
echo "<div align=\"center\" style=\"padding: 5px;\" class=\"lessonbutton standardbutton\"><a href=\"../../course/view.php?id=$course->id\">".get_string("mainmenu", "lesson")."</a></div>\n"; // Back to the menu (course view).
echo "<div align=\"center\" style=\"padding: 5px;\" class=\"lessonbutton standardbutton\"><a href=\"../../grade/index.php?id=$course->id\">".get_string("viewgrades", "lesson")."</a></div>\n"; //view grades
}
if ($lesson->displayleft || $lesson->slideshow) { // this ends the table cell and table for the leftmenu or for slideshow
@@ -1234,7 +1228,7 @@
/*******************teacher view **************************************/
elseif ($action == 'teacherview') {
/// CDC-FLAG /// link to grade essay questions and to report
// 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) {
@@ -1300,7 +1294,6 @@
}
if (!$page = get_record_select("lesson_pages", "lessonid = $lesson->id AND prevpageid = 0")) {
/// CDC-FLAG ///
// if there are no pages give teacher the option to create a new page or a new branch table
echo "<div align=\"center\">";
if (isteacheredit($course->id)) {
@@ -1316,8 +1309,7 @@
"</a></td></tr></table>\n");
}
print_simple_box_end();
echo "</div>"; //CDC Chris Berri added.
/// CDC-FLAG ///
echo "</div>";
} else {
print_heading("<a href=\"view.php?id=$cm->id&amp;action=navigation\">".get_string("checknavigation",
"lesson")."</a>\n");
@@ -1326,8 +1318,6 @@
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
echo "<input type=\"hidden\" name=\"action\" value=\"navigation\" />\n";
echo "<input type=\"hidden\" name=\"pageid\" />\n";
/// CDC-FLAG /// tree code - in final release, will use lang file for all text output.
// NoticeFix next two lines and bowth viewAlls
$branch = false;
$singlePage = false;
if($lesson->tree && !isset($_GET['display']) && !isset($_GET['viewAll'])) {
@@ -1365,7 +1355,6 @@
echo "<a href=\"view.php?id=$id\">".get_string("backtreeview", "lesson")."</a><br />\n";
echo "<table cellpadding=\"5\" border=\"0\" width=\"80%\">\n";
if (isteacheredit($course->id)) {
/// CDC-FLAG 6/16/04 ///
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&amp;pageid=$page->prevpageid\">".
get_string("importquestions", "lesson")."</a> | ".
"<a href=\"lesson.php?id=$cm->id&amp;sesskey=".$USER->sesskey."&amp;action=addcluster&amp;pageid=$page->prevpageid\">".
@@ -1377,7 +1366,6 @@
"<a href=\"lesson.php?id=$cm->id&amp;action=addpage&amp;pageid=$page->prevpageid\">".
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
"</a></small></td></tr>\n";
/// CDC-FLAG ///
}
} else {
if($lesson->tree) {
@@ -1385,7 +1373,6 @@
}
echo "<table align=\"center\" cellpadding=\"5\" border=\"0\" width=\"80%\">\n";
if (isteacheredit($course->id)) {
/// CDC-FLAG 6/16/04 ///
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&amp;pageid=0\">".
get_string("importquestions", "lesson")."</a> | ".
"<a href=\"lesson.php?id=$cm->id&amp;sesskey=".$USER->sesskey."&amp;action=addcluster&amp;pageid=0\">".
@@ -1395,10 +1382,9 @@
"<a href=\"lesson.php?id=$cm->id&amp;action=addpage&amp;pageid=0\">".
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
"</a></small></td></tr>\n";
/// CDC-FLAG ///
}
}
/// CDC-FLAG /// end tree code (note, there is an "}" below for an else above)
/// end tree code (note, there is an "}" below for an else above)
while (true) {
echo "<tr><td>\n";
echo "<table width=\"100%\" border=\"1\" class=\"generalbox\"><tr><th colspan=\"2\">".format_string($page->title)."&nbsp;&nbsp;\n";
@@ -1422,7 +1408,7 @@
if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) {
echo "<tr><td colspan=\"2\" align=\"center\"><b>\n";
switch ($page->qtype) {
case LESSON_ESSAY : /// CDC-FLAG /// 6/16/04 this line and the next
case LESSON_ESSAY :
echo $LESSON_QUESTION_TYPE[$page->qtype];
break;
case LESSON_SHORTANSWER :
@@ -1462,7 +1448,6 @@
case LESSON_SHORTANSWER:
case LESSON_NUMERICAL:
echo "<tr><td align=\"right\" valign=\"top\" width=\"20%\">\n";
/// CDC-FLAG /// 6/11/04
if ($lesson->custom) {
// if the score is > 0, then it is correct
if ($answer->score > 0) {
@@ -1549,8 +1534,8 @@
$jumptitle = get_string("nextpage", "lesson");
} elseif ($answer->jumpto == LESSON_EOL) {
$jumptitle = get_string("endoflesson", "lesson");
/* CDC-FLAG 6/17/04 */ } elseif ($answer->jumpto == LESSON_UNSEENBRANCHPAGE) {
$jumptitle = get_string("unseenpageinbranch", "lesson"); // a better way is get_string("unseenbranchpage", "lesson"); and define in lang file
} elseif ($answer->jumpto == LESSON_UNSEENBRANCHPAGE) {
$jumptitle = get_string("unseenpageinbranch", "lesson");
} elseif ($answer->jumpto == LESSON_PREVIOUSPAGE) {
$jumptitle = get_string("previouspage", "lesson");
} elseif ($answer->jumpto == LESSON_RANDOMPAGE) {
@@ -1558,14 +1543,13 @@
} elseif ($answer->jumpto == LESSON_RANDOMBRANCH) {
$jumptitle = get_string("randombranch", "lesson");
} elseif ($answer->jumpto == LESSON_CLUSTERJUMP) {
$jumptitle = get_string("clusterjump", "lesson"); /// CDC-FLAG ///
$jumptitle = get_string("clusterjump", "lesson");
} else {
if (!$jumptitle = get_field("lesson_pages", "title", "id", $answer->jumpto)) {
$jumptitle = "<b>".get_string("notdefined", "lesson")."</b>";
}
}
$jumptitle = format_string($jumptitle,true);
/// CDC-FLAG ///
if ($page->qtype == LESSON_MATCHING) {
if ($i == 1) {
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("correctanswerscore", "lesson").":";
@@ -1594,7 +1578,7 @@
}
$i++;
}
// print_simple_box_end(); /// CDC-FLAG /// not sure if i commented this out... hehe
// print_simple_box_end(); // not sure if i commented this out... hehe
echo "<tr><td colspan=\"2\" align=\"center\">";
if ($page->qtype != LESSON_ENDOFBRANCH) {
echo "<input type=\"button\" value=\"";
@@ -1610,7 +1594,6 @@
}
echo "</table></td></tr>\n";
if (isteacheredit($course->id)) {
/// CDC-FLAG /// 6/16/04
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&amp;pageid=$page->id\">".
get_string("importquestions", "lesson")."</a> | ".
"<a href=\"lesson.php?id=$cm->id&amp;sesskey=".$USER->sesskey."&amp;action=addcluster&amp;pageid=$page->id\">".
@@ -1619,7 +1602,6 @@
get_string("addendofcluster", "lesson")."</a> | ".
"<a href=\"lesson.php?id=$cm->id&amp;action=addbranchtable&amp;pageid=$page->id\">".
get_string("addabranchtable", "lesson")."</a><br />";
/// CDC-FLAG ///
// the current page or the next page is an end of branch don't show EOB link
$nextqtype = 0; // set to anything else EOB
if ($page->nextpageid) {
@@ -1648,12 +1630,11 @@
}
$prevpageid = $page->id;
// move to next page
/// CDC-FLAG ///
if($singlePage) { // this will make sure only one page is displayed if needed
break;
} elseif($branch && $page->qtype == LESSON_ENDOFBRANCH) { // this will display a branch table and its contents
break;
} elseif ($page->nextpageid) { /// CDC-FLAG ///
} elseif ($page->nextpageid) {
if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) {
error("Teacher view: Next page not found!");
}
@@ -1662,18 +1643,15 @@
break;
}
}
} /// CDC-FLAG /// end of else from above tree code!!!
} // end of else from above tree code!!!
echo "</table></form>\n";
/// CDC-FLAG ///
// NoticeFix both viewAll's
if(isset($_GET['display']) && !isset($_GET['viewAll'])) {
echo "<center><a href=\"view.php?id=$id&amp;viewAll=1\">".get_string("viewallpages", "lesson")."</a><br />\n";
}
if($lesson->tree && (isset($_GET['display']) || isset($_GET['viewAll']))) {
echo "<center><a href=\"view.php?id=$id\">".get_string("backtreeview", "lesson")."</a><br /></center>\n";
}
/// CDC-FLAG ///
print_heading("<a href=\"view.php?id=$cm->id&amp;action=navigation\">".get_string("checknavigation",
"lesson")."</a>\n");
}
@@ -2017,9 +1995,10 @@
echo "</table>";
}
if (isset($_GET['link'])) {
echo "<br><a href=\"../../course/view.php?id=$course->id\">".get_string("returntocourse", "lesson")."</a>";
echo "<br /><div class=\"lessonbutton standardbutton\"><a href=\"../../course/view.php?id=$course->id\">".get_string("returntocourse", "lesson")."</a></div>";
} else {
echo "<br><a href=\"../../course/view.php?id=$course->id\">".get_string("cancel", "lesson")."</a> | <a href=\"view.php?id=$cm->id&amp;action=navigation\">".get_string("startlesson", "lesson")."</a>";
echo "<br /><span class=\"lessonbutton standardbutton\"><a href=\"../../course/view.php?id=$course->id\">".get_string("cancel", "lesson").'</a></span> '.
" <span class=\"lessonbutton standardbutton\"><a href=\"view.php?id=$cm->id&amp;action=navigation\">".get_string("startlesson", "lesson").'</a></span>';
}
echo "</div>";