diff --git a/mod/lesson/action/addbranchtable.php b/mod/lesson/action/addbranchtable.php index b1769260e6a..2a9c9d411f0 100644 --- a/mod/lesson/action/addbranchtable.php +++ b/mod/lesson/action/addbranchtable.php @@ -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 @@
+ \n"; - /// CDC-FLAG /// 6/16/04 echo "\n"; - /// CDC-FLAG /// for ($i = 0; $i < $lesson->maxanswers; $i++) { $iplus1 = $i + 1; echo " @@ -381,15 +385,35 @@ if ($form->mode == "add") { + + + + +
:
-
"; echo get_string("pagecontents", "lesson").":
\n"; print_textarea($usehtmleditor, 25,70, 630, 400, "contents"); use_html_editor("contents"); echo "
\n"; echo "
"; echo get_string("arrangebuttonshorizontally", "lesson")."\n"; @@ -57,7 +54,6 @@ echo get_string("displayinleftmenu", "lesson"); echo "
\n"; echo "
".get_string("description", "lesson")." $iplus1:
\n"; diff --git a/mod/lesson/action/addpage.php b/mod/lesson/action/addpage.php index 232a276632e..12cb0cc438b 100644 --- a/mod/lesson/action/addpage.php +++ b/mod/lesson/action/addpage.php @@ -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 "".get_string("multianswer", "lesson").": \n"; } - echo " "; //CDC hidden label added. + echo " "; helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); echo '

'; } @@ -75,14 +73,14 @@ lesson_qtype_menu($LESSON_QUESTION_TYPE, LESSON_MULTICHOICE, "lesson.php?id=$cm->id&action=addpage&pageid=".$pageid.$linkadd); echo "

".get_string("multianswer", "lesson").": \n"; - echo " "; //CDC hidden label added. + echo " "; helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); } ?> + \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: "; @@ -197,7 +192,6 @@ echo get_string("score", "lesson")." $iplus1: "; } } - /// CDC-FLAG /// echo "\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: "; @@ -228,7 +221,6 @@ echo get_string("score", "lesson")." $iplus1: "; } } - /// CDC-FLAG /// echo "\n"; } } diff --git a/mod/lesson/action/continue.php b/mod/lesson/action/continue.php index 96759460622..de85a6f4655 100644 --- a/mod/lesson/action/continue.php +++ b/mod/lesson/action/continue.php @@ -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 "

".get_string("teacherjumpwarning", "lesson", $warningvars)."

"; } } - /// 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&action=navigation&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 "
".get_string("teacherongoingwarning", "lesson")."

"; @@ -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 "\n"; echo "id\">\n"; echo "\n"; diff --git a/mod/lesson/action/editpage.php b/mod/lesson/action/editpage.php index 9c1e49c51cc..0636596bf5e 100644 --- a/mod/lesson/action/editpage.php +++ b/mod/lesson/action/editpage.php @@ -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 "

".get_string("multianswer", "lesson").": \n"; if ($page->qoption) { - echo ""; //CDC hidden label added. + echo ""; } else { - echo ""; //CDC hidden label added. + echo ""; } helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); echo "

\n"; @@ -86,9 +84,9 @@ "document.editpage.redisplay.value=1;document.editpage.submit();"); echo "

".get_string("casesensitive", "lesson").": \n"; if ($page->qoption) { - echo ""; //CDC hidden label added. + echo ""; } else { - echo ""; //CDC hidden label added. + echo ""; } helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); echo "

