Moved teacherview (lesson editing) out of view.php into edit.php
No code improvements in edit.php as of now. Just works ;)
This commit is contained in:
@@ -59,5 +59,5 @@
|
||||
if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
|
||||
error("Add cluster: answer record not inserted");
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('addedcluster', 'lesson'));
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('addedcluster', 'lesson'));
|
||||
?>
|
||||
@@ -55,7 +55,7 @@
|
||||
if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
|
||||
error("Add end of branch: answer record not inserted");
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('addedanendofbranch', 'lesson'));
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('addedanendofbranch', 'lesson'));
|
||||
} else {
|
||||
notice(get_string("nobranchtablefound", "lesson"), "view.php?id=$cm->id");
|
||||
}
|
||||
|
||||
@@ -46,4 +46,4 @@
|
||||
if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
|
||||
error("Add end of cluster: answer record not inserted");
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('addedendofcluster', 'lesson'));
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('addedendofcluster', 'lesson'));
|
||||
@@ -47,5 +47,5 @@
|
||||
error("Delete: unable to set prev link");
|
||||
}
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('deletedpage', 'lesson'));
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('deletedpage', 'lesson'));
|
||||
?>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
// check to see if the cancel button was pushed
|
||||
if (optional_param('cancel', '', PARAM_ALPHA)) {
|
||||
redirect("view.php?id=$cm->id");
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
}
|
||||
|
||||
$timenow = time();
|
||||
@@ -182,5 +182,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
redirect("view.php?id=$cm->id", get_string('insertedpage', 'lesson'));
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('insertedpage', 'lesson'));
|
||||
?>
|
||||
|
||||
@@ -92,5 +92,5 @@
|
||||
if (!set_field("lesson_pages", "nextpageid", 0, "id", $newlastpageid)) {
|
||||
error("Moveit: unable to update link");
|
||||
}
|
||||
redirect("view.php?id=$cm->id", get_string('movedpage', 'lesson'));
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('movedpage', 'lesson'));
|
||||
?>
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
if (optional_param('cancel', '', PARAM_ALPHA)) {
|
||||
if ($redirect == 'navigation') {
|
||||
// redirect to viewing the page
|
||||
redirect("view.php?id=$cm->id&action=navigation&pageid=$page->id");
|
||||
redirect("$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=navigation&pageid=$page->id");
|
||||
} else {
|
||||
redirect("view.php?id=$cm->id");
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,11 +169,11 @@
|
||||
}
|
||||
|
||||
if ($form->redisplay) {
|
||||
redirect("lesson.php?id=$cm->id&action=editpage&pageid=$page->id&redirect=$redirect");
|
||||
redirect("$CFG->wwwroot/mod/lesson/lesson.php?id=$cm->id&action=editpage&pageid=$page->id&redirect=$redirect");
|
||||
} else if ($redirect == 'navigation') {
|
||||
// takes us back to viewing the page
|
||||
redirect("view.php?id=$cm->id&action=navigation&pageid=$page->id", get_string('updatedpage', 'lesson'));
|
||||
redirect("$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=navigation&pageid=$page->id", get_string('updatedpage', 'lesson'));
|
||||
} else {
|
||||
redirect("view.php?id=$cm->id", get_string('updatedpage', 'lesson'));
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('updatedpage', 'lesson'));
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,394 @@
|
||||
<?php // $Id$
|
||||
/**
|
||||
* Provides the interface for overall authoring of lessons
|
||||
*
|
||||
* @version $Id$
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package lesson
|
||||
**/
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once('locallib.php');
|
||||
require_once('lib.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$display = optional_param('display', 0, PARAM_INT);
|
||||
$mode = optional_param('mode', get_user_preferences('lesson_view', 'collapsed'), PARAM_ALPHA);
|
||||
|
||||
set_user_preference('lesson_view', $mode);
|
||||
|
||||
// set collapsed flag
|
||||
if ($mode == 'collapsed') {
|
||||
$collapsed = true;
|
||||
} else {
|
||||
$collapsed = false;
|
||||
}
|
||||
|
||||
list($cm, $course, $lesson) = lesson_get_basics($id);
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
require_capability('mod/lesson:manage');
|
||||
|
||||
lesson_print_header($cm, $course, $lesson, $mode);
|
||||
|
||||
// get number of pages
|
||||
$npages = count_records('lesson_pages', 'lessonid', $lesson->id);
|
||||
|
||||
if (!$page = get_record_select("lesson_pages", "lessonid = $lesson->id AND prevpageid = 0")) {
|
||||
// if there are no pages give teacher the option to create a new page or a new branch table
|
||||
echo "<div align=\"center\">";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
print_simple_box( "<table cellpadding=\"5\" border=\"0\">\n<tr><th>".get_string("whatdofirst", "lesson")."</th></tr><tr><td>".
|
||||
"<a href=\"import.php?id=$cm->id&pageid=0\">".
|
||||
get_string("importquestions", "lesson")."</a></td></tr><tr><td>".
|
||||
"<a href=\"importppt.php?id=$cm->id&pageid=0\">".
|
||||
get_string("importppt", "lesson")."</a></td></tr><tr><td>".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addbranchtable&pageid=0&firstpage=1\">".
|
||||
get_string("addabranchtable", "lesson")."</a></td></tr><tr><td>".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addpage&pageid=0&firstpage=1\">".
|
||||
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
|
||||
"</a></td></tr></table>\n");
|
||||
}
|
||||
echo '</div>';
|
||||
} else {
|
||||
// print the pages
|
||||
echo "<form name=\"lessonpages\" 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";
|
||||
$branch = false;
|
||||
$singlePage = false;
|
||||
if($collapsed and !$display) {
|
||||
echo "<div align=\"center\">\n";
|
||||
echo "<table><tr><td>\n";
|
||||
lesson_print_tree($page->id, $lesson, $cm->id);
|
||||
echo "</td></tr></table>\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
if($display) {
|
||||
while(true)
|
||||
{
|
||||
if($page->id == $display && $page->qtype == LESSON_BRANCHTABLE) {
|
||||
$branch = true;
|
||||
$singlePage = false;
|
||||
break;
|
||||
} elseif($page->id == $display) {
|
||||
$branch = false;
|
||||
$singlePage = true;
|
||||
break;
|
||||
} elseif ($page->nextpageid) {
|
||||
if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) {
|
||||
error("Teacher view: Next page not found!");
|
||||
}
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo "<table align=\"center\" cellpadding=\"5\" border=\"0\" width=\"80%\">\n";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&pageid=$page->prevpageid\">".
|
||||
get_string("importquestions", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addcluster&pageid=$page->prevpageid\">".
|
||||
get_string("addcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addendofcluster&pageid=$page->prevpageid\">".
|
||||
get_string("addendofcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addbranchtable&pageid=$page->prevpageid\">".
|
||||
get_string("addabranchtable", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addpage&pageid=$page->prevpageid\">".
|
||||
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
|
||||
"</a></small></td></tr>\n";
|
||||
}
|
||||
} else {
|
||||
echo "<table align=\"center\" cellpadding=\"5\" border=\"0\" width=\"80%\">\n";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&pageid=0\">".
|
||||
get_string("importquestions", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addcluster&pageid=0\">".
|
||||
get_string("addcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addbranchtable&pageid=0\">".
|
||||
get_string("addabranchtable", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addpage&pageid=0\">".
|
||||
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
|
||||
"</a></small></td></tr>\n";
|
||||
}
|
||||
}
|
||||
/// end collapsed 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)." \n";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
if ($npages > 1) {
|
||||
echo "<a title=\"".get_string("move")."\" href=\"lesson.php?id=$cm->id&action=move&pageid=$page->id\">\n".
|
||||
"<img src=\"$CFG->pixpath/t/move.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" alt=\"move\" /></a>\n";
|
||||
}
|
||||
echo "<a title=\"".get_string("update")."\" href=\"lesson.php?id=$cm->id&action=editpage&pageid=$page->id\">\n".
|
||||
"<img src=\"$CFG->pixpath/t/edit.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" alt=\"edit\" /></a>\n".
|
||||
"<a title=\"".get_string("delete")."\" href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=confirmdelete&pageid=$page->id\">\n".
|
||||
"<img src=\"$CFG->pixpath/t/delete.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" alt=\"delete\" /></a>\n";
|
||||
}
|
||||
echo "</th></tr>\n";
|
||||
echo "<tr><td colspan=\"2\">\n";
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
print_simple_box(format_text($page->contents, FORMAT_MOODLE, $options), "center");
|
||||
echo "</td></tr>\n";
|
||||
// get the answers in a set order, the id order
|
||||
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 :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
break;
|
||||
case LESSON_SHORTANSWER :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
if ($page->qoption) {
|
||||
echo " - ".get_string("casesensitive", "lesson");
|
||||
}
|
||||
break;
|
||||
case LESSON_MULTICHOICE :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
if ($page->qoption) {
|
||||
echo " - ".get_string("multianswer", "lesson");
|
||||
}
|
||||
break;
|
||||
case LESSON_MATCHING :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
echo get_string("firstanswershould", "lesson");
|
||||
break;
|
||||
case LESSON_TRUEFALSE :
|
||||
case LESSON_NUMERICAL :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
break;
|
||||
case LESSON_BRANCHTABLE :
|
||||
echo get_string("branchtable", "lesson");
|
||||
break;
|
||||
case LESSON_ENDOFBRANCH :
|
||||
echo get_string("endofbranch", "lesson");
|
||||
break;
|
||||
case LESSON_CLUSTER :
|
||||
echo get_string("clustertitle", "lesson");
|
||||
break;
|
||||
case LESSON_ENDOFCLUSTER :
|
||||
echo get_string("endofclustertitle", "lesson");
|
||||
break;
|
||||
}
|
||||
echo "</b></td></tr>\n";
|
||||
$i = 1;
|
||||
$n = 0;
|
||||
foreach ($answers as $answer) {
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td align=\"right\" valign=\"top\" width=\"20%\">\n";
|
||||
if ($lesson->custom) {
|
||||
// if the score is > 0, then it is correct
|
||||
if ($answer->score > 0) {
|
||||
echo "<b><u>".get_string("answer", "lesson")." $i:</u></b> \n";
|
||||
} else {
|
||||
echo "<b>".get_string("answer", "lesson")." $i:</b> \n";
|
||||
}
|
||||
} else {
|
||||
if (lesson_iscorrect($page->id, $answer->jumpto)) {
|
||||
// underline correct answers
|
||||
echo "<b><u>".get_string("answer", "lesson")." $i:</u></b> \n";
|
||||
} else {
|
||||
echo "<b>".get_string("answer", "lesson")." $i:</b> \n";
|
||||
}
|
||||
}
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
echo "</td><td width=\"80%\">\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><b>".get_string("response", "lesson")." $i:</b> \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->response, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_MATCHING:
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
if ($n < 2) {
|
||||
if ($answer->answer != NULL) {
|
||||
if ($n == 0) {
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><b>".get_string("correctresponse", "lesson").":</b> \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
} else {
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><b>".get_string("wrongresponse", "lesson").":</b> \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
$n++;
|
||||
$i--;
|
||||
} else {
|
||||
echo "<tr><td align=\"right\" valign=\"top\" width=\"20%\">\n";
|
||||
if ($lesson->custom) {
|
||||
// if the score is > 0, then it is correct
|
||||
if ($answer->score > 0) {
|
||||
echo "<b><u>".get_string("answer", "lesson")." $i:</u></b> \n";
|
||||
} else {
|
||||
echo "<b>".get_string("answer", "lesson")." $i:</b> \n";
|
||||
}
|
||||
} else {
|
||||
if (lesson_iscorrect($page->id, $answer->jumpto)) {
|
||||
// underline correct answers
|
||||
echo "<b><u>".get_string("answer", "lesson")." $i:</u></b> \n";
|
||||
} else {
|
||||
echo "<b>".get_string("answer", "lesson")." $i:</b> \n";
|
||||
}
|
||||
}
|
||||
echo "</td><td width=\"80%\">\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><b>".get_string("matchesanswer", "lesson")." $i:</b> \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->response, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
case LESSON_BRANCHTABLE:
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
echo "<tr><td align=\"right\" valign=\"top\" width=\"20%\">\n";
|
||||
echo "<b>".get_string("description", "lesson")." $i:</b> \n";
|
||||
echo "</td><td width=\"80%\">\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
if ($answer->jumpto == 0) {
|
||||
$jumptitle = get_string("thispage", "lesson");
|
||||
} elseif ($answer->jumpto == LESSON_NEXTPAGE) {
|
||||
$jumptitle = get_string("nextpage", "lesson");
|
||||
} elseif ($answer->jumpto == LESSON_EOL) {
|
||||
$jumptitle = get_string("endoflesson", "lesson");
|
||||
} 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) {
|
||||
$jumptitle = get_string("randompageinbranch", "lesson");
|
||||
} elseif ($answer->jumpto == LESSON_RANDOMBRANCH) {
|
||||
$jumptitle = get_string("randombranch", "lesson");
|
||||
} elseif ($answer->jumpto == LESSON_CLUSTERJUMP) {
|
||||
$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);
|
||||
if ($page->qtype == LESSON_MATCHING) {
|
||||
if ($i == 1) {
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("correctanswerscore", "lesson").":";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$answer->score</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("correctanswerjump", "lesson").":";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$jumptitle</td></tr>\n";
|
||||
} elseif ($i == 2) {
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("wronganswerscore", "lesson").":";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$answer->score</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("wronganswerjump", "lesson").":";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$jumptitle</td></tr>\n";
|
||||
}
|
||||
} else {
|
||||
if ($lesson->custom and
|
||||
$page->qtype != LESSON_BRANCHTABLE and
|
||||
$page->qtype != LESSON_ENDOFBRANCH and
|
||||
$page->qtype != LESSON_CLUSTER and
|
||||
$page->qtype != LESSON_ENDOFCLUSTER) {
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("score", "lesson")." $i:";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$answer->score</td></tr>\n";
|
||||
}
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("jump", "lesson")." $i:";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$jumptitle</td></tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
// 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=\"";
|
||||
if ($page->qtype == LESSON_BRANCHTABLE) {
|
||||
echo get_string("checkbranchtable", "lesson");
|
||||
} else {
|
||||
echo get_string("checkquestion", "lesson");
|
||||
}
|
||||
echo "\" onclick=\"document.lessonpages.pageid.value=$page->id;".
|
||||
"document.lessonpages.submit();\" />";
|
||||
}
|
||||
echo " </td></tr>\n";
|
||||
}
|
||||
echo "</table></td></tr>\n";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&pageid=$page->id\">".
|
||||
get_string("importquestions", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addcluster&pageid=$page->id\">".
|
||||
get_string("addcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addendofcluster&pageid=$page->id\">".
|
||||
get_string("addendofcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addbranchtable&pageid=$page->id\">".
|
||||
get_string("addabranchtable", "lesson")."</a><br />";
|
||||
// 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) {
|
||||
$nextqtype = get_field("lesson_pages", "qtype", "id", $page->nextpageid);
|
||||
}
|
||||
if (($page->qtype != LESSON_ENDOFBRANCH) and ($nextqtype != LESSON_ENDOFBRANCH)) {
|
||||
echo "<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addendofbranch&pageid=$page->id\">".
|
||||
get_string("addanendofbranch", "lesson")."</a> | ";
|
||||
}
|
||||
echo "<a href=\"lesson.php?id=$cm->id&action=addpage&pageid=$page->id\">".
|
||||
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
|
||||
"</a></small></td></tr>\n";
|
||||
}
|
||||
// echo "<tr><td>\n";
|
||||
// check the prev links - fix (silently) if necessary - there was a bug in
|
||||
// versions 1 and 2 when add new pages. Not serious then as the backwards
|
||||
// links were not used in those versions
|
||||
if (isset($prevpageid)) {
|
||||
if ($page->prevpageid != $prevpageid) {
|
||||
// fix it
|
||||
set_field("lesson_pages", "prevpageid", $prevpageid, "id", $page->id);
|
||||
if ($CFG->debug) {
|
||||
echo "<p>***prevpageid of page $page->id set to $prevpageid***";
|
||||
}
|
||||
}
|
||||
}
|
||||
$prevpageid = $page->id;
|
||||
// move to next page
|
||||
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) {
|
||||
if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) {
|
||||
error("Teacher view: Next page not found!");
|
||||
}
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // end of else from above collapsed code!!!
|
||||
|
||||
echo "</table></form>\n";
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
?>
|
||||
@@ -1352,9 +1352,9 @@ function lesson_print_tree($pageid, $lesson, $cmid) {
|
||||
while ($pageid != 0) {
|
||||
echo "<tr><td>";
|
||||
if(($pages[$pageid]->qtype != LESSON_BRANCHTABLE) && ($pages[$pageid]->qtype != LESSON_ENDOFBRANCH)) {
|
||||
$output = "<a style='color:#DF041E;' href=\"view.php?id=$cmid&display=".$pages[$pageid]->id."\">".format_string($pages[$pageid]->title,true)."</a>\n";
|
||||
$output = "<a style='color:#DF041E;' href=\"$CFG->wwwroot/mod/lesson/edit.php?id=$cmid&display=".$pages[$pageid]->id."\">".format_string($pages[$pageid]->title,true)."</a>\n";
|
||||
} else {
|
||||
$output = "<a href=\"view.php?id=$cmid&display=".$pages[$pageid]->id."\">".format_string($pages[$pageid]->title,true)."</a>\n";
|
||||
$output = "<a href=\"$CFG->wwwroot/mod/lesson/edit.php?id=$cmid&display=".$pages[$pageid]->id."\">".format_string($pages[$pageid]->title,true)."</a>\n";
|
||||
|
||||
if($answers = get_records_select("lesson_answers", "lessonid = $lesson->id and pageid = $pageid")) {
|
||||
$output .= "Jumps to: ";
|
||||
|
||||
+13
-20
@@ -36,7 +36,7 @@
|
||||
$counts->student = $course->student;
|
||||
|
||||
|
||||
$row[] = new tabobject('teacherview', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id", get_string('edit'), get_string('editlesson', 'lesson', format_string($lesson->name)));
|
||||
$row[] = new tabobject('edit', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('edit'), get_string('editlesson', 'lesson', format_string($lesson->name)));
|
||||
$row[] = new tabobject('navigation', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=navigation", get_string('preview', 'lesson'), get_string('previewlesson', 'lesson', format_string($lesson->name)));
|
||||
$row[] = new tabobject('reports', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id", get_string('reports', 'lesson'), get_string('viewreports', 'lesson', $counts));
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
@@ -48,10 +48,11 @@
|
||||
|
||||
$tabs[] = $row;
|
||||
|
||||
/// sub tabs for reports (overview and detail)
|
||||
|
||||
switch ($currenttab) {
|
||||
case 'reportoverview':
|
||||
case 'reportdetail':
|
||||
/// sub tabs for reports (overview and detail)
|
||||
$inactive[] = 'reports';
|
||||
|
||||
$row = array();
|
||||
@@ -59,24 +60,16 @@
|
||||
$row[] = new tabobject('reportdetail', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=reportdetail", get_string('detailedstats', 'lesson'));
|
||||
$tabs[] = $row;
|
||||
break;
|
||||
}
|
||||
|
||||
/// sub tabs for teacher view (collapsed and expanded aka full)
|
||||
if ($currenttab == 'teacherview') {
|
||||
// use user preferences to remember which edit mode the user has selected
|
||||
if (empty($mode)) {
|
||||
$mode = get_user_preferences('lesson_view', 'collapsed');
|
||||
} else {
|
||||
set_user_preference('lesson_view', $mode);
|
||||
}
|
||||
|
||||
$inactive[] = 'teacherview';
|
||||
$currenttab = $mode;
|
||||
|
||||
$row = array();
|
||||
$row[] = new tabobject('collapsed', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=teacherview&mode=collapsed", get_string('collapsed', 'lesson'));
|
||||
$row[] = new tabobject('full', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&=teacherview&mode=full", get_string('full', 'lesson'));
|
||||
$tabs[] = $row;
|
||||
case 'collapsed':
|
||||
case 'full':
|
||||
/// sub tabs for edit view (collapsed and expanded aka full)
|
||||
$inactive[] = 'edit';
|
||||
|
||||
$row = array();
|
||||
$row[] = new tabobject('collapsed', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id&mode=collapsed", get_string('collapsed', 'lesson'));
|
||||
$row[] = new tabobject('full', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id&mode=full", get_string('full', 'lesson'));
|
||||
$tabs[] = $row;
|
||||
break;
|
||||
}
|
||||
|
||||
print_tabs($tabs, $currenttab, $inactive);
|
||||
|
||||
+2
-372
@@ -10,8 +10,7 @@
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$pageid = optional_param('pageid', NULL, PARAM_INT); // Lesson Page ID
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$display = optional_param('display', 0, PARAM_INT); // for teacherview action
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA); // for eacherview action todo use user pref
|
||||
|
||||
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
|
||||
@@ -45,7 +44,7 @@
|
||||
// moved the action up because I needed to know what the action will be before the header is printed
|
||||
if (empty($action)) {
|
||||
if (has_capability('mod/lesson:manage', $context)) {
|
||||
$action = 'teacherview';
|
||||
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id");
|
||||
} elseif (time() < $lesson->available) {
|
||||
print_header($course->shortname .': '. format_string($lesson->name), $course->fullname,
|
||||
$navigation .'<a href="index.php?id='. $course->id .'">'. $strlessons .'</a> -> '.
|
||||
@@ -1172,375 +1171,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************teacher view **************************************/
|
||||
elseif ($action == 'teacherview') {
|
||||
// set collapsed flag
|
||||
if ($mode == 'collapsed') {
|
||||
$collapsed = true;
|
||||
} else {
|
||||
$collapsed = false;
|
||||
}
|
||||
|
||||
print_heading_with_help(format_string($lesson->name,true), "overview", "lesson");
|
||||
|
||||
// get number of pages
|
||||
$npages = count_records('lesson_pages', 'lessonid', $lesson->id);
|
||||
|
||||
if (!$page = get_record_select("lesson_pages", "lessonid = $lesson->id AND prevpageid = 0")) {
|
||||
// if there are no pages give teacher the option to create a new page or a new branch table
|
||||
echo "<div align=\"center\">";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
print_simple_box( "<table cellpadding=\"5\" border=\"0\">\n<tr><th>".get_string("whatdofirst", "lesson")."</th></tr><tr><td>".
|
||||
"<a href=\"import.php?id=$cm->id&pageid=0\">".
|
||||
get_string("importquestions", "lesson")."</a></td></tr><tr><td>".
|
||||
"<a href=\"importppt.php?id=$cm->id&pageid=0\">".
|
||||
get_string("importppt", "lesson")."</a></td></tr><tr><td>".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addbranchtable&pageid=0&firstpage=1\">".
|
||||
get_string("addabranchtable", "lesson")."</a></td></tr><tr><td>".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addpage&pageid=0&firstpage=1\">".
|
||||
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
|
||||
"</a></td></tr></table>\n");
|
||||
}
|
||||
echo '</div>';
|
||||
} else {
|
||||
// print the pages
|
||||
echo "<form name=\"lessonpages\" 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";
|
||||
$branch = false;
|
||||
$singlePage = false;
|
||||
if($collapsed and !$display) {
|
||||
echo "<div align=\"center\">\n";
|
||||
echo "<table><tr><td>\n";
|
||||
lesson_print_tree($page->id, $lesson, $cm->id);
|
||||
echo "</td></tr></table>\n";
|
||||
echo "</div>\n";
|
||||
} else {
|
||||
if($display) {
|
||||
while(true)
|
||||
{
|
||||
if($page->id == $display && $page->qtype == LESSON_BRANCHTABLE) {
|
||||
$branch = true;
|
||||
$singlePage = false;
|
||||
break;
|
||||
} elseif($page->id == $display) {
|
||||
$branch = false;
|
||||
$singlePage = true;
|
||||
break;
|
||||
} elseif ($page->nextpageid) {
|
||||
if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) {
|
||||
error("Teacher view: Next page not found!");
|
||||
}
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo "<table align=\"center\" cellpadding=\"5\" border=\"0\" width=\"80%\">\n";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&pageid=$page->prevpageid\">".
|
||||
get_string("importquestions", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addcluster&pageid=$page->prevpageid\">".
|
||||
get_string("addcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addendofcluster&pageid=$page->prevpageid\">".
|
||||
get_string("addendofcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addbranchtable&pageid=$page->prevpageid\">".
|
||||
get_string("addabranchtable", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addpage&pageid=$page->prevpageid\">".
|
||||
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
|
||||
"</a></small></td></tr>\n";
|
||||
}
|
||||
} else {
|
||||
echo "<table align=\"center\" cellpadding=\"5\" border=\"0\" width=\"80%\">\n";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&pageid=0\">".
|
||||
get_string("importquestions", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addcluster&pageid=0\">".
|
||||
get_string("addcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addbranchtable&pageid=0\">".
|
||||
get_string("addabranchtable", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addpage&pageid=0\">".
|
||||
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
|
||||
"</a></small></td></tr>\n";
|
||||
}
|
||||
}
|
||||
/// end collapsed 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)." \n";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
if ($npages > 1) {
|
||||
echo "<a title=\"".get_string("move")."\" href=\"lesson.php?id=$cm->id&action=move&pageid=$page->id\">\n".
|
||||
"<img src=\"$CFG->pixpath/t/move.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" alt=\"move\" /></a>\n";
|
||||
}
|
||||
echo "<a title=\"".get_string("update")."\" href=\"lesson.php?id=$cm->id&action=editpage&pageid=$page->id\">\n".
|
||||
"<img src=\"$CFG->pixpath/t/edit.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" alt=\"edit\" /></a>\n".
|
||||
"<a title=\"".get_string("delete")."\" href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=confirmdelete&pageid=$page->id\">\n".
|
||||
"<img src=\"$CFG->pixpath/t/delete.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" alt=\"delete\" /></a>\n";
|
||||
}
|
||||
echo "</th></tr>\n";
|
||||
echo "<tr><td colspan=\"2\">\n";
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
print_simple_box(format_text($page->contents, FORMAT_MOODLE, $options), "center");
|
||||
echo "</td></tr>\n";
|
||||
// get the answers in a set order, the id order
|
||||
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 :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
break;
|
||||
case LESSON_SHORTANSWER :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
if ($page->qoption) {
|
||||
echo " - ".get_string("casesensitive", "lesson");
|
||||
}
|
||||
break;
|
||||
case LESSON_MULTICHOICE :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
if ($page->qoption) {
|
||||
echo " - ".get_string("multianswer", "lesson");
|
||||
}
|
||||
break;
|
||||
case LESSON_MATCHING :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
echo get_string("firstanswershould", "lesson");
|
||||
break;
|
||||
case LESSON_TRUEFALSE :
|
||||
case LESSON_NUMERICAL :
|
||||
echo $LESSON_QUESTION_TYPE[$page->qtype];
|
||||
break;
|
||||
case LESSON_BRANCHTABLE :
|
||||
echo get_string("branchtable", "lesson");
|
||||
break;
|
||||
case LESSON_ENDOFBRANCH :
|
||||
echo get_string("endofbranch", "lesson");
|
||||
break;
|
||||
case LESSON_CLUSTER :
|
||||
echo get_string("clustertitle", "lesson");
|
||||
break;
|
||||
case LESSON_ENDOFCLUSTER :
|
||||
echo get_string("endofclustertitle", "lesson");
|
||||
break;
|
||||
}
|
||||
echo "</b></td></tr>\n";
|
||||
$i = 1;
|
||||
$n = 0;
|
||||
foreach ($answers as $answer) {
|
||||
switch ($page->qtype) {
|
||||
case LESSON_MULTICHOICE:
|
||||
case LESSON_TRUEFALSE:
|
||||
case LESSON_SHORTANSWER:
|
||||
case LESSON_NUMERICAL:
|
||||
echo "<tr><td align=\"right\" valign=\"top\" width=\"20%\">\n";
|
||||
if ($lesson->custom) {
|
||||
// if the score is > 0, then it is correct
|
||||
if ($answer->score > 0) {
|
||||
echo "<b><u>".get_string("answer", "lesson")." $i:</u></b> \n";
|
||||
} else {
|
||||
echo "<b>".get_string("answer", "lesson")." $i:</b> \n";
|
||||
}
|
||||
} else {
|
||||
if (lesson_iscorrect($page->id, $answer->jumpto)) {
|
||||
// underline correct answers
|
||||
echo "<b><u>".get_string("answer", "lesson")." $i:</u></b> \n";
|
||||
} else {
|
||||
echo "<b>".get_string("answer", "lesson")." $i:</b> \n";
|
||||
}
|
||||
}
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
echo "</td><td width=\"80%\">\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><b>".get_string("response", "lesson")." $i:</b> \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->response, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
case LESSON_MATCHING:
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
if ($n < 2) {
|
||||
if ($answer->answer != NULL) {
|
||||
if ($n == 0) {
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><b>".get_string("correctresponse", "lesson").":</b> \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
} else {
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><b>".get_string("wrongresponse", "lesson").":</b> \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
$n++;
|
||||
$i--;
|
||||
} else {
|
||||
echo "<tr><td align=\"right\" valign=\"top\" width=\"20%\">\n";
|
||||
if ($lesson->custom) {
|
||||
// if the score is > 0, then it is correct
|
||||
if ($answer->score > 0) {
|
||||
echo "<b><u>".get_string("answer", "lesson")." $i:</u></b> \n";
|
||||
} else {
|
||||
echo "<b>".get_string("answer", "lesson")." $i:</b> \n";
|
||||
}
|
||||
} else {
|
||||
if (lesson_iscorrect($page->id, $answer->jumpto)) {
|
||||
// underline correct answers
|
||||
echo "<b><u>".get_string("answer", "lesson")." $i:</u></b> \n";
|
||||
} else {
|
||||
echo "<b>".get_string("answer", "lesson")." $i:</b> \n";
|
||||
}
|
||||
}
|
||||
echo "</td><td width=\"80%\">\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" valign=\"top\"><b>".get_string("matchesanswer", "lesson")." $i:</b> \n";
|
||||
echo "</td><td>\n";
|
||||
echo format_text($answer->response, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
break;
|
||||
case LESSON_BRANCHTABLE:
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
echo "<tr><td align=\"right\" valign=\"top\" width=\"20%\">\n";
|
||||
echo "<b>".get_string("description", "lesson")." $i:</b> \n";
|
||||
echo "</td><td width=\"80%\">\n";
|
||||
echo format_text($answer->answer, FORMAT_MOODLE, $options);
|
||||
echo "</td></tr>\n";
|
||||
break;
|
||||
}
|
||||
if ($answer->jumpto == 0) {
|
||||
$jumptitle = get_string("thispage", "lesson");
|
||||
} elseif ($answer->jumpto == LESSON_NEXTPAGE) {
|
||||
$jumptitle = get_string("nextpage", "lesson");
|
||||
} elseif ($answer->jumpto == LESSON_EOL) {
|
||||
$jumptitle = get_string("endoflesson", "lesson");
|
||||
} 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) {
|
||||
$jumptitle = get_string("randompageinbranch", "lesson");
|
||||
} elseif ($answer->jumpto == LESSON_RANDOMBRANCH) {
|
||||
$jumptitle = get_string("randombranch", "lesson");
|
||||
} elseif ($answer->jumpto == LESSON_CLUSTERJUMP) {
|
||||
$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);
|
||||
if ($page->qtype == LESSON_MATCHING) {
|
||||
if ($i == 1) {
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("correctanswerscore", "lesson").":";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$answer->score</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("correctanswerjump", "lesson").":";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$jumptitle</td></tr>\n";
|
||||
} elseif ($i == 2) {
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("wronganswerscore", "lesson").":";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$answer->score</td></tr>\n";
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("wronganswerjump", "lesson").":";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$jumptitle</td></tr>\n";
|
||||
}
|
||||
} else {
|
||||
if ($lesson->custom and
|
||||
$page->qtype != LESSON_BRANCHTABLE and
|
||||
$page->qtype != LESSON_ENDOFBRANCH and
|
||||
$page->qtype != LESSON_CLUSTER and
|
||||
$page->qtype != LESSON_ENDOFCLUSTER) {
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("score", "lesson")." $i:";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$answer->score</td></tr>\n";
|
||||
}
|
||||
echo "<tr><td align=\"right\" width=\"20%\"><b>".get_string("jump", "lesson")." $i:";
|
||||
echo "</b></td><td width=\"80%\">\n";
|
||||
echo "$jumptitle</td></tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
// 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=\"";
|
||||
if ($page->qtype == LESSON_BRANCHTABLE) {
|
||||
echo get_string("checkbranchtable", "lesson");
|
||||
} else {
|
||||
echo get_string("checkquestion", "lesson");
|
||||
}
|
||||
echo "\" onclick=\"document.lessonpages.pageid.value=$page->id;".
|
||||
"document.lessonpages.submit();\" />";
|
||||
}
|
||||
echo " </td></tr>\n";
|
||||
}
|
||||
echo "</table></td></tr>\n";
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
echo "<tr><td align=\"left\"><small><a href=\"import.php?id=$cm->id&pageid=$page->id\">".
|
||||
get_string("importquestions", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addcluster&pageid=$page->id\">".
|
||||
get_string("addcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addendofcluster&pageid=$page->id\">".
|
||||
get_string("addendofcluster", "lesson")."</a> | ".
|
||||
"<a href=\"lesson.php?id=$cm->id&action=addbranchtable&pageid=$page->id\">".
|
||||
get_string("addabranchtable", "lesson")."</a><br />";
|
||||
// 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) {
|
||||
$nextqtype = get_field("lesson_pages", "qtype", "id", $page->nextpageid);
|
||||
}
|
||||
if (($page->qtype != LESSON_ENDOFBRANCH) and ($nextqtype != LESSON_ENDOFBRANCH)) {
|
||||
echo "<a href=\"lesson.php?id=$cm->id&sesskey=".$USER->sesskey."&action=addendofbranch&pageid=$page->id\">".
|
||||
get_string("addanendofbranch", "lesson")."</a> | ";
|
||||
}
|
||||
echo "<a href=\"lesson.php?id=$cm->id&action=addpage&pageid=$page->id\">".
|
||||
get_string("addaquestionpage", "lesson")." ".get_string("here","lesson").
|
||||
"</a></small></td></tr>\n";
|
||||
}
|
||||
// echo "<tr><td>\n";
|
||||
// check the prev links - fix (silently) if necessary - there was a bug in
|
||||
// versions 1 and 2 when add new pages. Not serious then as the backwards
|
||||
// links were not used in those versions
|
||||
if (isset($prevpageid)) {
|
||||
if ($page->prevpageid != $prevpageid) {
|
||||
// fix it
|
||||
set_field("lesson_pages", "prevpageid", $prevpageid, "id", $page->id);
|
||||
if ($CFG->debug) {
|
||||
echo "<p>***prevpageid of page $page->id set to $prevpageid***";
|
||||
}
|
||||
}
|
||||
}
|
||||
$prevpageid = $page->id;
|
||||
// move to next page
|
||||
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) {
|
||||
if (!$page = get_record("lesson_pages", "id", $page->nextpageid)) {
|
||||
error("Teacher view: Next page not found!");
|
||||
}
|
||||
} else {
|
||||
// last page reached
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // end of else from above collapsed code!!!
|
||||
|
||||
echo "</table></form>\n";
|
||||
}
|
||||
}
|
||||
|
||||
/*************** no man's land **************************************/
|
||||
else {
|
||||
error("Fatal Error: Unknown Action: ".$action."\n");
|
||||
|
||||
Reference in New Issue
Block a user