From: julmis Date: Wed, 4 Aug 2004 18:13:09 +0000 (+0000) Subject: Move use_html_editor() outside of
area. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=bcaba84417a1167aefaf20e6293df687a6ac3dfa;p=moodle.git Move use_html_editor() outside of area. Gives IE more time to load the page. (body missing problem). --- diff --git a/mod/lesson/view.php b/mod/lesson/view.php index e61962dbc8..c758dfc6ab 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -34,8 +34,8 @@ $strlesson = get_string("modulename", "lesson"); print_header("$course->shortname: $lesson->name", "$course->fullname", - "$navigation id>$strlessons -> id\">$lesson->name", - "", "", true, update_module_button($cm->id, $course->id, $strlesson), + "$navigation id>$strlessons -> id\">$lesson->name", + "", "", true, update_module_button($cm->id, $course->id, $strlesson), navmenu($course, $cm)); // set up some general variables @@ -60,7 +60,7 @@ // display individual pages and their sets of answers // if pageid is EOL then the end of the lesson has been reached print_heading($lesson->name); - if (empty($pageid)) { + if (empty($pageid)) { add_to_log($course->id, "lesson", "start", "view.php?id=$cm->id", "$lesson->id", $cm->id); // if no pageid given see if the lesson has been started if ($grades = get_records_select("lesson_grades", "lessonid = $lesson->id AND userid = $USER->id", @@ -73,8 +73,8 @@ print_heading(get_string("attempt", "lesson", $retries + 1)); } // if there are any questions have been answered correctly in this attempt - if ($attempts = get_records_select("lesson_attempts", - "lessonid = $lesson->id AND userid = $USER->id AND retry = $retries AND + if ($attempts = get_records_select("lesson_attempts", + "lessonid = $lesson->id AND userid = $USER->id AND retry = $retries AND correct = 1", "timeseen DESC")) { // get the first page if (!$firstpageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, @@ -87,7 +87,7 @@ if ($jumpto == 0) { // unlikely value! $lastpageseen = $attempt->pageid; } elseif ($jumpto == LESSON_NEXTPAGE) { - if (!$lastpageseen = get_field("lesson_pages", "nextpageid", "id", + if (!$lastpageseen = get_field("lesson_pages", "nextpageid", "id", $attempt->pageid)) { // no nextpage go to end of lesson $lastpageseen = LESSON_EOL; @@ -95,7 +95,7 @@ } else { $lastpageseen = $jumpto; } - break; // only look at the latest correct attempt + break; // only look at the latest correct attempt } if ($lastpageseen != $firstpageid) { echo "\n"; @@ -118,10 +118,10 @@ break; } if (!$lesson->retake) { - redirect("../../course/view.php?id=$course->id", get_string("alreadytaken", "lesson")); + redirect("../../course/view.php?id=$course->id", get_string("alreadytaken", "lesson")); // allow student to retake course even if they have the maximum grade // } elseif ($bestgrade == 100) { - // redirect("../../course/view.php?id=$course->id", get_string("maximumgradeachieved", + // redirect("../../course/view.php?id=$course->id", get_string("maximumgradeachieved", // "lesson")); } } @@ -135,7 +135,7 @@ if (!$page = get_record("lesson_pages", "id", $pageid)) { error("Navigation: the page record not found"); } - // before we output everything check to see if the page is a EOB, if so jump directly + // before we output everything check to see if the page is a EOB, if so jump directly // to it's associated branch table if ($page->qtype == LESSON_ENDOFBRANCH) { if ($answers = get_records("lesson_answers", "pageid", $page->id, "id")) { @@ -158,7 +158,7 @@ if ($lesson->minquestions and isstudent($course->id)) { // tell student how many questions they have seen, how many are required and their grade $ntries = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id); - $nviewed = count_records("lesson_attempts", "lessonid", $lesson->id, "userid", + $nviewed = count_records("lesson_attempts", "lessonid", $lesson->id, "userid", $USER->id, "retry", $ntries); if ($nviewed) { echo "

".get_string("numberofpagesviewed", "lesson", $nviewed). @@ -178,7 +178,7 @@ } echo get_string("numberofcorrectanswers", "lesson", $ncorrect)."
\n"; $thegrade = intval(100 * $ncorrect / $nviewed); - echo get_string("yourcurrentgradeis", "lesson", + echo get_string("yourcurrentgradeis", "lesson", number_format($thegrade * $lesson->grade / 100, 1)). " (".get_string("outof", "lesson", $lesson->grade).")

\n"; } @@ -212,7 +212,7 @@ echo "id}\">"; echo ""; $options->para = false; // no