\n"; @@ -108,7 +106,7 @@
:
-
"; echo get_string("pagecontents", "lesson").":
\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: "; @@ -117,7 +114,6 @@ echo get_string("score", "lesson")." $iplus1: "; } } - /// CDC-FLAG /// echo "
+ \n"; - /// CDC-FLAG /// echo ""; $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 '
'; + echo '
:
-
"; @@ -120,7 +118,6 @@ switch ($page->qtype) { case LESSON_BRANCHTABLE : echo "qtype\">\n"; - /// CDC-FLAG /// 6/16/04 echo "
\n"; echo "
"; if ($page->layout) { @@ -137,7 +134,6 @@ } echo get_string("displayinleftmenu", "lesson")."
\n"; echo "
".get_string("branchtable", "lesson")." \n"; break; case LESSON_CLUSTER : @@ -167,14 +163,14 @@ if ($flags & LESSON_ANSWER_EDITOR) { echo " [".get_string("useeditor", "lesson").": ". ""; //CDC hidden label added. + checked=\"checked\">"; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". - ""; //CDC hidden label. + ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". ""; //CDC hidden label added. + checked=\"checked\">"; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". - ""; //CDC hidden label. + ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". ""; //CDC hidden label added. + checked=\"checked\">"; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". - ""; //CDC hidden label. + ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". ""; //CDC hidden label added. + checked=\"checked\">"; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". - ""; //CDC hidden label added. + ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". ""; //CDC hidden label added. + checked=\"checked\">"; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". - ""; //CDC hidden label. + ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". ""; //CDC hidden label added. + checked=\"checked\">"; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". - ""; //CDC hidden label added. + ""; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". ""; //CDC hidden label added. + checked=\"checked\">"; helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); echo "]
\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").": ". ""; @@ -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 { diff --git a/mod/lesson/action/insertpage.php b/mod/lesson/action/insertpage.php index 05cab0f24da..7ffe58e6ff9 100644 --- a/mod/lesson/action/insertpage.php +++ b/mod/lesson/action/insertpage.php @@ -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')); ?> diff --git a/mod/lesson/action/updatepage.php b/mod/lesson/action/updatepage.php index dd42a535047..14d00967e0d 100644 --- a/mod/lesson/action/updatepage.php +++ b/mod/lesson/action/updatepage.php @@ -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"); diff --git a/mod/lesson/db/mysql.php b/mod/lesson/db/mysql.php index 82f9567c9f8..1bd53666596 100644 --- a/mod/lesson/db/mysql.php +++ b/mod/lesson/db/mysql.php @@ -201,6 +201,11 @@ function lesson_upgrade($oldversion) { table_column('lesson', '', 'dependency', 'int', '10', 'unsigned', '0', 'not null', 'usepassword'); 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; } diff --git a/mod/lesson/db/mysql.sql b/mod/lesson/db/mysql.sql index 4f4a24fe8a5..4521950152a 100644 --- a/mod/lesson/db/mysql.sql +++ b/mod/lesson/db/mysql.sql @@ -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', diff --git a/mod/lesson/db/postgres7.php b/mod/lesson/db/postgres7.php index 475223631c4..02b2cd4aeec 100644 --- a/mod/lesson/db/postgres7.php +++ b/mod/lesson/db/postgres7.php @@ -282,6 +282,11 @@ function lesson_upgrade($oldversion) { table_column('lesson', '', 'dependency', 'INT', '8', 'unsigned', '0', 'not null', 'usepassword'); 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; } diff --git a/mod/lesson/db/postgres7.sql b/mod/lesson/db/postgres7.sql index ef0db0a8d0b..9defb73f64e 100644 --- a/mod/lesson/db/postgres7.sql +++ b/mod/lesson/db/postgres7.sql @@ -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', diff --git a/mod/lesson/lesson.php b/mod/lesson/lesson.php index 8b0a228c446..16f07f5f87e 100644 --- a/mod/lesson/lesson.php +++ b/mod/lesson/lesson.php @@ -5,7 +5,7 @@ addbranchtable addendofbranch - addcluster /// CDC-FLAG /// added two new items + addcluster addendofcluster addpage confirmdelete diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php index 13467ddc2de..5f1655d9c15 100644 --- a/mod/lesson/lib.php +++ b/mod/lesson/lib.php @@ -1,5 +1,5 @@ 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); diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index 4916ff1f31e..796a7c6b16f 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -1,5 +1,5 @@ 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 = "\n"; if ($nothing) { $output .= "
'; + if ($progress != 0) { // some browsers do not repsect the 0 width. + echo ''; + } + echo ''; + echo '
'; + echo ''; + echo '
'; + echo '
'; + echo ''; + + 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; +} ?> diff --git a/mod/lesson/mod.html b/mod/lesson/mod.html index 3d4b93e38f6..9cac4c00df1 100644 --- a/mod/lesson/mod.html +++ b/mod/lesson/mod.html @@ -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 /// ?>
@@ -135,7 +139,7 @@ if ($form->mode == "add") {
: - +
: - 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"); ?>
: + progressbar, ""); + helpbutton("progressbar", get_string("progressbar", "lesson"), "lesson"); + ?> +

