Skip to content
Browse files

Added a lot of new features to lesson mod. Check them out :)

MarkNielsen
  • Loading branch information...
1 parent 91d5d7b commit 5e7856af581ab4554e66bba692575f42ab495ad3 michaelpenne committed Sep 15, 2004
View
2 mod/lesson/backuplib.php
@@ -1,4 +1,4 @@
-<?php //$Id$
+<?PHP //$Id$
//This php script contains all the stuff to backup/restore
//lesson mods
View
113 mod/lesson/db/mysql.php
@@ -1,11 +1,120 @@
-<?php
+<?PHP
function lesson_upgrade($oldversion) {
/// This function does anything necessary to upgrade
/// older versions to match current functionality
global $CFG;
+ // CDC-FLAG
+ if ($oldversion < 2004081700) {
+ execute_sql("CREATE TABLE `mdl_lesson_default`
+ ( `id` int(10) unsigned NOT NULL auto_increment,
+ `course` int(10) unsigned NOT NULL default '0',
+ `practice` tinyint(3) unsigned NOT NULL default '0',
+ `password` varchar(32) NOT NULL default '',
+ `usepassword` int(3) unsigned NOT NULL default '0',
+ `grade` tinyint(3) NOT NULL default '0',
+ `custom` int(3) unsigned NOT NULL default '0',
+ `ongoing` int(3) unsigned NOT NULL default '0',
+ `usemaxgrade` tinyint(3) unsigned NOT NULL default '0',
+ `maxanswers` int(3) unsigned NOT NULL default '4',
+ `maxattempts` int(3) unsigned NOT NULL default '5',
+ `review` tinyint(3) unsigned NOT NULL default '0',
+ `nextpagedefault` int(3) unsigned NOT NULL default '0',
+ `minquestions` tinyint(3) unsigned NOT NULL default '0',
+ `maxpages` int(3) unsigned NOT NULL default '0',
+ `timed` int(3) unsigned NOT NULL default '0',
+ `maxtime` int(10) unsigned NOT NULL default '0',
+ `retake` int(3) unsigned NOT NULL default '1',
+ `tree` int(3) unsigned NOT NULL default '0',
+ `slideshow` int(3) unsigned NOT NULL default '0',
+ `width` int(10) unsigned NOT NULL default '640',
+ `height` int(10) unsigned NOT NULL default '480',
+ `bgcolor` varchar(7) default '#FFFFFF',
+ `displayleft` int(3) unsigned NOT NULL default '0',
+ `highscores` int(3) unsigned NOT NULL default '0',
+ `maxhighscores` int(10) NOT NULL default '0',
+ PRIMARY KEY (`id`)
+ ) COMMENT = 'Defines lesson_default'");
+ }
+
+ if ($oldversion < 2004081100) {
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `practice` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `review` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxattempts");
+ }
+
+ if ($oldversion < 2004072100) {
+ execute_sql(" create table mdl_lesson_high_scores
+ ( id int(10) unsigned not null auto_increment primary key,
+ lessonid int(10) unsigned not null,
+ userid int(10) unsigned not null,
+ gradeid int(10) unsigned not null,
+ nickname varchar(5) not null,
+ PRIMARY KEY (`id`)
+ )");
+
+ execute_sql(" create table mdl_lesson_essay
+ ( id int(10) unsigned not null auto_increment primary key,
+ lessonid int(10) unsigned not null,
+ userid int(10) unsigned not null,
+ pageid int(10) unsigned not null,
+ answerid int(10) unsigned not null,
+ try int(10) unsigned not null,
+ answer text not null,
+ graded tinyint(3) unsigned not null default 0,
+ score int(10) unsigned not null default 0,
+ response text not null,
+ sent tinyint(3) unsigned not null default 0,
+ timesubmitted int(10) unsigned not null,
+ PRIMARY KEY (`id`)
+ )");
+
+ execute_sql(" create table mdl_lesson_branch
+ ( id int(10) unsigned not null auto_increment primary key,
+ lessonid int(10) unsigned not null,
+ userid int(10) unsigned not null,
+ pageid int(10) unsigned not null,
+ retry int(10) unsigned not null,
+ flag tinyint(3) unsigned not null,
+ timeseen int(10) unsigned not null,
+ PRIMARY KEY (`id`)
+ )");
+
+
+ execute_sql(" create table mdl_lesson_timer
+ ( id int(10) unsigned not null auto_increment primary key,
+ lessonid int(10) unsigned not null,
+ userid int(10) unsigned not null,
+ starttime int(10) unsigned not null,
+ lessontime int(10) unsigned not null,
+ PRIMARY KEY (`id`)
+ )");
+
+
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `layout` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER qoption");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_pages` ADD `display` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1' AFTER layout");
+
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson_answers` ADD `score` INT(10) NOT NULL DEFAULT '0' AFTER grade");
+
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `usepassword` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER name");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `password` VARCHAR(32) NOT NULL DEFAULT '' AFTER usepassword");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `custom` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER grade");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `ongoing` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER custom");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `timed` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER maxpages");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxtime` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER timed");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `tree` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER retake");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `slideshow` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER tree");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `width` INT(10) UNSIGNED NOT NULL DEFAULT '640' AFTER slideshow");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `height` INT(10) UNSIGNED NOT NULL DEFAULT '480' AFTER width");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `bgcolor` CHAR(7) NOT NULL DEFAULT '#FFFFFF' AFTER height");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `displayleft` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER bgcolor");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `highscores` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER displayleft");
+ execute_sql(" ALTER TABLE `{$CFG->prefix}lesson` ADD `maxhighscores` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER highscores");
+
+ }
+ // CDC-FLAG end
+
if ($oldversion < 2004021600) {
delete_records("log_display", "module", "lesson");
@@ -43,4 +152,4 @@ function lesson_upgrade($oldversion) {
return true;
}
-?>
+?>
View
99 mod/lesson/db/mysql.sql
@@ -8,14 +8,30 @@ CREATE TABLE `prefix_lesson` (
`id` int(10) unsigned NOT NULL auto_increment,
`course` int(10) unsigned NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
+ `practice` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `usepassword` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `password` VARCHAR(32) NOT NULL default '',
`grade` tinyint(3) NOT NULL default '0',
+ `custom` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `ongoing` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`usemaxgrade` tinyint(3) NOT NULL default '0',
`maxanswers` int(3) unsigned NOT NULL default '4',
`maxattempts` int(3) unsigned NOT NULL default '5',
+ `review` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`nextpagedefault` int(3) unsigned NOT NULL default '0',
`minquestions` int(3) unsigned NOT NULL default '0',
`maxpages` int(3) unsigned NOT NULL default '0',
+ `timed` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `maxtime` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`retake` int(3) unsigned NOT NULL default '1',
+ `tree` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `slideshow` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
+ `width` INT(10) UNSIGNED NOT NULL DEFAULT '640',
+ `height` INT(10) UNSIGNED NOT NULL DEFAULT '480',
+ `bgcolor` CHAR(7) NOT NULL DEFAULT '#FFFFFF',
+ `displayleft` 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',
`deadline` int(10) unsigned NOT NULL default '0',
`timemodified` int(10) unsigned NOT NULL default '0',
@@ -30,6 +46,8 @@ CREATE TABLE `prefix_lesson_pages` (
`nextpageid` int(10) unsigned NOT NULL default '0',
`qtype` tinyint(3) unsigned NOT NULL default '0',
`qoption` tinyint(3) unsigned NOT NULL default '0',
+ `layout` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
+ `display` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
`timecreated` int(10) unsigned NOT NULL default '0',
`timemodified` int(10) unsigned NOT NULL default '0',
`title` varchar(255) NOT NULL default '',
@@ -44,6 +62,7 @@ CREATE TABLE `prefix_lesson_answers` (
`pageid` int(10) unsigned NOT NULL default '0',
`jumpto` int(11) NOT NULL default '0',
`grade` tinyint(3) unsigned NOT NULL default '0',
+ `score` INT(10) NOT NULL DEFAULT '0',
`flags` tinyint(3) unsigned NOT NULL default '0',
`timecreated` int(10) unsigned NOT NULL default '0',
`timemodified` int(10) unsigned NOT NULL default '0',
@@ -79,6 +98,86 @@ CREATE TABLE `prefix_lesson_grades` (
) COMMENT='Defines lesson_grades';
# --------------------------------------------------------
+CREATE TABLE `prefix_lesson_default`
+ ( `id` int(10) unsigned NOT NULL auto_increment,
+ `course` int(10) unsigned NOT NULL default '0',
+ `practice` tinyint(3) unsigned NOT NULL default '0',
+ `password` varchar(32) NOT NULL default '',
+ `usepassword` int(3) unsigned NOT NULL default '0',
+ `grade` tinyint(3) NOT NULL default '0',
+ `custom` int(3) unsigned NOT NULL default '0',
+ `ongoing` int(3) unsigned NOT NULL default '0',
+ `usemaxgrade` tinyint(3) unsigned NOT NULL default '0',
+ `maxanswers` int(3) unsigned NOT NULL default '4',
+ `maxattempts` int(3) unsigned NOT NULL default '5',
+ `review` tinyint(3) unsigned NOT NULL default '0',
+ `nextpagedefault` int(3) unsigned NOT NULL default '0',
+ `minquestions` tinyint(3) unsigned NOT NULL default '0',
+ `maxpages` int(3) unsigned NOT NULL default '0',
+ `timed` int(3) unsigned NOT NULL default '0',
+ `maxtime` int(10) unsigned NOT NULL default '0',
+ `retake` int(3) unsigned NOT NULL default '1',
+ `tree` int(3) unsigned NOT NULL default '0',
+ `slideshow` int(3) unsigned NOT NULL default '0',
+ `width` int(10) unsigned NOT NULL default '640',
+ `height` int(10) unsigned NOT NULL default '480',
+ `bgcolor` varchar(7) default '#FFFFFF',
+ `displayleft` int(3) unsigned NOT NULL default '0',
+ `highscores` int(3) unsigned NOT NULL default '0',
+ `maxhighscores` int(10) NOT NULL default '0',
+ PRIMARY KEY (`id`)
+ ) COMMENT = 'Defines lesson_default';
+# --------------------------------------------------------
+
+CREATE TABLE `prefix_lesson_timer`
+ ( `id` int(10) unsigned NOT NULL auto_increment,
+ `lessonid` int(10) unsigned not null,
+ `userid` int(10) unsigned not null,
+ `starttime` int(10) unsigned not null,
+ `lessontime` int(10) unsigned not null,
+ PRIMARY KEY (`id`)
+ );
+# --------------------------------------------------------
+
+CREATE TABLE `prefix_lesson_branch`
+ ( `id` int(10) unsigned not null auto_increment,
+ `lessonid` int(10) unsigned not null,
+ `userid` int(10) unsigned not null,
+ `pageid` int(10) unsigned not null,
+ `retry` int(10) unsigned not null,
+ `flag` tinyint(3) unsigned not null,
+ `timeseen` int(10) unsigned not null,
+ PRIMARY KEY (`id`)
+ );
+# --------------------------------------------------------
+
+CREATE TABLE `prefix_lesson_essay`
+ ( `id` int(10) unsigned not null auto_increment,
+ `lessonid` int(10) unsigned not null,
+ `userid` int(10) unsigned not null,
+ `pageid` int(10) unsigned not null,
+ `answerid` int(10) unsigned not null,
+ `try` int(10) unsigned not null,
+ `answer` text not null,
+ `graded` tinyint(3) unsigned not null default 0,
+ `score` int(10) unsigned not null default 0,
+ `response` text not null,
+ `sent` tinyint(3) unsigned not null default 0,
+ `timesubmitted` int(10) unsigned not null,
+ PRIMARY KEY (`id`)
+ );
+# --------------------------------------------------------
+
+CREATE TABLE `prefix_lesson_high_scores`
+ ( `id` int(10) unsigned not null auto_increment,
+ `lessonid` int(10) unsigned not null,
+ `userid` int(10) unsigned not null,
+ `gradeid` int(10) unsigned not null,
+ `nickname` varchar(5) not null,
+ PRIMARY KEY (`id`)
+ );
+# --------------------------------------------------------
+
INSERT INTO prefix_log_display VALUES ('lesson', 'start', 'lesson', 'name');
INSERT INTO prefix_log_display VALUES ('lesson', 'end', 'lesson', 'name');
View
2 mod/lesson/db/postgres7.php
@@ -1,4 +1,4 @@
-<?php
+<?PHP
function lesson_upgrade($oldversion) {
/// This function does anything necessary to upgrade
View
13 mod/lesson/filter.php
@@ -0,0 +1,13 @@
+<?php
+ // bad words < 5 characters long
+ $filterwords = array (
+ "shit",
+ "fuck",
+ "dick",
+ "cunt",
+ "pussy",
+ "hore",
+ "whore",
+ "damn"
+ );
+?>
View
4 mod/lesson/format.php
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?PHP // $Id$
////////////////////////////////////////////////////////////////////
/// format.php - Default format class for file imports/exports. //
@@ -50,7 +50,7 @@ function importprocess($filename, $lesson, $pageid) {
case MATCH :
$count++;
- echo "<hr /><p><b>$count</b>. ".stripslashes($question->questiontext)."</p>";
+ echo "<hr><p><b>$count</b>. ".stripslashes($question->questiontext)."</p>";
unset($newpage);
$newpage->lessonid = $lesson->id;
$newpage->qtype = $question->qtype;
View
42 mod/lesson/import.php
@@ -1,8 +1,8 @@
-<?php // $Id$
+<?PHP // $Id$
// Import quiz questions into the given category
require_once("../../config.php");
- require_once("lib.php");
+ require_once("locallib.php");
optional_variable($format);
require_variable($id); // Course Module ID
@@ -29,8 +29,9 @@
$strimportquestions = get_string("importquestions", "lesson");
$strlessons = get_string("modulenameplural", "lesson");
- print_header_simple("$strimportquestions", " $strimportquestions",
- "<a href=\"index.php?id=$course->id\">$strlessons</a> -> <a href=\"view.php?id=$cm->id\">$lesson->name</a>-> $strimportquestions");
+ print_header("$course->shortname: $strimportquestions", "$course->shortname: $strimportquestions",
+ "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> -> ".
+ "<A HREF=index.php?id=$course->id>$strlessons</A> -> <a href=\"view.php?id=$cm->id\">$lesson->name</a>-> $strimportquestions");
if ($form = data_submitted()) { /// Filename
@@ -59,7 +60,20 @@
require("../quiz/format/$form->format/format.php");
$format = new quiz_file_format();
-
+
+
+ // jjg7:8/9/2004 remove double '\n' from a file if the format is aiken and reformat Brusca's to Aiken
+ if ($form->format == 'aiken')
+ {
+ require("reformat.php"); // include functions to reformat styles
+ if (removedoublecr($newfile['tmp_name']) === FALSE) {
+ error("Error occurred while replacing double carriage returns");
+ }
+ if (importmodifiedaikenstyle($newfile['tmp_name']) === FALSE) {
+ error("Error occurred while converting to Aiken");
+ }
+ }
+
if (! $format->importpreprocess()) { // Do anything before that we need to
error("Error occurred during pre-processing!");
}
@@ -72,7 +86,7 @@
error("Error occurred during post-processing!");
}
- echo "<hr />";
+ echo "<hr>";
print_continue("view.php?id=$cm->id");
print_footer($course);
exit;
@@ -96,23 +110,23 @@
print_heading_with_help($strimportquestions, "import", "lesson");
print_simple_box_start("center", "", "$THEME->cellheading");
- echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"import.php\">";
- echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
- echo "<input type=\"hidden\" name=\"pageid\" value=\"".$_GET['pageid']."\" />\n";
- echo "<table cellpadding=\"5\">";
+ echo "<form enctype=\"multipart/form-data\" method=\"post\" action=import.php>";
+ echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\">\n";
+ echo "<input type=\"hidden\" name=\"pageid\" value=\"".$_GET['pageid']."\">\n";
+ echo "<table cellpadding=5>";
- echo "<tr><td align=\"right\">";
+ echo "<tr><td align=right>";
print_string("fileformat", "lesson");
echo ":</td><td>";
choose_from_menu($fileformatnames, "format", "gift", "");
echo "</tr>";
- echo "<tr><td align=\"right\">";
+ echo "<tr><td align=right>";
print_string("upload");
echo ":</td><td>";
- echo " <input name=\"newfile\" type=\"file\" size=\"50\" />";
+ echo " <input name=\"newfile\" type=\"file\" size=\"50\">";
echo "</tr><tr><td>&nbsp;</td><td>";
- echo " <input type=\"submit\" name=\"save\" value=\"".get_string("uploadthisfile")."\" />";
+ echo " <input type=submit name=save value=\"".get_string("uploadthisfile")."\">";
echo "</td></tr>";
echo "</table>";
View
25 mod/lesson/index.php
@@ -1,17 +1,17 @@
-<?php // $Id$
+<?PHP // $Id$
/// This page lists all the instances of lesson in a particular course
require_once("../../config.php");
- require_once("lib.php");
+ require_once("locallib.php");
require_variable($id); // course
if (!$course = get_record("course", "id", $id)) {
error("Course ID is incorrect");
}
- require_course_login($course);
+ require_login($course->id);
add_to_log($course->id, "lesson", "view all", "index.php?id=$course->id", "");
@@ -24,7 +24,11 @@
/// Print the header
- print_header_simple("$strlessons", "", "$strlessons", "", "", true, "", navmenu($course));
+ if ($course->category) {
+ $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
+ }
+
+ print_header("$course->shortname: $strlessons", "$course->fullname", "$navigation $strlessons", "", "", true, "", navmenu($course));
/// Get all the appropriate data
@@ -56,23 +60,22 @@
foreach ($lessons as $lesson) {
if (!$lesson->visible) {
//Show dimmed if the mod is hidden
- $link = "<a class=\"dimmed\" href=\"view.php?id=$lesson->coursemodule\">$lesson->name</a>";
+ $link = "<A class=\"dimmed\" HREF=\"view.php?id=$lesson->coursemodule\">$lesson->name</A>";
} else {
//Show normal if the mod is visible
- $link = "<a href=\"view.php?id=$lesson->coursemodule\">$lesson->name</a>";
+ $link = "<A HREF=\"view.php?id=$lesson->coursemodule\">$lesson->name</A>";
}
if ($lesson->deadline > $timenow) {
$due = userdate($lesson->deadline);
} else {
- $due = "<font color=\"red\">".userdate($lesson->deadline)."</font>";
+ $due = "<FONT COLOR=\"red\">".userdate($lesson->deadline)."</FONT>";
}
- $grade_value = '';
if ($course->format == "weeks" or $course->format == "topics") {
if (isteacher($course->id)) {
$grade_value = $lesson->grade;
- } elseif (isstudent($course->id)) {
+ } else {
// it's a student, show their mean or maximum grade
if ($lesson->usemaxgrade) {
$grade = get_record_sql("SELECT MAX(grade) as grade FROM {$CFG->prefix}lesson_grades
@@ -84,6 +87,8 @@
if ($grade) {
// grades are stored as percentages
$grade_value = number_format($grade->grade * $lesson->grade / 100, 1);
+ } else {
+ $grade_value = 0;
}
}
$table->data[] = array ($lesson->section, $link, $grade_value, $due);
@@ -92,7 +97,7 @@
}
}
- echo "<br />";
+ echo "<BR>";
print_table($table);
View
1,548 mod/lesson/lesson.php
@@ -1,10 +1,12 @@
-<?php // $Id: lesson.php, v 1.0 25 Jan 2004
+<?PHP // $Id: lesson.php, v 1.0 25 Jan 2004
/*************************************************
ACTIONS handled are:
addbranchtable
addendofbranch
+ addcluster /// CDC-FLAG /// added two new items
+ addendofcluster
addpage
confirmdelete
continue
@@ -18,8 +20,10 @@
************************************************/
require("../../config.php");
- require("lib.php");
+ require("locallib.php");
+ require_once("styles.php");
+
require_variable($id); // Course Module ID
// get some esential stuff...
@@ -42,7 +46,7 @@
$navigation = "";
if ($course->category) {
- $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
+ $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strlessons = get_string("modulenameplural", "lesson");
@@ -51,14 +55,13 @@
// ... print the header and...
print_header("$course->shortname: $lesson->name", "$course->fullname",
- "$navigation <a href=\"index.php?id=$course->id\">$strlessons</a> ->
- <a href=\"view.php?id=$cm->id\">$lesson->name</a>",
+ "$navigation <A HREF=index.php?id=$course->id>$strlessons</A> ->
+ <A HREF=\"view.php?id=$cm->id\">$lesson->name</A>",
"", "", true);
//...get the action
require_variable($action);
-
/************** add branch table ************************************/
if ($action == 'addbranchtable' ) {
@@ -72,45 +75,59 @@
// set of jump array
$jump[0] = get_string("thispage", "lesson");
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
- $jump[LESSON_EOL] = get_string("endoflesson", "lesson");
- if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
- error("Add page: first page not found");
- }
- while (true) {
- if ($apageid) {
- $title = get_field("lesson_pages", "title", "id", $apageid);
- $jump[$apageid] = $title;
- $apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
- } else {
- // last page reached
- break;
- }
- }
-
+ //// CDC-FLAG /////
+ $jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
+ if (!isset($_GET['firstpage'])) {
+ $jump[LESSON_EOL] = get_string("endoflesson", "lesson");
+ if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
+ error("Add page: first page not found");
+ }
+ while (true) {
+ if ($apageid) {
+ $title = get_field("lesson_pages", "title", "id", $apageid);
+ $jump[$apageid] = $title;
+ $apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
+ } else {
+ // last page reached
+ break;
+ }
+ }
+ }
+ //// CDC-FLAG /////
// give teacher a blank proforma
print_heading_with_help(get_string("addabranchtable", "lesson"), "overview", "lesson");
?>
<form name="form" method="post" action="lesson.php">
- <input type="hidden" name="id" value="<?php echo $cm->id ?>" />
- <input type="hidden" name="action" value="insertpage" />
- <input type="hidden" name="pageid" value="<?php echo $_GET['pageid'] ?>" />
- <input type="hidden" name="qtype" value="<?php echo LESSON_BRANCHTABLE ?>" />
- <center><table cellpadding="5" border="1">
+ <input type="hidden" name="id" value="<?PHP echo $cm->id ?>">
+ <input type="hidden" name="action" value="insertpage">
+ <input type="hidden" name="pageid" value="<?PHP echo $_GET['pageid'] ?>">
+ <input type="hidden" name="qtype" value="<?PHP echo LESSON_BRANCHTABLE ?>">
+ <center><table cellpadding=5 border=1>
<tr><td align="center">
<tr valign="top">
<td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br />
- <input type="text" name="title" size="80" maxsize="255" value="" /></td></tr>
- <?php
+ <!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value=""></td></tr>
+ <?PHP
echo "<tr><td><b>";
echo get_string("pagecontents", "lesson").":</b><br />\n";
print_textarea($usehtmleditor, 25,70, 630, 400, "contents");
- echo "</td></tr>\n";
+ use_html_editor("contents");
+ echo "</td></tr>\n";
+ /// CDC-FLAG /// 6/16/04
+ echo "<tr><td>\n";
+ echo "<center><input name=\"layout\" type=\"checkbox\" value=\"1\" CHECKED>";
+ echo get_string("arrangebuttonshorizontally", "lesson")."\n";
+ echo "<br><input name=\"display\" type=\"checkbox\" value=\"1\" CHECKED>";
+ echo get_string("displayinleftmenu", "lesson");
+ echo "</center>\n";
+ echo "</td></tr>\n";
+ /// CDC-FLAG ///
for ($i = 0; $i < $lesson->maxanswers; $i++) {
$iplus1 = $i + 1;
echo "<tr><td><b>".get_string("description", "lesson")." $iplus1:</b><br />\n";
- print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$i]");
- echo "</td></tr>\n";
- echo "<tr><td><b>".get_string("jump", "lesson")." $iplus1:</b> \n";
+ print_textarea(false, 10, 70, 630, 300, "answer[$i]"); // made the default set to off also removed use_html_editor(); line from down below, which made all textareas turn into html editors
+ echo "</td></tr>\n";
+ echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
if ($i) {
// answers 2, 3, 4... jumpto this page
lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
@@ -121,15 +138,14 @@
helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
echo "</td></tr>\n";
}
- use_html_editor();
// close table and form
?>
</table><br />
- <input type="submit" value="<?php print_string("addabranchtable", "lesson") ?>" />
- <input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
+ <input type="submit" value="<?php print_string("addabranchtable", "lesson") ?>">
+ <input type="submit" name="cancel" value="<?php print_string("cancel") ?>">
</center>
</form>
- <?php
+ <?PHP
}
@@ -194,8 +210,125 @@
notice(get_string("nobranchtablefound", "lesson"), "view.php?id=$cm->id");
}
}
-
+/// CDC-FLAG 6/17/04 ///
+ /************** add cluster ************************************/
+ elseif ($action == 'addcluster' ) {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ // first get the preceeding page
+ // if $pageid = 0, then we are inserting a new page at the beginning of the lesson
+ $pageid = $_GET['pageid'];
+
+ $timenow = time();
+
+ if ($pageid == 0) {
+ if (!$page = get_record("lesson_pages", "prevpageid", 0, "lessonid", $lesson->id)) {
+ error("Error: Add cluster: page record not found");
+ }
+ } else {
+ if (!$page = get_record("lesson_pages", "id", $pageid)) {
+ error("Error: Add cluster: page record not found");
+ }
+ }
+
+ $newpage->lessonid = $lesson->id;
+ $newpage->prevpageid = $pageid;
+ if ($pageid != 0) {
+ $newpage->nextpageid = $page->nextpageid;
+ } else {
+ $newpage->nextpageid = $page->id;
+ }
+ $newpage->qtype = LESSON_CLUSTER;
+ $newpage->timecreated = $timenow;
+ $newpage->title = get_string("clustertitle", "lesson");
+ $newpage->contents = get_string("clustertitle", "lesson");
+ if (!$newpageid = insert_record("lesson_pages", $newpage)) {
+ error("Insert page: new page not inserted");
+ }
+ // update the linked list...
+ if ($pageid != 0) {
+ if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
+ error("Add cluster: unable to update link");
+ }
+ }
+
+ if ($pageid == 0) {
+ $page->nextpageid = $page->id;
+ }
+ if ($page->nextpageid) {
+ // the new page is not the last page
+ if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
+ error("Insert page: unable to update previous link");
+ }
+ }
+ // ..and the single "answer"
+ $newanswer->lessonid = $lesson->id;
+ $newanswer->pageid = $newpageid;
+ $newanswer->timecreated = $timenow;
+ $newanswer->jumpto = LESSON_CLUSTERJUMP;
+ if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
+ error("Add cluster: answer record not inserted");
+ }
+ redirect("view.php?id=$cm->id", get_string("ok"));
+ }
+/// CDC-FLAG ///
+
+/// CDC-FLAG 6/17/04 ///
+ /************** add end of cluster ************************************/
+ elseif ($action == 'addendofcluster' ) {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ // first get the preceeding page
+ $pageid = $_GET['pageid'];
+
+ $timenow = time();
+
+ // the new page is not the first page (end of cluster always comes after an existing page)
+ if (!$page = get_record("lesson_pages", "id", $pageid)) {
+ error("Error: Could not find page");
+ }
+
+ // could put code in here to check if the user really can insert an end of cluster
+
+ $newpage->lessonid = $lesson->id;
+ $newpage->prevpageid = $pageid;
+ $newpage->nextpageid = $page->nextpageid;
+ $newpage->qtype = LESSON_ENDOFCLUSTER;
+ $newpage->timecreated = $timenow;
+ $newpage->title = get_string("endofclustertitle", "lesson");
+ $newpage->contents = get_string("endofclustertitle", "lesson");
+ if (!$newpageid = insert_record("lesson_pages", $newpage)) {
+ error("Insert page: end of cluster page not inserted");
+ }
+ // update the linked list...
+ if (!set_field("lesson_pages", "nextpageid", $newpageid, "id", $pageid)) {
+ error("Add end of cluster: unable to update link");
+ }
+ if ($page->nextpageid) {
+ // the new page is not the last page
+ if (!set_field("lesson_pages", "prevpageid", $newpageid, "id", $page->nextpageid)) {
+ error("Insert end of cluster: unable to update previous link");
+ }
+ }
+ // ..and the single "answer"
+ $newanswer->lessonid = $lesson->id;
+ $newanswer->pageid = $newpageid;
+ $newanswer->timecreated = $timenow;
+ $newanswer->jumpto = LESSON_NEXTPAGE;
+ if(!$newanswerid = insert_record("lesson_answers", $newanswer)) {
+ error("Add end of cluster: answer record not inserted");
+ }
+ redirect("view.php?id=$cm->id", get_string("ok"));
+ }
+/// CDC-FLAG ///
+
/************** add page ************************************/
elseif ($action == 'addpage' ) {
@@ -209,73 +342,228 @@
// set of jump array
$jump[0] = get_string("thispage", "lesson");
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
- $jump[LESSON_EOL] = get_string("endoflesson", "lesson");
- if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
- error("Add page: first page not found");
- }
- while (true) {
- if ($apageid) {
- $title = get_field("lesson_pages", "title", "id", $apageid);
- $jump[$apageid] = $title;
- $apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
- } else {
- // last page reached
- break;
- }
- }
+ //// CDC-FLAG 6/18/04 /////
+ $jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
+ if(lesson_display_branch_jumps($lesson->id, $pageid)) {
+ $jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson");
+ $jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson");
+ }
+ if(lesson_display_cluster_jump($lesson->id, $pageid)) {
+ $jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");
+ }
+ /// CDC-FLAG ///
+ if (!isset($_GET['firstpage'])) {
+ $linkadd = "";
+ $jump[LESSON_EOL] = get_string("endoflesson", "lesson");
+ if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
+ error("Add page: first page not found");
+ }
+ while (true) {
+ if ($apageid) {
+ $title = get_field("lesson_pages", "title", "id", $apageid);
+ $jump[$apageid] = $title;
+ $apageid = get_field("lesson_pages", "nextpageid", "id", $apageid);
+ } else {
+ // last page reached
+ break;
+ }
+ }
+ } else {
+ $linkadd = "&firstpage=1";
+ }
// give teacher a blank proforma
print_heading_with_help(get_string("addaquestionpage", "lesson"), "overview", "lesson");
?>
<form name="form" method="post" action="lesson.php">
- <input type="hidden" name="id" value="<?php echo $cm->id ?>" />
- <input type="hidden" name="action" value="insertpage" />
- <input type="hidden" name="pageid" value="<?php echo $_GET['pageid'] ?>" />
- <center><table cellpadding="5" border="1">
+ <input type="hidden" name="id" value="<?PHP echo $cm->id ?>">
+ <input type="hidden" name="action" value="insertpage">
+ <input type="hidden" name="pageid" value="<?PHP echo $_GET['pageid'] ?>">
+ <center><table cellpadding=5 border=1>
+ <?php
+ echo "<tr><td align=\"center\"><b>";
+ echo get_string("questiontype", "lesson").":</b> \n";
+ echo helpbutton("questiontype", get_string("questiontype", "lesson"), "lesson")."<br>";
+ if (isset($_GET['qtype'])) {
+ lesson_qtype_menu($LESSON_QUESTION_TYPE, $_GET['qtype'],
+ "lesson.php?id=$cm->id&action=addpage&pageid=".$_GET['pageid'].$linkadd);
+ // NoticeFix rearraged
+ if ( $_GET['qtype'] == LESSON_SHORTANSWER || $_GET['qtype'] == LESSON_MULTICHOICE || !isset($_GET['qtype']) ) { // only display this option for Multichoice and shortanswer
+ if ($_GET['qtype'] == LESSON_SHORTANSWER) {
+ echo "<br><br><b>".get_string("casesensitive", "lesson").":</b> \n";
+ } else {
+ echo "<br><br><b>".get_string("multianswer", "lesson").":</b> \n";
+ }
+ echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
+ helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
+ }
+ } else {
+ lesson_qtype_menu($LESSON_QUESTION_TYPE, LESSON_MULTICHOICE,
+ "lesson.php?id=$cm->id&action=addpage&pageid=".$_GET['pageid'].$linkadd);
+ }
+ echo "</td></tr>\n";
+ ?>
<tr><td align="center">
<tr valign="top">
<td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br />
- <input type="text" name="title" size="80" maxsize="255" value="" /></td></tr>
- <?php
+ <!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value=""></td></tr>
+ <?PHP
echo "<tr><td><b>";
echo get_string("pagecontents", "lesson").":</b><br />\n";
print_textarea($usehtmleditor, 25,70, 630, 400, "contents");
use_html_editor("contents");
echo "</td></tr>\n";
- echo "<tr><td><b>".get_string("questiontype", "lesson").":</b> \n";
- choose_from_menu($LESSON_QUESTION_TYPE, "qtype", LESSON_MULTICHOICE, "");
- helpbutton("questiontype", get_string("questiontype", "lesson"), "lesson");
- echo "<br /><b>".get_string("questionoption", "lesson").":</b>\n";
- echo " <input type=\"checkbox\" name=\"qoption\" value=\"1\"/ />";
- helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
- echo "</td></tr>\n";
- for ($i = 0; $i < $lesson->maxanswers; $i++) {
- $iplus1 = $i + 1;
- echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
- print_textarea(false, 6, 70, 630, 300, "answer[$i]");
- echo "</td></tr>\n";
- echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
- print_textarea(false, 6, 70, 630, 300, "response[$i]");
- echo "</td></tr>\n";
- echo "<tr><td><b>".get_string("jump", "lesson")." $iplus1:</b> \n";
- if ($i) {
- // answers 2, 3, 4... jumpto this page
- lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
- } else {
- // answer 1 jumpto next page
- lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
- }
- helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
- echo "</td></tr>\n";
- }
+ if (isset($_GET['qtype'])) {
+ switch ($_GET['qtype']) {
+ case LESSON_TRUEFALSE :
+ for ($i = 0; $i < 2; $i++) {
+ $iplus1 = $i + 1;
+ echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "answer[$i]");
+ echo "</td></tr>\n";
+ echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "response[$i]");
+ echo "</td></tr>\n";
+ echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
+ if ($i) {
+ // answers 2, 3, 4... jumpto this page
+ lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
+ } else {
+ // answer 1 jumpto next page
+ lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
+ }
+ helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
+ /// CDC-FLAG ///
+ if($lesson->custom) {
+ if ($i) {
+ echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"-1\" size=\"5\">";
+ } else {
+ echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
+ }
+ }
+ /// CDC-FLAG ///
+ echo "</td></tr>\n";
+ }
+ break;
+ case LESSON_ESSAY :
+ echo "<tr><td><B>".get_string("jump", "lesson").":</b> \n";
+ lesson_choose_from_menu($jump, "jumpto[0]", LESSON_NEXTPAGE, "");
+ helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
+ if ($lesson->custom) {
+ echo get_string("score", "lesson").": <input type=\"text\" name=\"score[0]\" value=\"1\" size=\"5\">";
+ }
+ echo "</td></tr>\n";
+ break;
+ case LESSON_MATCHING :
+ for ($i = 0; $i < $lesson->maxanswers+2; $i++) {
+ $icorrected = $i - 1;
+ if ($i == 0) {
+ echo "<tr><td><b>".get_string("correctresponse", "lesson").":</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "answer[$i]");
+ echo "</td></tr>\n";
+ } elseif ($i == 1) {
+ echo "<tr><td><b>".get_string("wrongresponse", "lesson").":</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "answer[$i]");
+ echo "</td></tr>\n";
+ } else {
+ echo "<tr><td><b>".get_string("answer", "lesson")." $icorrected:</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "answer[$i]");
+ echo "</td></tr>\n";
+ echo "<tr><td><b>".get_string("matchesanswer", "lesson")." $icorrected:</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "response[$i]");
+ echo "</td></tr>\n";
+ }
+ if ($i == 2) {
+ echo "<tr><td><B>".get_string("correctanswerjump", "lesson").":</b> \n";
+ lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
+ helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
+ if($lesson->custom) {
+ echo get_string("correctanswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
+ }
+ echo "</td></tr>\n";
+ } elseif ($i == 3) {
+ echo "<tr><td><B>".get_string("wronganswerjump", "lesson").":</b> \n";
+ lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
+ helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
+ if($lesson->custom) {
+ echo get_string("wronganswerscore", "lesson").": <input type=\"text\" name=\"score[$i]\" value=\"-1\" size=\"5\">";
+ }
+ echo "</td></tr>\n";
+ }
+ }
+ break;
+ case LESSON_SHORTANSWER :
+ case LESSON_NUMERICAL :
+ case LESSON_MULTICHOICE :
+ // default code
+ for ($i = 0; $i < $lesson->maxanswers; $i++) {
+ $iplus1 = $i + 1;
+ echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "answer[$i]");
+ echo "</td></tr>\n";
+ echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "response[$i]");
+ echo "</td></tr>\n";
+ echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
+ if ($i) {
+ // answers 2, 3, 4... jumpto this page
+ lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
+ } else {
+ // answer 1 jumpto next page
+ lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
+ }
+ helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
+ /// CDC-FLAG ///
+ if($lesson->custom) {
+ if ($i) {
+ echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"-1\" size=\"5\">";
+ } else {
+ echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
+ }
+ }
+ /// CDC-FLAG ///
+ echo "</td></tr>\n";
+ }
+ break;
+ }
+ } else {
+ for ($i = 0; $i < $lesson->maxanswers; $i++) {
+ $iplus1 = $i + 1;
+ echo "<tr><td><b>".get_string("answer", "lesson")." $iplus1:</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "answer[$i]");
+ echo "</td></tr>\n";
+ echo "<tr><td><b>".get_string("response", "lesson")." $iplus1:</b><br />\n";
+ print_textarea(false, 6, 70, 630, 300, "response[$i]");
+ echo "</td></tr>\n";
+ echo "<tr><td><B>".get_string("jump", "lesson")." $iplus1:</b> \n";
+ if ($i) {
+ // answers 2, 3, 4... jumpto this page
+ lesson_choose_from_menu($jump, "jumpto[$i]", 0, "");
+ } else {
+ // answer 1 jumpto next page
+ lesson_choose_from_menu($jump, "jumpto[$i]", LESSON_NEXTPAGE, "");
+ }
+ helpbutton("jumpto", get_string("jump", "lesson"), "lesson");
+ /// CDC-FLAG ///
+ if($lesson->custom) {
+ if ($i) {
+ echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"-1\" size=\"5\">";
+ } else {
+ echo get_string("score", "lesson")." $iplus1: <input type=\"text\" name=\"score[$i]\" value=\"1\" size=\"5\">";
+ }
+ }
+ /// CDC-FLAG ///
+ echo "</td></tr>\n";
+ }
+ }
// close table and form
?>
</table><br />
- <input type="submit" value="<?php print_string("addaquestionpage", "lesson") ?>" />
- <input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
+ <input type="submit" value="<?php print_string("addaquestionpage", "lesson") ?>">
+ <input type="submit" name="cancel" value="<?php print_string("cancel") ?>">
</center>
</form>
- <?php
+ <?PHP
}
@@ -306,16 +594,100 @@
}
}
notice_yesno(get_string("confirmdeletionofthispage","lesson"),
- "lesson.php?action=delete&id=$cm->id&pageid=$pageid",
+ "lesson.php?action=delete&id=$cm->id&pageid=$pageid]",
"view.php?id=$cm->id");
}
/****************** continue ************************************/
elseif ($action == 'continue' ) {
- // record answer (if necessary) and show response (if none say if answer is correct or not)
+ //CDC Chris Berri added this echo call for left menu. must match that in view.php for styles
+ if ($lesson->displayleft) {
+ echo '<div class="leftmenu1">';
+ if ($page = get_record_select("lesson_pages", "lessonid = $lesson->id AND prevpageid = 0")) {
+ // print the pages
+ echo "<form name=\"lessonpages2\" method=\"post\" action=\"view.php\">\n";
+ echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\">\n";
+ echo "<input type=\"hidden\" name=\"action\" value=\"navigation\">\n";
+ echo "<input type=\"hidden\" name=\"pageid\">\n";
+ echo "<div class='lmlinks'><table bgcolor=\"$THEME->cellheading\"><tr></tr>";
+ echo "<tr><td class='lmheading'>".get_string("lessonmenu", "lesson")."</td></tr><br>";
+ echo "<tr><td class='lmMainlinks'>";
+ echo "<a href=\"../../course/view.php?id=$course->id\">".get_string("mainmenu", "lesson")."</a></td></tr>";
+ echo "<td>";
+ lesson_print_tree_menu($lesson->id, $page->id, $cm->id);
+ echo "</td></tr></table></div>";
+ echo "</form>";
+ }
+ echo "</div>"; //close leftmenu1
+ echo "<div class='slidepos'>"; //CDC slidepos
+ } elseif ($lesson->slideshow) {
+ echo "<table align=\"center\"><tr><td>";
+ }
+ /// CDC-FLAG /// Slideshow styles
+ if($lesson->slideshow) {
+ echo "<div style=\"
+ background-color: $lesson->bgcolor;
+ height: ".$lesson->height."px;
+ width: ".$lesson->width."px;
+ overflow: auto;
+ border: 0px solid #ccc;
+ padding: 8px;
+ \">\n";
+ }
+ /// CDC-FLAG ///
+
+ /// 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
+ if(isteacher($course->id)) {
+ if (execute_teacherwarning($lesson->id)) {
+ $warningvars->cluster = get_string("clusterjump", "lesson");
+ $warningvars->unseen = get_string("unseenpageinbranch", "lesson");
+ echo "<div align=\"center\">".get_string("teacherjumpwarning", "lesson", $warningvars)."<div><br>";
+ }
+ }
+ /// CDC-FLAG ///
+ /// CDC-FLAG /// 6/14/04 -- This is the code updates the lesson time for a timed test
+ $outoftime = false;
+ if($lesson->timed) {
+ if(isteacher($course->id)) {
+ echo "<div align=\"center\">".get_string("teachertimerwarning", "lesson")."</div>";
+ } else {
+ if (!$timer = get_record("lesson_timer", "lessonid", $lesson->id, "userid", $USER->id)) {
+ error("Error: could not find record");
+ }
+ if ((($timer->starttime + $lesson->maxtime * 60) - time()) > 0) {
+ // code for the clock
+ echo "<table align=\"right\"><tr><td>";
+ echo "<script language=\"javascript\">\n";
+ echo "var starttime = ". $timer->starttime . ";\n";
+ echo "var servertime = ". time() . ";\n";
+ echo "var testlength = ". $lesson->maxtime * 60 .";\n";
+ echo "document.write('<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"timer.js\"><\/SCRIPT>');\n";
+ echo "window.onload = function () { show_clock(); }";
+ echo "</script>\n";
+ echo "</td></tr></table><br><br>";
+ } else {
+ redirect("view.php?id=$cm->id&action=navigation&pageid=".LESSON_EOL."&outoftime=normal", get_string("outoftime", "lesson"));
+ }
+ if ((($timer->starttime + $lesson->maxtime * 60) - time()) < 60 && !((($timer->starttime + $lesson->maxtime * 60) - time()) < 0)) {
+ echo "<div align=\"center\">".get_string("studentoneminwarning", "lesson")."<div>";
+ } elseif (($timer->starttime + $lesson->maxtime * 60) < time()) {
+ echo "<div align=\"center\">".get_string("studentoutoftime", "lesson")."</div>";
+ $outoftime = true;
+ }
+ unset($newtime);
+ $newtime->id = $timer->id;
+ $newtime->lessontime = time();
+
+ if (!update_record("lesson_timer", $newtime)) {
+ 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'])) {
error("Continue: pageid missing");
}
@@ -329,7 +701,39 @@
$correctanswer = false;
$newpageid = 0; // stay on the page
switch ($page->qtype) {
- case LESSON_SHORTANSWER :
+ /// CDC-FLAG ///
+ case LESSON_ESSAY :
+ if (!$useranswer = $_POST['answer']) {
+ $noanswer = true;
+ break;
+ }
+ if (!$answers = get_records("lesson_answers", "pageid", $pageid, "id")) {
+ error("Continue: No answers found");
+ }
+ $correctanswer = false;
+ $response = "Your essay will be graded by the course instructor.";
+ foreach ($answers as $answer) {
+ $answerid = $answer->id;
+ $newpageid = $answer->jumpto;
+ }
+ /// 6/29/04 //
+ $nretakes = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id);
+
+ $newessay->lessonid = $lesson->id;
+ $newessay->pageid = $pageid;
+ $newessay->answerid = $answerid;
+ $newessay->try = $nretakes;
+ $newessay->userid = $USER->id;
+ $newessay->answer = $useranswer;
+ $newessay->timesubmitted = time();
+ if (!isteacher($course->id)) {
+ if (!insert_record("lesson_essay", $newessay)) {
+ error("Error: could not submit essay");
+ }
+ }
+ break;
+ /// CDC-FLAG ///
+ case LESSON_SHORTANSWER :
if (!$useranswer = $_POST['answer']) {
$noanswer = true;
break;
@@ -338,44 +742,60 @@
error("Continue: No answers found");
}
foreach ($answers as $answer) {
- // massage the wild cards (if present)
- if (strpos(' '.$answer->answer, '*')) {
- $answer->answer = str_replace('\*','@@@@@@', $answer->answer);
- $answer->answer = str_replace('*','.*', $answer->answer);
- $answer->answer = str_replace('@@@@@@', '\*', $answer->answer);
- $answer->answer = str_replace('+', '\+', $answer->answer);
- }
- if (lesson_iscorrect($pageid, $answer->jumpto)) {
+ /// CDC-FLAG ///
+ if ($lesson->custom) {
+ if($answer->score > 0) {
+ if ($page->qoption) {
+ // case sensitive
+ if ($answer->answer == $useranswer) {
+ $correctanswer = true;
+ $answerid = $answer->id;
+ $newpageid = $answer->jumpto;
+ if (trim(strip_tags($answer->response))) {
+ $response = $answer->response;
+ }
+ }
+ } else {
+ // case insensitive
+ if (strcasecmp($answer->answer, $useranswer) == 0) {
+ $correctanswer = true;
+ $answerid = $answer->id;
+ $newpageid = $answer->jumpto;
+ if (trim(strip_tags($answer->response))) {
+ $response = $answer->response;
+ }
+ }
+ }
+ }
+ } elseif (lesson_iscorrect($pageid, $answer->jumpto)) { /// CDC-FLAG 6/21/04 ///
if ($page->qoption) {
// case sensitive
- if (ereg('^'.$answer->answer.'$', $useranswer)) {
+ if ($answer->answer == $useranswer) {
$correctanswer = true;
$newpageid = $answer->jumpto;
if (trim(strip_tags($answer->response))) {
$response = $answer->response;
}
- break;
}
} else {
// case insensitive
- if (eregi('^'.$answer->answer.'$', $useranswer)) {
+ if (strcasecmp($answer->answer, $useranswer) == 0) {
$correctanswer = true;
$newpageid = $answer->jumpto;
if (trim(strip_tags($answer->response))) {
$response = $answer->response;
}
- break;
}
}
} else {
// see if user typed in any of the wrong answers
// don't worry about case
- if (eregi('^'.$answer->answer.'$', $useranswer)) {
+ if (strcasecmp($answer->answer, $useranswer) == 0) {
$newpageid = $answer->jumpto;
+ $answerid = $answer->id;
if (trim(strip_tags($answer->response))) {
$response = $answer->response;
}
- break;
}
}
}
@@ -399,7 +819,16 @@
}
if (lesson_iscorrect($pageid, $answer->jumpto)) {
$correctanswer = true;
- }
+ }
+ /* CDC-FLAG */
+ if ($lesson->custom) {
+ if ($answer->score > 0) {
+ $correctanswer = true;
+ } else {
+ $correctanswer = false;
+ }
+ }
+ /// CDC-FLAG 6/21/04 ///
$newpageid = $answer->jumpto;
if (!$response = trim($answer->response)) {
if ($correctanswer) {
@@ -427,35 +856,72 @@
$nhits = 0;
$correctresponse = '';
$wrongresponse = '';
- foreach ($answers as $answer) {
- if (lesson_iscorrect($pageid, $answer->jumpto)) {
- $ncorrect++;
- foreach ($useranswers as $key => $answerid) {
- if ($answerid == $answer->id) {
- $nhits++;
- }
- }
- // save the first jumpto page id, may be needed!...
- if (!isset($correctpageid)) {
- // leave in its "raw" state - will converted into a proper page id later
- $correctpageid = $answer->jumpto;
- }
- // ...also save any response from the correct answers...
- if (trim(strip_tags($answer->response))) {
- $correctresponse = $answer->response;
- }
- } else {
- // save the first jumpto page id, may be needed!...
- if (!isset($wrongpageid)) {
- // leave in its "raw" state - will converted into a proper page id later
- $wrongpageid = $answer->jumpto;
- }
- // ...and from the incorrect ones, don't know which to use at this stage
- if (trim(strip_tags($answer->response))) {
- $wrongresponse = $answer->response;
- }
- }
- }
+ /// CDC-FLAG /// 6/11/04 this is for custom scores. If score on answer is positive, it is correct
+ if ($lesson->custom) {
+ $ncorrect = 0;
+ $nhits = 0;
+ foreach ($answers as $answer) {
+ if ($answer->score > 0) {
+ $ncorrect++;
+
+ foreach ($useranswers as $key => $answerid) {
+ if ($answerid == $answer->id) {
+ $nhits++;
+ }
+ }
+ // save the first jumpto page id, may be needed!...
+ if (!isset($correctpageid)) {
+ // leave in its "raw" state - will converted into a proper page id later
+ $correctpageid = $answer->jumpto;
+ }
+ // ...also save any response from the correct answers...
+ if (trim(strip_tags($answer->response))) {
+ $correctresponse = $answer->response;
+ }
+ } else {
+ // save the first jumpto page id, may be needed!...
+ if (!isset($wrongpageid)) {
+ // leave in its "raw" state - will converted into a proper page id later
+ $wrongpageid = $answer->jumpto;
+ }
+ // ...and from the incorrect ones, don't know which to use at this stage
+ if (trim(strip_tags($answer->response))) {
+ $wrongresponse = $answer->response;
+ }
+ }
+ }
+ } else {
+ foreach ($answers as $answer) {
+ if (lesson_iscorrect($pageid, $answer->jumpto)) {
+ $ncorrect++;
+ foreach ($useranswers as $key => $answerid) {
+ if ($answerid == $answer->id) {
+ $nhits++;
+ }
+ }
+ // save the first jumpto page id, may be needed!...
+ if (!isset($correctpageid)) {
+ // leave in its "raw" state - will converted into a proper page id later
+ $correctpageid = $answer->jumpto;
+ }
+ // ...also save any response from the correct answers...
+ if (trim(strip_tags($answer->response))) {
+ $correctresponse = $answer->response;
+ }
+ } else {
+ // save the first jumpto page id, may be needed!...
+ if (!isset($wrongpageid)) {
+ // leave in its "raw" state - will converted into a proper page id later
+ $wrongpageid = $answer->jumpto;
+ }
+ // ...and from the incorrect ones, don't know which to use at this stage
+ if (trim(strip_tags($answer->response))) {
+ $wrongresponse = $answer->response;
+ }
+ }
+ }
+ }
+ /// CDC-FLAG ///
if ((count($useranswers) == $ncorrect) and ($nhits == $ncorrect)) {
$correctanswer = true;
if (!$response = $correctresponse) {
@@ -477,10 +943,19 @@
$answerid = $_POST['answerid'];
if (!$answer = get_record("lesson_answers", "id", $answerid)) {
error("Continue: answer record not found");
- }
+ }
if (lesson_iscorrect($pageid, $answer->jumpto)) {
$correctanswer = true;
- }
+ }
+ /* CDC-FLAG */
+ if ($lesson->custom) {
+ if ($answer->score > 0) {
+ $correctanswer = true;
+ } else {
+ $correctanswer = false;
+ }
+ }
+ /// CDC-FLAG ///
$newpageid = $answer->jumpto;
if (!$response = trim($answer->response)) {
if ($correctanswer) {
@@ -492,6 +967,7 @@
}
break;
+ /// CDC-FLAG /// 6/14/04 -- added responses
case LESSON_MATCHING :
if (isset($_POST['response'])) {
$response = $_POST['response'];
@@ -508,23 +984,49 @@
if ($answer->response == $response[$answer->id]) {
$ncorrect++;
}
- if ($i == 0) {
+ if ($i == 2) {
$correctpageid = $answer->jumpto;
+ $correctanswerid = $answer->id;
}
- if ($i == 1) {
+ if ($i == 3) {
$wrongpageid = $answer->jumpto;
+ $wronganswerid = $answer->id;
}
$i++;
}
if ($ncorrect == count($answers)) {
- $response = get_string("thatsthecorrectanswer", "lesson");
- $newpageid = $correctpageid;
+ $response = get_string("thatsthecorrectanswer", "lesson");
+ foreach ($answers as $answer) {
+ if ($answer->response == NULL && $answer->answer != NULL) {
+ $response = $answer->answer;
+ break;
+ }
+ }
+ // NoticeFix
+ if (isset($correctpageid)) {
+ $newpageid = $correctpageid;
+ }
+ if (isset($correctasnwerid)) {
+ $answerid = $correctanswerid;
+ }
$correctanswer = true;
} else {
- $response = get_string("numberofcorrectmatches", "lesson", $ncorrect);
+ $response = get_string("thatsthewronganswer", "lesson");
+ $t = 0;
+ foreach ($answers as $answer) {
+ if ($answer->response == NULL && $answer->answer != NULL) {
+ if ($t == 1) {
+ $response = $answer->answer;
+ break;
+ }
+ $t++;
+ }
+ }
$newpageid = $wrongpageid;
+ $answerid = $wronganswerid;
}
break;
+ /// CDC-FLAG ///
case LESSON_NUMERICAL :
// set defaults
@@ -555,6 +1057,14 @@
if (lesson_iscorrect($pageid, $newpageid)) {
$correctanswer = true;
}
+ /// CDC-FLAG ///
+ if ($lesson->custom) {
+ if ($answer->score > 0) {
+ $correctanswer = true;
+ $answerid = $answer->id;
+ }
+ }
+ /// CDC-FLAG ///
break;
}
}
@@ -573,6 +1083,41 @@
case LESSON_BRANCHTABLE:
$noanswer = false;
$newpageid = $_POST['jumpto'];
+ /// CDC-FLAG /// 6/15/04 going to insert into lesson_branch
+ if ($newpageid == LESSON_RANDOMBRANCH) {
+ $branchflag = 1;
+ } else {
+ $branchflag = 0;
+ }
+ if ($grades = get_records_select("lesson_grades", "lessonid = $lesson->id AND userid = $USER->id",
+ "grade DESC")) {
+ $retries = count($grades);
+ } else {
+ $retries = 0;
+ }
+ unset($branch);
+ $branch->lessonid = $lesson->id;
+ $branch->userid = $USER->id;
+ $branch->pageid = $_POST['pageid'];
+ $branch->retry = $retries;
+ $branch->flag = $branchflag;
+ $branch->timeseen = time();
+
+ 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
+ if($newpageid == LESSON_UNSEENBRANCHPAGE)
+ {
+ if (isteacher($course->id)) {
+ $newpageid = LESSON_NEXTPAGE;
+ } else {
+ $newpageid = lesson_unseen_question_jump($lesson->id, $USER->id, $_POST['pageid']); // this may return 0 //CDC Chris Berri.....this is where it sets the next page id for unseen?
+ }
+ }
+ /// CDC-FLAG 6/15/04 ///
// convert jumpto page into a proper page id
if ($newpageid == 0) {
$newpageid = $pageid;
@@ -581,8 +1126,15 @@
// no nextpage go to end of lesson
$newpageid = LESSON_EOL;
}
- }
- // no need to record anything in lesson_attempts
+/* CDC-FLAG */ } elseif ($newpageid == LESSON_PREVIOUSPAGE) {
+ $newpageid = $page->prevpageid;
+ } elseif ($newpageid == LESSON_RANDOMPAGE) {
+ $newpageid = lesson_random_question_jump($lesson->id, $_POST['pageid']);
+ } elseif ($newpageid == LESSON_RANDOMBRANCH) { // 6/15/04
+ $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);
exit();
@@ -603,9 +1155,13 @@
$attempt->retry = $nretakes;
$attempt->correct = $correctanswer;
$attempt->timeseen = time();
- if (!$newattemptid = insert_record("lesson_attempts", $attempt)) {
- error("Continue: attempt not inserted");
- }
+ /// CDC-FLAG /// -- dont want to insert the attempt if they ran out of time
+ if (!$outoftime) {
+ if (!$newattemptid = insert_record("lesson_attempts", $attempt)) {
+ 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
@@ -667,22 +1223,114 @@
}
}
+ /// CDC-FLAG 6/21/04 /// this calculates the ongoing score
+ if ($lesson->ongoing) {
+ if (isteacher($course->id)) {
+ echo "<div align=\"center\">".get_string("teacherongoingwarning", "lesson")."</div><br>";
+ } else {
+ lesson_calculate_ongoing_score($lesson, $USER);
+ }
+ }
+ /// CDC-FLAG ///
+
// display response (if there is one - there should be!)
if ($response) {
- $title = get_field("lesson_pages", "title", "id", $pageid);
- print_heading($title);
+ //$title = get_field("lesson_pages", "title", "id", $pageid);
+ //print_heading($title);
echo "<table width=\"80%\" border=\"0\" align=\"center\"><tr><td>\n";
- print_simple_box(format_text($response), 'center');
+ if ($lesson->review && !$correctanswer) {
+ $nretakes = count_records("lesson_grades", "lessonid", $lesson->id, "userid", $USER->id);
+ $qattempts = count_records("lesson_attempts", "userid", $USER->id, "retry", $nretakes, "pageid", $pageid);
+ echo "<br><br>";
+ if ($qattempts == 1) {
+ print_simple_box(get_string("firstwrong", "lesson"), "center");
+ } else {
+ print_simple_box(get_string("secondpluswrong", "lesson"), "center");
+ }
+ } else {
+ print_simple_box(format_text($response), 'center');
+ }
echo "</td></tr></table>\n";
- }
+ }
}
+
+
+ /// CDC-FLAG 6/18/04 /// - this is where some jump numbers are interpreted
+ if ($newpageid != LESSON_CLUSTERJUMP && $pageid != 0 && $newpageid > 0) { // going to check to see if the page that the user is going to view next, is a cluster page. If so, dont display, go into the cluster. The $newpageid > 0 is used to filter out all of the negative code jumps.
+ if (!$page = get_record("lesson_pages", "id", $newpageid)) {
+ error("Error: could not find page");
+ }
+ if ($page->qtype == LESSON_CLUSTER) {
+ $newpageid = LESSON_CLUSTERJUMP;
+ $pageid = $page->id;
+ }
+ }
+ if($outoftime) {
+ $newpageid = LESSON_EOL; // ran out of time for the test, so go to eol
+ } elseif($newpageid == LESSON_UNSEENBRANCHPAGE) {
+ if (isteacher($course->id)) {
+ if ($page->nextpageid == 0) {
+ $newpageid = LESSON_EOL;
+ } else {
+ $newpageid = $page->nextpageid;
+ }
+ } else {
+ $newpageid = lesson_unseen_question_jump($lesson->id, $USER->id, $pageid);
+ }
+ } elseif ($newpageid == LESSON_PREVIOUSPAGE) {
+ $newpageid = $page->prevpageid;
+ } elseif ($newpageid == LESSON_RANDOMPAGE) {
+ $newpageid = lesson_random_question_jump($lesson->id, $pageid);
+ } elseif ($newpageid == LESSON_CLUSTERJUMP) {
+ if (isteacher($course->id)) {
+ if ($page->nextpageid == 0) { // if teacher, go to next page
+ $newpageid = LESSON_EOL;
+ } else {
+ $newpageid = $page->nextpageid;
+ }
+ } else {
+ $newpageid = lesson_cluster_jump($lesson->id, $USER->id, $pageid);
+ }
+ }
+ /// CDC-FLAG ///
echo "<form name=\"pageform\" method =\"post\" action=\"view.php\">\n";
- echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
- echo "<input type=\"hidden\" name=\"action\" value=\"navigation\" />\n";
- echo "<input type=\"hidden\" name=\"pageid\" value=\"$newpageid\" />\n";
- echo "<p align=\"center\"><input type=\"submit\" name=\"continue\" value=\"".
- get_string("continue", "lesson")."\" /></p>\n";
- echo "</form>\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\" value=\"$newpageid\">\n";
+ /// CDC-FLAG ///
+ if ($lesson->slideshow) {
+ echo "</div>"; //Close Mark's big div tag???
+
+ echo "<table width=\"$lesson->width\" cellpadding=\"5\" cellspacing=\"5\"><tr><td>\n";
+ if ($lesson->review && !$correctanswer && !$noanswer) {
+ echo "<p class=\"lessonAbutton\" align=\"center\"><input type=\"submit\" onClick='pageform.pageid.value=$pageid;' name=\"review\" value=\"".
+ get_string("reviewquestionback", "lesson")."\"></p>\n";
+ echo "<p class=\"lessonAbutton\" align=\"center\"><input type=\"submit\" name=\"continue\" value=\"".
+ get_string("reviewquestioncontinue", "lesson")."\"></p>\n";
+ } else {
+ echo "<p class=\"lessonAbutton\" align=\"center\"><input type=\"submit\" name=\"continue\" value=\"".
+ get_string("continue", "lesson")."\"></p>\n";
+ }
+ echo "</td></tr></table>";
+
+ } else {
+ if ($lesson->review && !$correctanswer && !$noanswer) {
+ echo "<p class=\"lessonAbutton\" align=\"center\"><input type=\"submit\" onClick='pageform.pageid.value=$pageid;' name=\"review\" value=\"".
+ get_string("reviewquestionback", "lesson")."\"></p>\n";
+ echo "<p class=\"lessonAbutton\" align=\"center\"><input type=\"submit\" name=\"continue\" value=\"".
+ get_string("reviewquestioncontinue", "lesson")."\"></p>\n";
+ } else {
+ echo "<p class=\"lessonAbutton\" align=\"center\"><input type=\"submit\" name=\"continue\" value=\"".
+ get_string("continue", "lesson")."\"></p>\n";
+ }
+ }
+ echo "</form>\n";
+
+ if ($lesson->displayleft) {
+ echo "</div><!-- close slidepos class -->"; //CDC Chris Berri for styles, closes slidepos.
+ } elseif ($lesson->slideshow) {
+ echo "</td></tr></table>";
+ }
}
@@ -758,9 +1406,27 @@
if (!$page = get_record("lesson_pages", "id", $_GET['pageid'])) {
error("Edit page: page record not found");
}
+
+ if (isset($_GET['qtype'])) {
+ $page->qtype = $_GET['qtype'];
+ }
+
// set of jump array
$jump[0] = get_string("thispage", "lesson");
$jump[LESSON_NEXTPAGE] = get_string("nextpage", "lesson");
+ //// CDC-FLAG 6/18/04 /////
+ $jump[LESSON_PREVIOUSPAGE] = get_string("previouspage", "lesson");
+ if(lesson_display_branch_jumps($lesson->id, $page->id)) {
+ $jump[LESSON_UNSEENBRANCHPAGE] = get_string("unseenpageinbranch", "lesson");
+ $jump[LESSON_RANDOMPAGE] = get_string("randompageinbranch", "lesson");
+ }
+ if ($page->qtype == LESSON_ENDOFBRANCH || $page->qtype == LESSON_BRANCHTABLE) {
+ $jump[LESSON_RANDOMBRANCH] = get_string("randombranch", "lesson");
+ }
+ if(lesson_display_cluster_jump($lesson->id, $page->id) && $page->qtype != LESSON_BRANCHTABLE && $page->qtype != LESSON_ENDOFCLUSTER) {
+ $jump[LESSON_CLUSTERJUMP] = get_string("clusterjump", "lesson");
+ }
+ //// CDC-FLAG /////
$jump[LESSON_EOL] = get_string("endoflesson", "lesson");
if (!$apageid = get_field("lesson_pages", "id", "lessonid", $lesson->id, "prevpageid", 0)) {
error("Edit page: first page not found");
@@ -770,105 +1436,217 @@
if (!$apage = get_record("lesson_pages", "id", $apageid)) {
error("Edit page: apage record not found");
}
- if ($apage->qtype != LESSON_ENDOFBRANCH) {
- // don't include EOB's in the list...
- if (trim($page->title)) { // ...nor nuffin pages
- $jump[$apageid] = $apage->title;
- }
- }
+ /// CDC-FLAG /// 6/15/04 removed != LESSON_ENDOFBRANCH...
+ if (trim($page->title)) { // ...nor nuffin pages
+ $jump[$apageid] = $apage->title;
+ }
$apageid = $apage->nextpageid;
} else {
// last page reached
break;
}
}
-
// give teacher a proforma
?>
<form name="editpage" method="post" action="lesson.php">
- <input type="hidden" name="id" value="<?php echo $cm->id ?>" />
- <input type="hidden" name="action" value="updatepage" />
- <input type="hidden" name="pageid" value="<?php echo $_GET['pageid'] ?>" />
- <input type="hidden" name="redisplay" value="0" />
- <center><table cellpadding="5" border="1">
- <tr><td align="center">
+ <input type="hidden" name="id" value="<?PHP echo $cm->id ?>">
+ <input type="hidden" name="action" value="updatepage">
+ <input type="hidden" name="pageid" value="<?PHP echo $_GET['pageid'] ?>">
+ <input type="hidden" name="redisplay" value="0">
+ <center><table cellpadding=5 border=1>
+ <?php
+ switch ($page->