1 CREATE TABLE prefix_lesson (
2 id SERIAL8 PRIMARY KEY,
3 course INT8 NOT NULL default '0',
4 name varchar(255) NOT NULL default '',
5 practice INT NOT NULL DEFAULT '0',
6 modattempts INT4 NOT NULL DEFAULT '0',
7 usepassword INT NOT NULL DEFAULT '0',
8 password VARCHAR(32) NOT NULL default '',
9 grade INT NOT NULL default '0',
10 custom INT NOT NULL DEFAULT '0',
11 ongoing INT NOT NULL DEFAULT '0',
12 usemaxgrade INT NOT NULL default '0',
13 maxanswers INT NOT NULL default '4',
14 maxattempts INT NOT NULL default '5',
15 review INT NOT NULL DEFAULT '0',
16 nextpagedefault INT NOT NULL default '0',
17 minquestions INT NOT NULL default '0',
18 maxpages INT NOT NULL default '0',
19 timed INT NOT NULL DEFAULT '0',
20 maxtime INT8 NOT NULL DEFAULT '0',
21 retake INT NOT NULL default '1',
22 tree INT NOT NULL DEFAULT '0',
23 slideshow INT NOT NULL DEFAULT '0',
24 width INT8 NOT NULL DEFAULT '640',
25 height INT8 NOT NULL DEFAULT '480',
26 bgcolor VARCHAR(7) NOT NULL DEFAULT '#FFFFFF',
27 displayleft INT NOT NULL DEFAULT '0',
28 highscores INT NOT NULL DEFAULT '0',
29 maxhighscores INT8 NOT NULL DEFAULT '0',
30 available INT8 NOT NULL default '0',
31 deadline INT8 NOT NULL default '0',
32 timemodified INT8 NOT NULL default '0'
35 CREATE INDEX prefix_lesson_course_idx ON prefix_lesson (course);
37 CREATE TABLE prefix_lesson_pages (
38 id SERIAL8 PRIMARY KEY,
39 lessonid INT8 NOT NULL default '0',
40 prevpageid INT8 NOT NULL default '0',
41 nextpageid INT8 NOT NULL default '0',
42 qtype INT NOT NULL default '0',
43 qoption INT NOT NULL default '0',
44 layout INT NOT NULL DEFAULT '1',
45 display INT NOT NULL DEFAULT '1',
46 timecreated INT8 NOT NULL default '0',
47 timemodified INT8 NOT NULL default '0',
48 title varchar(255) NOT NULL default '',
49 contents text NOT NULL default ''
52 CREATE INDEX prefix_lesson_pages_lessonid_idx ON prefix_lesson_pages (lessonid);
54 CREATE TABLE prefix_lesson_answers (
55 id SERIAL8 PRIMARY KEY,
56 lessonid INT8 NOT NULL default '0',
57 pageid INT8 NOT NULL default '0',
58 jumpto int8 NOT NULL default '0',
59 grade INT NOT NULL default '0',
60 score INT8 NOT NULL DEFAULT '0',
61 flags INT NOT NULL default '0',
62 timecreated INT8 NOT NULL default '0',
63 timemodified INT8 NOT NULL default '0',
64 answer text NOT NULL default '',
65 response text NOT NULL default ''
68 CREATE INDEX prefix_lesson_answers_pageid_idx ON prefix_lesson_answers (pageid);
69 CREATE INDEX prefix_lesson_answers_lessonid_idx ON prefix_lesson_answers (lessonid);
71 CREATE TABLE prefix_lesson_attempts (
72 id SERIAL8 PRIMARY KEY,
73 lessonid INT8 NOT NULL default '0',
74 pageid INT8 NOT NULL default '0',
75 userid INT8 NOT NULL default '0',
76 answerid INT8 NOT NULL default '0',
77 retry INT NOT NULL default '0',
78 correct INT8 NOT NULL default '0',
79 useranswer text NOT NULL default '',
80 timeseen INT8 NOT NULL default '0'
82 CREATE INDEX prefix_lesson_attempts_lessonid_idx ON prefix_lesson_attempts (lessonid);
83 CREATE INDEX prefix_lesson_attempts_pageid_idx ON prefix_lesson_attempts (pageid);
84 CREATE INDEX prefix_lesson_attempts_userid_idx ON prefix_lesson_attempts (userid);
86 CREATE TABLE prefix_lesson_grades (
87 id SERIAL8 PRIMARY KEY,
88 lessonid INT8 NOT NULL default '0',
89 userid INT8 NOT NULL default '0',
90 grade INT NOT NULL default '0',
91 late INT NOT NULL default '0',
92 completed INT8 NOT NULL default '0'
95 CREATE INDEX prefix_lesson_grades_lessonid_idx ON prefix_lesson_grades (lessonid);
96 CREATE INDEX prefix_lesson_grades_userid_idx ON prefix_lesson_grades (userid);
98 CREATE TABLE prefix_lesson_default
99 ( id SERIAL8 PRIMARY KEY,
100 course INT8 NOT NULL default '0',
101 practice INT NOT NULL default '0',
102 modattempts INT4 NOT NULL default '0',
103 password varchar(32) NOT NULL default '',
104 usepassword INT NOT NULL default '0',
105 grade INT NOT NULL default '0',
106 custom INT NOT NULL default '0',
107 ongoing INT NOT NULL default '0',
108 usemaxgrade INT NOT NULL default '0',
109 maxanswers INT NOT NULL default '4',
110 maxattempts INT NOT NULL default '5',
111 review INT NOT NULL default '0',
112 nextpagedefault INT NOT NULL default '0',
113 minquestions INT NOT NULL default '0',
114 maxpages INT NOT NULL default '0',
115 timed INT NOT NULL default '0',
116 maxtime INT8 NOT NULL default '0',
117 retake INT NOT NULL default '1',
118 tree INT NOT NULL default '0',
119 slideshow INT NOT NULL default '0',
120 width INT8 NOT NULL default '640',
121 height INT8 NOT NULL default '480',
122 bgcolor varchar(7) default '#FFFFFF',
123 displayleft INT NOT NULL default '0',
124 highscores INT NOT NULL default '0',
125 maxhighscores INT8 NOT NULL default '0'
128 CREATE TABLE prefix_lesson_timer
129 ( id SERIAL8 PRIMARY KEY,
130 lessonid INT8 not null,
131 userid INT8 not null,
132 starttime INT8 not null,
133 lessontime INT8 not null
136 CREATE TABLE prefix_lesson_branch
137 ( id SERIAL8 PRIMARY KEY,
138 lessonid INT8 not null,
139 userid INT8 not null,
140 pageid INT8 not null,
143 timeseen INT8 not null
146 CREATE TABLE prefix_lesson_essay
147 ( id SERIAL8 PRIMARY KEY,
148 lessonid INT8 not null,
149 userid INT8 not null,
150 pageid INT8 not null,
151 answerid INT8 not null,
153 answer text not null,
154 graded INT not null default 0,
155 score INT8 not null default 0,
156 response text not null,
157 sent INT not null default 0,
158 timesubmitted INT8 not null
161 CREATE TABLE prefix_lesson_high_scores
162 ( id SERIAL8 PRIMARY KEY,
163 lessonid INT8 not null,
164 userid INT8 not null,
165 gradeid INT8 not null,
166 nickname varchar(5) not null
170 INSERT INTO prefix_log_display VALUES ('lesson', 'start', 'lesson', 'name');
171 INSERT INTO prefix_log_display VALUES ('lesson', 'end', 'lesson', 'name');
172 INSERT INTO prefix_log_display VALUES ('lesson', 'view', 'lesson_pages', 'title');