diff --git a/mod/lesson/styles.php b/mod/lesson/styles.php index 550db2528c8..3cf33fb7b1b 100644 --- a/mod/lesson/styles.php +++ b/mod/lesson/styles.php @@ -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 ***/ @@ -95,4 +116,71 @@ /* branchbuttoncontainer wraps around branch table buttons */ .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(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(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(wwwroot ?>/mod/lesson/token.gif); + background-repeat: repeat-none; + */ + background-color: #000000; + height: 20px; + width: 5px; + padding: 0px; + margin: 0px; } \ No newline at end of file diff --git a/mod/lesson/version.php b/mod/lesson/version.php index fc422590b73..effaec88155 100644 --- a/mod/lesson/version.php +++ b/mod/lesson/version.php @@ -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) diff --git a/mod/lesson/view.php b/mod/lesson/view.php index 236f8b18fd5..5ac668e7658 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -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 '
'; echo get_string('lessonopen', 'lesson', userdate($lesson->available)).'
'; - echo ''. get_string('returnmainmenu', 'lesson') .''; + echo ''; echo '
'; print_simple_box_end(); print_footer($course); @@ -59,7 +59,7 @@ print_simple_box_start('center'); echo '
'; echo get_string('lessonclosed', 'lesson', userdate($lesson->deadline)) .'
'; - echo ''. get_string('returnmainmenu', 'lesson') .''; + echo ''; echo '
'; 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 = ''; echo '
'; $button .= ''. @@ -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 '
'. get_string('enterpassword', 'lesson').'
'; - echo ' '; - echo ''; + echo ''. get_string('cancel', 'lesson') .' '; + echo ' '. get_string('continue', 'lesson') .''; echo '
'; 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 '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; /// CDC-FLAG added this line print_simple_box('

'. get_string('leftduringtimed', 'lesson') .'

', 'center'); - echo '

\n"; /// CDC-FLAG added document.queryform.startlastseen.value='yes' - echo '' . "\n"; - echo '';///CDC Chris Berri added close div tag + echo ''; } else { print_simple_box_start('center'); echo '
'; echo get_string('leftduringtimednoretake', 'lesson'); - echo '

'. get_string('returntocourse', 'lesson') .''; + echo '

'; echo '
'; print_simple_box_end(); } } else { - echo "
\n"; - echo "id\" />\n"; - echo "\n"; - echo "\n"; - echo "\n"; /// CDC-FLAG added this line print_simple_box("

".get_string('youhaveseen','lesson').'

', "center"); - echo "

   

\n"; /// CDC-FLAG added document.queryform.startlastseen.value='yes' - echo "
\n"; echo "";///CDC Chris Berri added close div tag + + echo '
'; + echo ''. + ''. + get_string('yes').'   '; + echo ''. + ''. + get_string('no').'
'; + echo ''; } print_footer($course); exit(); @@ -336,7 +329,7 @@ print_simple_box_start('center'); echo "
"; echo get_string("noretake", "lesson"); - echo "

id\">".get_string('returntocourse', 'lesson').''; + echo "

'; echo "
"; 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&action=navigation&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 '
'; @@ -465,15 +461,10 @@ // starts the slideshow div if($lesson->slideshow && $page->qtype == LESSON_BRANCHTABLE) { - echo "
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 "
\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&action=navigation&pageid=$answer->jumpto", - get_string("endofbranch", "lesson")); + redirect("view.php?id=$cm->id&action=navigation&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('
'. + format_text($page->contents, FORMAT_MOODLE, $options). + '
', 'center'); } echo "
\n"; @@ -698,7 +698,7 @@ $value = ""; } echo "
".get_string("youranswer", "lesson"). - ": \n"; //CDC hidden label added. + ": \n"; echo '
'; print_simple_box_end(); echo "
"; $options = new stdClass; $options->para = false; // no

@@ -745,7 +745,7 @@ } } // more than one answer allowed - echo "id}\" $checked />"; //CDC hidden label added. + echo "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 "id}\" $checked />"; //CDC hidden label added. + echo "id}\" $checked />"; } echo "
"; $options = new stdClass; @@ -777,7 +777,6 @@ } break; - /// CDC-FLAG /// 6/14/04 --- changed how matching works case LESSON_MATCHING : echo "
"; // don't suffle answers (could be an option??) @@ -801,7 +800,7 @@ $options->para = false; $options->noclean = true; echo "".format_text($answer->answer,FORMAT_MOODLE,$options).":
"; - echo "id]\" name=\"response[$answer->id]\">"; if (isset($USER->modattempts[$lesson->id])) { $selected = trim($answers[$useranswers[$t]]->response); echo ""; @@ -880,10 +879,10 @@ $fullbuttonhtml .= "\n"; if ($lesson->slideshow) { - echo $fullbuttonhtml . '
'; + echo '
' . $fullbuttonhtml . '
'; $options = new stdClass; $options->noclean = true; - echo format_text($page->contents, FORMAT_MOODLE, $options); + echo '
'.format_text($page->contents, FORMAT_MOODLE, $options).format_text($page->contents).'
';; echo "
"; } else { echo "
"; @@ -901,7 +900,7 @@ echo '
'; print_simple_box_end(); } else { - echo $fullbuttonhtml; + echo '
' . $fullbuttonhtml . '
'; } break; case LESSON_ESSAY : @@ -912,7 +911,7 @@ $value = ""; } echo "
".get_string("youranswer", "lesson").":". - "\n"; //CDC hidden label added. + "\n"; echo "
"; print_simple_box_end(); echo "
\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).")

\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 "

"; if (!$grades = get_records_select("lesson_grades", "lessonid = $lesson->id", "completed")) { @@ -1177,8 +1174,8 @@ echo "id&action=nameforhighscores\">".get_string("clicktopost", "lesson")."
"; } else { if (!$highscores = get_records_select("lesson_high_scores", "lessonid = $lesson->id")) { - echo get_string("youmadehighscore", "lesson", $lesson->maxhighsores)."
"; - echo "id&action=nameforhighscores\">".get_string("clicktopost", "lesson")."
"; + echo get_string("youmadehighscore", "lesson", $lesson->maxhighscores)."
"; + echo "
"; } 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)."
"; - echo "id&action=nameforhighscores\">".get_string("clicktopost", "lesson")."
"; + echo "
"; } else { echo get_string("nothighscore", "lesson", $lesson->maxhighscores)."
"; } } } - echo "
id&action=highscores&link=1\">".get_string("viewhighscores", "lesson").""; + echo "
'; echo "
"; } - /// 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 "
id\">"; - echo ""; - echo "
"; - echo "

".get_string("reviewlesson", "lesson")."

\n"; + echo "
id&pageid=$pageid\">".get_string("reviewlesson", "lesson")."
\n"; } elseif ($lesson->modattempts && isteacher($course->id)) { echo "

".get_string("modattemptsnoteacher", "lesson")."

"; } - echo "

id\">".get_string("mainmenu", "lesson")."

\n"; //CDC Back to the menu (course view). - echo "

id\">".get_string("viewgrades", "lesson")."

\n"; //CDC view grades + echo "
id\">".get_string("mainmenu", "lesson")."
\n"; // Back to the menu (course view). + echo "
id\">".get_string("viewgrades", "lesson")."
\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 "
"; if (isteacheredit($course->id)) { @@ -1316,8 +1309,7 @@ "\n"); } print_simple_box_end(); - echo "
"; //CDC Chris Berri added. - /// CDC-FLAG /// + echo ""; } else { print_heading("id&action=navigation\">".get_string("checknavigation", "lesson")."\n"); @@ -1326,8 +1318,6 @@ echo "id\" />\n"; echo "\n"; echo "\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 "".get_string("backtreeview", "lesson")."
\n"; echo "\n"; if (isteacheredit($course->id)) { - /// CDC-FLAG 6/16/04 /// echo "\n"; - /// CDC-FLAG /// } } else { if($lesson->tree) { @@ -1385,7 +1373,6 @@ } echo "
id&pageid=$page->prevpageid\">". get_string("importquestions", "lesson")." | ". "id&sesskey=".$USER->sesskey."&action=addcluster&pageid=$page->prevpageid\">". @@ -1377,7 +1366,6 @@ "id&action=addpage&pageid=$page->prevpageid\">". get_string("addaquestionpage", "lesson")." ".get_string("here","lesson"). "
\n"; if (isteacheredit($course->id)) { - /// CDC-FLAG 6/16/04 /// echo "\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 "
id&pageid=0\">". get_string("importquestions", "lesson")." | ". "id&sesskey=".$USER->sesskey."&action=addcluster&pageid=0\">". @@ -1395,10 +1382,9 @@ "id&action=addpage&pageid=0\">". get_string("addaquestionpage", "lesson")." ".get_string("here","lesson"). "
\n"; echo "\n"; if (isteacheredit($course->id)) { - /// CDC-FLAG /// 6/16/04 echo "
".format_string($page->title)."  \n"; @@ -1422,7 +1408,7 @@ if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) { echo "
\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 "
\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 = "".get_string("notdefined", "lesson").""; } } $jumptitle = format_string($jumptitle,true); - /// CDC-FLAG /// if ($page->qtype == LESSON_MATCHING) { if ($i == 1) { echo "
".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 "
"; if ($page->qtype != LESSON_ENDOFBRANCH) { echo "
id&pageid=$page->id\">". get_string("importquestions", "lesson")." | ". "id&sesskey=".$USER->sesskey."&action=addcluster&pageid=$page->id\">". @@ -1619,7 +1602,6 @@ get_string("addendofcluster", "lesson")." | ". "id&action=addbranchtable&pageid=$page->id\">". get_string("addabranchtable", "lesson")."
"; - /// 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 "
\n"; - /// CDC-FLAG /// - // NoticeFix both viewAll's if(isset($_GET['display']) && !isset($_GET['viewAll'])) { echo "
".get_string("viewallpages", "lesson")."
\n"; } if($lesson->tree && (isset($_GET['display']) || isset($_GET['viewAll']))) { echo "
".get_string("backtreeview", "lesson")."
\n"; } - /// CDC-FLAG /// print_heading("id&action=navigation\">".get_string("checknavigation", "lesson")."\n"); } @@ -2017,9 +1995,10 @@ echo "
"; } if (isset($_GET['link'])) { - echo "
id\">".get_string("returntocourse", "lesson").""; + echo "
id\">".get_string("returntocourse", "lesson")."
"; } else { - echo "
id\">".get_string("cancel", "lesson")." | id&action=navigation\">".get_string("startlesson", "lesson").""; + echo "
id\">".get_string("cancel", "lesson").' '. + " id&action=navigation\">".get_string("startlesson", "lesson").''; } echo "";