- echo format_text(trim($answer->answer), FORMAT_MOODLE, $options); + echo format_text(trim($answer->answer), FORMAT_MOODLE, $options); echo ""; } echo ''; @@ -226,7 +226,7 @@ foreach ($answers as $answer) { echo ""; if ($page->qoption) { - // more than one answer allowed + // more than one answer allowed echo "id}\">"; } else { // only one answer allowed @@ -234,7 +234,7 @@ } echo ""; $options->para = false; // no

- echo format_text(trim($answer->answer), FORMAT_MOODLE, $options); + echo format_text(trim($answer->answer), FORMAT_MOODLE, $options); echo ""; $i++; } @@ -248,7 +248,7 @@ get_string("pleasecheckoneanswer", "lesson")."\">

\n"; } break; - + case LESSON_MATCHING : echo ""; // don't suffle answers (could be an option??) @@ -298,14 +298,14 @@ if ($lesson->nextpagedefault) { // in Flash Card mode... // ...first get number of retakes - $nretakes = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id); + $nretakes = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id); // ...then get the page ids (lessonid the 5th param is needed to make get_records play) $allpages = get_records("lesson_pages", "lessonid", $lesson->id, "id", "id,lessonid"); shuffle ($allpages); $found = false; if ($lesson->nextpagedefault == LESSON_UNSEENPAGE) { foreach ($allpages as $thispage) { - if (!count_records("lesson_attempts", "pageid", $thispage->id, "userid", + if (!count_records("lesson_attempts", "pageid", $thispage->id, "userid", $USER->id, "retry", $nretakes)) { $found = true; break; @@ -352,10 +352,10 @@ print_simple_box_start("center"); $ntries = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id); if (isstudent($course->id)) { - if ($nviewed = count_records("lesson_attempts", "lessonid", $lesson->id, "userid", + if ($nviewed = count_records("lesson_attempts", "lessonid", $lesson->id, "userid", $USER->id, "retry", $ntries)) { // count the number of distinct correct pages - if ($correctpages = get_records_select("lesson_attempts", "lessonid = $lesson->id AND + if ($correctpages = get_records_select("lesson_attempts", "lessonid = $lesson->id AND userid = $USER->id AND retry = $ntries AND correct = 1")) { foreach ($correctpages as $correctpage) { $temp[$correctpage->pageid] = 1; @@ -369,7 +369,7 @@ if ($lesson->minquestions) { if ($nviewed < $lesson->minquestions) { // print a warning and set nviewed to minquestions - echo "

".get_string("youshouldview", "lesson", + echo "

".get_string("youshouldview", "lesson", $lesson->minquestions)." ".get_string("pages", "lesson")."

\n"; $nviewed = $lesson->minquestions; } @@ -377,7 +377,7 @@ echo "

".get_string("numberofcorrectanswers", "lesson", $ncorrect). "

\n"; $thegrade = intval(100 * $ncorrect / $nviewed); - echo "

".get_string("gradeis", "lesson", + echo "

".get_string("gradeis", "lesson", number_format($thegrade * $lesson->grade / 100, 1)). " (".get_string("outof", "lesson", $lesson->grade).")

\n"; $grade->lessonid = $lesson->id; @@ -390,21 +390,21 @@ } else { print_string("noattemptrecordsfound", "lesson"); $thegrade = 0; - } - } else { + } + } else { // display for teacher echo "

".get_string("displayofgrade", "lesson")."

\n"; } print_simple_box_end(); - print_continue("../../course/view.php?id=$course->id"); + print_continue("../../course/view.php?id=$course->id"); } - + } /*******************teacher view **************************************/ elseif ($action == 'teacherview') { - print_heading_with_help($lesson->name, "overview", "lesson"); + print_heading_with_help($lesson->name, "overview", "lesson"); // get number of pages if ($page = get_record_select("lesson_pages", "lessonid = $lesson->id AND prevpageid = 0")) { $npages = 1; @@ -437,7 +437,6 @@ echo "\n"; echo "\n"; + echo "\n"; echo "\n"; @@ -532,7 +532,7 @@ case LESSON_NUMERICAL : echo $LESSON_QUESTION_TYPE[$page->qtype]; break; - case LESSON_BRANCHTABLE : + case LESSON_BRANCHTABLE : echo get_string("branchtable", "lesson"); break; case LESSON_ENDOFBRANCH : @@ -560,7 +560,7 @@ echo "\n"; echo "\n"; break; case LESSON_BRANCHTABLE: @@ -634,7 +634,7 @@ } } $prevpageid = $page->id; - // move to next page + // move to next page if ($page->nextpageid) { if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) { error("Teacher view: Next page not found!"); @@ -652,9 +652,9 @@ /*************** no man's land **************************************/ - else { - error("Fatal Error: Unknown Action: ".$action."\n"); - } + else { + error("Fatal Error: Unknown Action: ".$action."\n"); + } /// Finish the page print_footer($course);
"; echo get_string("pagecontents", "lesson").":
\n"; print_textarea($usehtmleditor, 25, 70, 630, 400, "contents"); - use_html_editor("contents"); echo "
".get_string("questiontype", "lesson").": \n"; choose_from_menu($LESSON_QUESTION_TYPE, "qtype", LESSON_MULTICHOICE, ""); @@ -470,6 +469,7 @@ id&pageid=0\">".get_string("importquestions", "lesson")."\n"); @@ -502,7 +502,7 @@ "id&action=confirmdelete&pageid=$page->id\">\n". "\n"; } - echo "
\n"; print_simple_box(format_text($page->contents), "center"); echo "
".get_string("response", "lesson")." $i: \n"; echo "\n"; - echo format_text($answer->response); + echo format_text($answer->response); echo "