mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Many many changes lumped in here ... not finished yet either.
Basically all the Database functions are in lib/datalib.php and the web functions are all in lib/weblib.php, so moodlelib.php is much thinner than it was. Data functions have been extended ... most old calls will still work, but now many more SQL commands can be performed using the datalib functions rather than using SQL. I'm currently moving through the whole tree replacing SQL calls or at least concentrating them in one section of mod/xxx/lib.php Still working on forums, quizzes, surveys, resources. The tree is currently not full working ... some things are half-completed ... will resume tomorrow.
This commit is contained in:
parent
03f13d2207
commit
9fa49e22ab
@ -125,14 +125,9 @@
|
||||
/// Print list of potential admins
|
||||
|
||||
if ($search) {
|
||||
$users = get_records_sql("SELECT * from user WHERE confirmed = 1 AND deleted = 0
|
||||
AND (firstname LIKE '%$search%' OR
|
||||
lastname LIKE '%$search%' OR
|
||||
email LIKE '%$search%')
|
||||
AND username <> 'guest' AND username <> 'changeme'");
|
||||
$users = get_users_search($search);
|
||||
} else {
|
||||
$users = get_records_sql("SELECT * from user WHERE confirmed = 1 AND deleted = 0
|
||||
AND username <> 'guest' AND username <> 'changeme'");
|
||||
$users = get_users_confirmed();
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
// eg wget -q -O /dev/null 'http://moodle.somewhere.edu/admin/cron.php'
|
||||
// or php /web/moodle/admin/cron.php
|
||||
|
||||
$FULLME = "we don't care";
|
||||
$FULLME = "cron";
|
||||
|
||||
require("../config.php");
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
// Run all cron jobs for each module
|
||||
|
||||
if ($mods = get_records_sql("SELECT * FROM modules WHERE cron > 0 AND (($timenow - lastcron) > cron)")) {
|
||||
if ($mods = get_records_select("modules", "cron > 0 AND (($timenow - lastcron) > cron)")) {
|
||||
foreach ($mods as $mod) {
|
||||
$libfile = "$CFG->dirroot/mod/$mod->name/lib.php";
|
||||
if (file_exists($libfile)) {
|
||||
@ -42,11 +42,8 @@
|
||||
// Unenrol users who haven't logged in for $CFG->longtimenosee
|
||||
|
||||
if ($CFG->longtimenosee) { // value in days
|
||||
$cutofftime = $timenow - ($CFG->longtimenosee * 3600 * 24);
|
||||
if ($users = get_records_sql("SELECT u.* FROM user u, user_students s
|
||||
WHERE lastaccess > '0' AND
|
||||
lastaccess < '$cutofftime' AND
|
||||
u.id = s.user GROUP BY u.id")) {
|
||||
$longtime = $timenow - ($CFG->longtimenosee * 3600 * 24);
|
||||
if ($users = get_users_longtimenosee($longtime)) {
|
||||
foreach ($users as $user) {
|
||||
if (unenrol_student($user->id)) {
|
||||
echo "Deleted student enrolment for $user->firstname $user->lastname ($user->id)\n";
|
||||
@ -58,11 +55,8 @@
|
||||
|
||||
// Delete users who haven't confirmed within seven days
|
||||
|
||||
$cutofftime = $timenow - (7 * 24 * 3600);
|
||||
if ($users = get_records_sql("SELECT * FROM user
|
||||
WHERE confirmed = '0' AND
|
||||
firstaccess > '0' AND
|
||||
firstaccess < '$cutofftime'")) {
|
||||
$oneweek = $timenow - (7 * 24 * 3600);
|
||||
if ($users = get_users_unconfirmed($oneweek)) {
|
||||
foreach ($users as $user) {
|
||||
if (delete_records("user", "id", $user->id)) {
|
||||
echo "Deleted unconfirmed user for $user->firstname $user->lastname ($user->id)\n";
|
||||
|
@ -205,16 +205,14 @@
|
||||
|
||||
include_once("$CFG->dirroot/lib/defaults.php");
|
||||
|
||||
$CFG = (array)$CFG;
|
||||
foreach ($defaults as $name => $value) {
|
||||
if (!isset($CFG[$name])) {
|
||||
$config->name = $name;
|
||||
$config->value = $CFG[$name] = $value;
|
||||
insert_record("config", $config);
|
||||
if (!isset($CFG->$name)) {
|
||||
$CFG->$name = $value;
|
||||
set_config($name, $value);
|
||||
$configchange = true;
|
||||
}
|
||||
}
|
||||
$CFG = (object)$CFG;
|
||||
|
||||
|
||||
/// If any new configurations were found then send to the config page to check
|
||||
|
||||
@ -228,7 +226,7 @@
|
||||
}
|
||||
|
||||
/// Set up the admin user
|
||||
if (! record_exists_sql("SELECT * FROM user_admins")) { // No admin user yet
|
||||
if (! record_exists("user_admins")) { // No admin user yet
|
||||
redirect("user.php");
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
optional_variable($dir, "ASC");
|
||||
optional_variable($page, 0);
|
||||
|
||||
if (! record_exists_sql("SELECT * FROM user_admins")) { // No admin user yet
|
||||
if (! record_exists("user_admins")) { // No admin user yet
|
||||
$user->firstname = "Admin";
|
||||
$user->lastname = "User";
|
||||
$user->username = "admin";
|
||||
@ -126,11 +126,7 @@
|
||||
|
||||
// Carry on with the user listing
|
||||
|
||||
if (!$user = get_record_sql("SELECT count(*) as count FROM user WHERE username <> 'guest' AND deleted <> '1'")) {
|
||||
error("Could not search for users?");
|
||||
}
|
||||
|
||||
$usercount = $user->count;
|
||||
$usercount = get_users_count();
|
||||
|
||||
$columns = array("name", "email", "city", "country", "lastaccess");
|
||||
|
||||
@ -153,9 +149,7 @@
|
||||
$sort = "firstname";
|
||||
}
|
||||
|
||||
if ($users = get_records_sql("SELECT id, username, email, firstname, lastname, city, country, lastaccess from user WHERE username <> 'guest'
|
||||
AND deleted <> '1' ORDER BY $sort $dir LIMIT $page,$recordsperpage")) {
|
||||
|
||||
if ($users = get_users_listing($sort, $dir, $page, $recordsperpage)) {
|
||||
print_heading("$usercount ".get_string("users"));
|
||||
|
||||
$a->start = $page;
|
||||
|
@ -37,12 +37,14 @@
|
||||
// a different database you will need to set up all your tables by hand //
|
||||
// which could be a big job. See doc/install.html //
|
||||
|
||||
$CFG->dbtype = "mysql"; // eg mysql (postgres7, oracle, access etc)
|
||||
$CFG->dbtype = "mysql"; // mysql or postgres7
|
||||
$CFG->dbhost = "localhost"; // eg localhost
|
||||
$CFG->dbname = "moodle"; // eg moodle
|
||||
$CFG->dbname = "moodletest"; // eg moodle
|
||||
$CFG->dbuser = "username";
|
||||
$CFG->dbpass = "password";
|
||||
|
||||
$CFG->prefix = "mdl_"; // Prefix value to use for all table names
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Now you need to tell Moodle where it is located. Specify the full
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
/// Get the existing categories
|
||||
if (!$categories = get_all_categories()) {
|
||||
if (!$categories = get_categories()) {
|
||||
// Try and make one
|
||||
$cat->name = get_string("miscellaneous");
|
||||
if ($cat->id = insert_record("course_categories", $cat)) {
|
||||
@ -86,7 +86,7 @@
|
||||
}
|
||||
|
||||
/// Find any orphan courses that don't yet have a valid category and set to default
|
||||
if ($courses = get_records_sql("SELECT * FROM course WHERE category > 0")) {
|
||||
if ($courses = get_courses()) {
|
||||
foreach ($courses as $course) {
|
||||
if (!isset( $categories[$course->category] )) {
|
||||
set_field("course", "category", $default, "id", $course->id);
|
||||
|
@ -23,7 +23,7 @@
|
||||
print_header("$site->shortname: $strdeletecourse", $site->fullname,
|
||||
"<A HREF=\"$CFG->wwwroot/admin\">$stradministration</A> -> $strdeletecourse");
|
||||
|
||||
if ($courses = get_records_sql("SELECT * from course WHERE category > 0 ORDER BY fullname")) {
|
||||
if ($courses = get_courses()) {
|
||||
print_heading(get_string("choosecourse"));
|
||||
print_simple_box_start("CENTER");
|
||||
foreach ($courses as $course) {
|
||||
@ -71,7 +71,7 @@
|
||||
$strdeleted = get_string("deleted");
|
||||
// First delete every instance of every module
|
||||
|
||||
if ($allmods = get_records_sql("SELECT * FROM modules") ) {
|
||||
if ($allmods = get_records("modules") ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = "../mod/$modname/lib.php";
|
||||
|
@ -96,7 +96,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$form->categories = get_records_sql_menu("SELECT id,name FROM course_categories");
|
||||
$form->categories = get_records_select_menu("course_categories", "", "name", "id,name");
|
||||
|
||||
$form->courseformats = array (
|
||||
"weeks" => get_string("formatweeks"),
|
||||
|
@ -11,7 +11,7 @@
|
||||
$strmycourses = get_string("mycourses");
|
||||
$strfulllistofcourses = get_string("fulllistofcourses");
|
||||
|
||||
if (!$categories = get_all_categories()) {
|
||||
if (!$categories = get_categories()) {
|
||||
error("Could not find any course categories!");
|
||||
}
|
||||
|
||||
|
@ -17,27 +17,16 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
|
||||
$users = array();
|
||||
|
||||
if ($course->category) {
|
||||
if ($students = get_records_sql("SELECT u.* FROM user u, user_students s
|
||||
WHERE s.course = '$course->id' AND s.user = u.id
|
||||
ORDER BY u.lastaccess DESC")) {
|
||||
foreach ($students as $student) {
|
||||
$users["$student->id"] = "$student->firstname $student->lastname";
|
||||
}
|
||||
if (!$users = get_course_users($course->id, "u.lastaccess DESC")) {
|
||||
$users = array();
|
||||
}
|
||||
if ($teachers = get_records_sql("SELECT u.* FROM user u, user_teachers t
|
||||
WHERE t.course = '$course->id' AND t.user = u.id
|
||||
ORDER BY u.lastaccess DESC")) {
|
||||
foreach ($teachers as $teacher) {
|
||||
$users["$teacher->id"] = "$teacher->firstname $teacher->lastname";
|
||||
}
|
||||
}
|
||||
if ($guest = get_user_info_from_db("username", "guest")) {
|
||||
if ($guest = get_guest()) {
|
||||
$users["$guest->id"] = "$guest->firstname $guest->lastname";
|
||||
}
|
||||
}
|
||||
|
||||
if (isadmin()) {
|
||||
if ($ccc = get_records_sql("SELECT * FROM course ORDER BY fullname")) {
|
||||
if ($ccc = get_records("course", "", "", "fullname")) {
|
||||
foreach ($ccc as $cc) {
|
||||
if ($cc->category) {
|
||||
$courses["$cc->id"] = "$cc->fullname";
|
||||
@ -121,7 +110,7 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
|
||||
|
||||
} else {
|
||||
$selector = "WHERE l.user = u.id"; // Show all courses
|
||||
if ($ccc = get_records_sql("SELECT * FROM course ORDER BY fullname")) {
|
||||
if ($ccc = get_courses(-1)) {
|
||||
foreach ($ccc as $cc) {
|
||||
$courses[$cc->id] = "$cc->shortname";
|
||||
}
|
||||
@ -137,8 +126,7 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
|
||||
$selector .= " AND l.time > '$date' AND l.time < '$enddate'";
|
||||
}
|
||||
|
||||
if (!$logs = get_records_sql("SELECT l.*, u.firstname, u.lastname, u.picture
|
||||
FROM log l, user u $selector $order")){
|
||||
if (!$logs = get_logs($select, $order)) {
|
||||
notify("No logs found!");
|
||||
print_footer($course);
|
||||
exit;
|
||||
@ -147,11 +135,13 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
|
||||
$count=0;
|
||||
$tt = getdate(time());
|
||||
$today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
|
||||
echo "<P ALIGN=CENTER>Displaying ".count($logs)." records</P>";
|
||||
echo "<P ALIGN=CENTER>";
|
||||
print_string("displayingrecords", "", count($logs));
|
||||
echo "</P>";
|
||||
echo "<TABLE BORDER=0 ALIGN=center CELLPADDING=3 CELLSPACING=3>";
|
||||
foreach ($logs as $log) {
|
||||
|
||||
if ($ld = get_record_sql("SELECT * FROM log_display WHERE module='$log->module' AND action='$log->action'")) {
|
||||
if ($ld = get_record("log_display", "module", "$log->module", "action", "$log->action")) {
|
||||
$log->info = get_field($ld->mtable, $ld->field, "id", $log->info);
|
||||
}
|
||||
|
||||
@ -179,11 +169,11 @@ function print_all_courses($category="all", $style="full", $maxcount=999, $width
|
||||
global $CFG, $USER;
|
||||
|
||||
if ($category == "all") {
|
||||
$courses = get_records_sql("SELECT * FROM course WHERE category > 0 ORDER BY fullname ASC");
|
||||
$courses = get_courses();
|
||||
|
||||
} else if ($category == "my") {
|
||||
if (isset($USER->id)) {
|
||||
if ($courses = get_records_sql("SELECT * FROM course WHERE category > 0 ORDER BY fullname ASC")) {
|
||||
if ($courses = get_courses()) {
|
||||
foreach ($courses as $key => $course) {
|
||||
if (!isteacher($course->id) and !isstudent($course->id)) {
|
||||
unset($courses[$key]);
|
||||
@ -193,7 +183,7 @@ function print_all_courses($category="all", $style="full", $maxcount=999, $width
|
||||
}
|
||||
|
||||
} else {
|
||||
$courses = get_records("course", "category", $category, "fullname ASC");
|
||||
$courses = get_courses($category);
|
||||
}
|
||||
|
||||
if ($style == "minimal") {
|
||||
@ -297,7 +287,7 @@ function print_recent_activity($course) {
|
||||
echo "</FONT></P>";
|
||||
}
|
||||
|
||||
if (! $logs = get_records_sql("SELECT * FROM log WHERE time > '$USER->lastlogin' AND course = '$course->id' ORDER BY time ASC")) {
|
||||
if (! $logs = get_records_select("log", "time > '$USER->lastlogin' AND course = '$course->id'", "time ASC")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -400,11 +390,7 @@ function get_array_of_activities($courseid) {
|
||||
|
||||
$mod = array();
|
||||
|
||||
if (!$rawmods = get_records_sql("SELECT cm.*, m.name as modname
|
||||
FROM modules m, course_modules cm
|
||||
WHERE cm.course = '$courseid'
|
||||
AND cm.deleted = '0'
|
||||
AND cm.module = m.id ") ) {
|
||||
if (!$rawmods = get_course_mods($courseid)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -435,7 +421,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
|
||||
$modnamesplural= NULL; // all course module names (plural form)
|
||||
$modnamesused = NULL; // course module names used
|
||||
|
||||
if ($allmods = get_records_sql("SELECT * FROM modules") ) {
|
||||
if ($allmods = get_records("modules")) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modnames[$mod->name] = get_string("modulename", "$mod->name");
|
||||
$modnamesplural[$mod->name] = get_string("modulenameplural", "$mod->name");
|
||||
@ -445,11 +431,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
|
||||
error("No modules are installed!");
|
||||
}
|
||||
|
||||
if ($rawmods = get_records_sql("SELECT cm.*, m.name as modname
|
||||
FROM modules m, course_modules cm
|
||||
WHERE cm.course = '$courseid'
|
||||
AND cm.deleted = '0'
|
||||
AND cm.module = m.id ") ) {
|
||||
if ($rawmods = get_course_mods($courseid)) {
|
||||
foreach($rawmods as $mod) { // Index the mods
|
||||
$mods[$mod->id] = $mod;
|
||||
$mods[$mod->id]->modfullname = $modnames[$mod->modname];
|
||||
@ -459,17 +441,13 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_all_sections($courseid) {
|
||||
|
||||
return get_records_sql("SELECT section, id, course, summary, sequence
|
||||
FROM course_sections
|
||||
WHERE course = '$courseid'
|
||||
ORDER BY section");
|
||||
return get_records("course_sections", "course", "$courseid", "sections",
|
||||
"section, id, course, summary, sequence");
|
||||
}
|
||||
|
||||
function get_all_categories() {
|
||||
return get_records_sql("SELECT * FROM course_categories ORDER by name");
|
||||
}
|
||||
|
||||
function print_section_block($heading, $course, $section, $mods, $modnames, $modnamesused,
|
||||
$absolute=true, $width="100%", $isediting=false) {
|
||||
@ -684,7 +662,7 @@ function print_course_categories($categories, $selected="none", $width=180) {
|
||||
$strrequireskey = get_string("requireskey");
|
||||
|
||||
if ($selected == "index") { // Print comprehensive index of categories with courses
|
||||
if ($courses = get_records_sql("SELECT * FROM course WHERE category > 0 ORDER BY shortname")) {
|
||||
if ($courses = get_courses()) {
|
||||
if (isset($USER->id) and !isadmin()) {
|
||||
print_simple_box_start("CENTER", "100%", $THEME->cellheading);
|
||||
print_heading("<A HREF=\"course/index.php?category=my\">".get_string("mycourses")."</A>", "LEFT");
|
||||
@ -773,9 +751,7 @@ function add_mod_to_section($mod) {
|
||||
// Returns the course_sections ID where the mod is inserted
|
||||
GLOBAL $db;
|
||||
|
||||
if ($section = get_record_sql("SELECT * FROM course_sections
|
||||
WHERE course = '$mod->course' AND section = '$mod->section'") ) {
|
||||
|
||||
if ($section = get_record("course_sections", "course", "$mod->course", "section", "$mod->section")) {
|
||||
if ($section->sequence) {
|
||||
$newsequence = "$section->sequence,$mod->coursemodule";
|
||||
} else {
|
||||
@ -857,9 +833,8 @@ function move_module($cm, $move) {
|
||||
return true;
|
||||
} else { // Push onto end of previous section
|
||||
$prevsectionnumber = $thissection->section - 1;
|
||||
if (! $prevsection = get_record_sql("SELECT * FROM course_sections
|
||||
WHERE course='$thissection->course'
|
||||
AND section='$prevsectionnumber' ")) {
|
||||
if (! $prevsection = get_record("course_sections", "course", "$thissection->course",
|
||||
"section", "$prevsectionnumber")) {
|
||||
error("Previous section ($prevsection->id) doesn't exist");
|
||||
}
|
||||
|
||||
@ -902,9 +877,8 @@ function move_module($cm, $move) {
|
||||
|
||||
if ($last) {
|
||||
$nextsectionnumber = $thissection->section + 1;
|
||||
if ($nextsection = get_record_sql("SELECT * FROM course_sections
|
||||
WHERE course='$thissection->course'
|
||||
AND section='$nextsectionnumber' ")) {
|
||||
if ($nextsection = get_record("course_sections", "course", "$thissection->course",
|
||||
"section", "$nextsectionnumber")) {
|
||||
|
||||
if ($nextsection->sequence) {
|
||||
$newsequence = "$cm->id,$nextsection->sequence";
|
||||
|
@ -63,12 +63,7 @@
|
||||
$timestart = $timefinish;
|
||||
}
|
||||
|
||||
if ($rawlogs = get_records_sql("SELECT floor((`time` - $coursestart)/86400) as day,
|
||||
count(*) as num FROM log
|
||||
WHERE user = '$user->id'
|
||||
AND course = '$course->id'
|
||||
AND `time` > '$coursestart'
|
||||
GROUP BY day ")) {
|
||||
if ($rawlogs = get_logs_usercourse($user->id, $course->id, $coursestart)) {
|
||||
foreach ($rawlogs as $rawlog) {
|
||||
$logs[$rawlog->day] = $rawlog->num;
|
||||
}
|
||||
@ -116,12 +111,7 @@
|
||||
$hours[$i] = userdate($hour, "$hh %p");
|
||||
}
|
||||
|
||||
if ($rawlogs = get_records_sql("SELECT floor((`time` - $daystart)/3600) as hour,
|
||||
count(*) as num FROM log
|
||||
WHERE user = '$user->id'
|
||||
AND course = '$course->id'
|
||||
AND `time` > '$daystart'
|
||||
GROUP BY hour ")) {
|
||||
if ($rawlogs = get_logs_userday($user->id, $course->id, $daystart)) {
|
||||
foreach ($rawlogs as $rawlog) {
|
||||
$logs[$rawlog->hour] = $rawlog->num;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
print_header("$site->shortname: $strassignteachers", "$site->fullname",
|
||||
"<A HREF=\"$CFG->wwwroot/admin\">$stradministration</A> -> $strassignteachers");
|
||||
|
||||
if ($courses = get_records_sql("SELECT * from course WHERE category > 0 ORDER BY fullname")) {
|
||||
if ($courses = get_courses()) {
|
||||
|
||||
print_heading(get_string("choosecourse"));
|
||||
print_simple_box_start("CENTER");
|
||||
@ -132,14 +132,9 @@
|
||||
/// Print list of potential teachers
|
||||
|
||||
if ($search) {
|
||||
$users = get_records_sql("SELECT * from user WHERE confirmed = 1 AND deleted = 0
|
||||
AND (firstname LIKE '%$search%' OR
|
||||
lastname LIKE '%$search%' OR
|
||||
email LIKE '%$search%')
|
||||
AND username <> 'guest' AND username <> 'changeme'");
|
||||
$users = get_users_search($search);
|
||||
} else {
|
||||
$users = get_records_sql("SELECT * from user WHERE confirmed = 1 AND deleted = 0
|
||||
AND username <> 'guest' AND username <> 'changeme'");
|
||||
$users = get_users_confirmed();
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
foreach ($rank as $num => $vals) {
|
||||
if (! $teacher = get_record_sql("SELECT * FROM user_teachers WHERE course='$course->id' and user='$num'")) {
|
||||
if (! $teacher = get_record("user_teachers", "course", "$course->id", "user", "$num")) {
|
||||
error("No such teacher in course $course->shortname with user id $num");
|
||||
}
|
||||
$teacher->role = $vals[r];
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
// Display the course home page.
|
||||
|
||||
require("../config.php");
|
||||
require("lib.php");
|
||||
include_once("../config.php");
|
||||
include_once("lib.php");
|
||||
|
||||
optional_variable($id);
|
||||
optional_variable($name);
|
||||
|
@ -47,7 +47,7 @@
|
||||
}
|
||||
|
||||
if ($site->newsitems > 0 ) {
|
||||
$categories = get_all_categories();
|
||||
$categories = get_categories();
|
||||
if (count($categories) > 1) {
|
||||
print_course_categories($categories, "none", $side);
|
||||
} else {
|
||||
@ -73,7 +73,7 @@
|
||||
if ($site->newsitems == 0 ) {
|
||||
print_heading_block(get_string("availablecourses"));
|
||||
print_spacer(8,1);
|
||||
$categories = get_all_categories();
|
||||
$categories = get_categories();
|
||||
if (count($categories) > 1) {
|
||||
print_course_categories($categories, "index");
|
||||
} else {
|
||||
|
@ -111,6 +111,7 @@ $string['deletednot'] = "Could not delete \$a !";
|
||||
$string['deletingcourse'] = "Deleting \$a";
|
||||
$string['department'] = "Department";
|
||||
$string['description'] = "Description";
|
||||
$string['displayingrecords'] = "Displaying \$a records";
|
||||
$string['displayingusers'] = "Displaying users \$a->start to \$a->end";
|
||||
$string['documentation'] = "Moodle Documentation";
|
||||
$string['downloadexcel'] = "Download in Excel format";
|
||||
|
@ -69,11 +69,11 @@ function record_exists($table, $field="", $value="", $field2="", $value2="", $fi
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($field and $value) {
|
||||
if ($field) {
|
||||
$select = "WHERE $field = '$value'";
|
||||
if ($field2 and $value2) {
|
||||
if ($field2) {
|
||||
$select .= " AND $field2 = '$value2'";
|
||||
if ($field3 and $value3) {
|
||||
if ($field3) {
|
||||
$select .= " AND $field3 = '$value3'";
|
||||
}
|
||||
}
|
||||
@ -105,11 +105,11 @@ function count_records($table, $field="", $value="", $field2="", $value2="", $fi
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($field and $value) {
|
||||
if ($field) {
|
||||
$select = "WHERE $field = '$value'";
|
||||
if ($field2 and $value2) {
|
||||
if ($field2) {
|
||||
$select .= " AND $field2 = '$value2'";
|
||||
if ($field3 and $value3) {
|
||||
if ($field3) {
|
||||
$select .= " AND $field3 = '$value3'";
|
||||
}
|
||||
}
|
||||
@ -118,6 +118,15 @@ function count_records($table, $field="", $value="", $field2="", $value2="", $fi
|
||||
return count_records_sql("SELECT COUNT(*) FROM $CFG->prefix$table $select");
|
||||
}
|
||||
|
||||
function count_records_select($table, $select="") {
|
||||
/// Get all the records and count them
|
||||
|
||||
global $CFG;
|
||||
|
||||
return count_records_sql("SELECT COUNT(*) FROM $CFG->prefix$table $select");
|
||||
}
|
||||
|
||||
|
||||
function count_records_sql($sql) {
|
||||
/// Get all the records and count them
|
||||
/// The sql statement is provided as a string.
|
||||
@ -137,9 +146,9 @@ function get_record($table, $field, $value, $field2="", $value2="", $field3="",
|
||||
|
||||
$select = "WHERE $field = '$value'";
|
||||
|
||||
if ($field2 and $value2) {
|
||||
if ($field2) {
|
||||
$select .= " AND $field2 = '$value2'";
|
||||
if ($field3 and $value3) {
|
||||
if ($field3) {
|
||||
$select .= " AND $field3 = '$value3'";
|
||||
}
|
||||
}
|
||||
@ -171,7 +180,7 @@ function get_records($table, $field="", $value="", $sort="", $fields="*") {
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($field and $value) {
|
||||
if ($field) {
|
||||
$select = "WHERE $field = '$value'";
|
||||
}
|
||||
if ($sort) {
|
||||
@ -181,17 +190,32 @@ function get_records($table, $field="", $value="", $sort="", $fields="*") {
|
||||
return get_records_sql("SELECT $fields FROM $CFG->prefix$table $select $sortorder");
|
||||
}
|
||||
|
||||
|
||||
function get_records_list($table, $field="", $values="", $sort="", $fields="*") {
|
||||
// Get a number of records as an array of objects
|
||||
// Differs from get_records() in that the values variable
|
||||
// can be a comma-separated list of values eg "4,5,6,10"
|
||||
// Can optionally be sorted eg "time ASC" or "time DESC"
|
||||
// The "key" is the first column returned, eg usually "id"
|
||||
function get_records_select($table, $select="", $sort="", $fields="*") {
|
||||
/// Get a number of records as an array of objects
|
||||
/// Can optionally be sorted eg "time ASC" or "time DESC"
|
||||
/// "select" is a fragment of SQL to define the selection criteria
|
||||
/// The "key" is the first column returned, eg usually "id"
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($field and $value) {
|
||||
if ($sort) {
|
||||
$sortorder = "ORDER BY $sort";
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT $fields FROM $CFG->prefix$table $select $sortorder");
|
||||
}
|
||||
|
||||
|
||||
function get_records_list($table, $field="", $values="", $sort="", $fields="*") {
|
||||
/// Get a number of records as an array of objects
|
||||
/// Differs from get_records() in that the values variable
|
||||
/// can be a comma-separated list of values eg "4,5,6,10"
|
||||
/// Can optionally be sorted eg "time ASC" or "time DESC"
|
||||
/// The "key" is the first column returned, eg usually "id"
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($field) {
|
||||
$select = "WHERE $field in ($values)";
|
||||
}
|
||||
if ($sort) {
|
||||
@ -202,10 +226,11 @@ function get_records_list($table, $field="", $values="", $sort="", $fields="*")
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_records_sql($sql) {
|
||||
// Get a number of records as an array of objects
|
||||
// The "key" is the first column returned, eg usually "id"
|
||||
// The sql statement is provided as a string.
|
||||
/// Get a number of records as an array of objects
|
||||
/// The "key" is the first column returned, eg usually "id"
|
||||
/// The sql statement is provided as a string.
|
||||
|
||||
global $db;
|
||||
|
||||
@ -226,11 +251,45 @@ function get_records_sql($sql) {
|
||||
}
|
||||
}
|
||||
|
||||
function get_records_menu($table, $field="", $value="", $sort="", $fields="*") {
|
||||
/// Get a number of records as an array of objects
|
||||
/// Can optionally be sorted eg "time ASC" or "time DESC"
|
||||
/// If "fields" is specified, only those fields are returned
|
||||
/// The "key" is the first column returned, eg usually "id"
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($field) {
|
||||
$select = "WHERE $field = '$value'";
|
||||
}
|
||||
if ($sort) {
|
||||
$sortorder = "ORDER BY $sort";
|
||||
}
|
||||
|
||||
return get_records_sql_menu("SELECT $fields FROM $CFG->prefix$table $select $sortorder");
|
||||
}
|
||||
|
||||
function get_records_select_menu($table, $select="", $sort="", $fields="*") {
|
||||
/// Get a number of records as an array of objects
|
||||
/// Can optionally be sorted eg "time ASC" or "time DESC"
|
||||
/// "select" is a fragment of SQL to define the selection criteria
|
||||
/// Returns associative array of first two fields
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($sort) {
|
||||
$sortorder = "ORDER BY $sort";
|
||||
}
|
||||
|
||||
return get_records_sql_menu("SELECT $fields FROM $CFG->prefix$table $select $sortorder");
|
||||
}
|
||||
|
||||
|
||||
function get_records_sql_menu($sql) {
|
||||
// Given an SQL select, this function returns an associative
|
||||
// array of the first two columns. This is most useful in
|
||||
// combination with the choose_from_menu function to create
|
||||
// a form menu.
|
||||
/// Given an SQL select, this function returns an associative
|
||||
/// array of the first two columns. This is most useful in
|
||||
/// combination with the choose_from_menu function to create
|
||||
/// a form menu.
|
||||
|
||||
global $db;
|
||||
|
||||
@ -278,11 +337,11 @@ function delete_records($table, $field="", $value="", $field2="", $value2="", $f
|
||||
|
||||
global $db, $CFG;
|
||||
|
||||
if ($field and $value) {
|
||||
if ($field) {
|
||||
$select = "WHERE $field = '$value'";
|
||||
if ($field2 and $value2) {
|
||||
if ($field2) {
|
||||
$select .= " AND $field2 = '$value2'";
|
||||
if ($field3 and $value3) {
|
||||
if ($field3) {
|
||||
$select .= " AND $field3 = '$value3'";
|
||||
}
|
||||
}
|
||||
@ -482,7 +541,9 @@ function adminlogin($username, $md5password) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
return record_exists_sql("SELECT u.id FROM {$CFG->prefix}user u, {$CFG->prefix}user_admins a
|
||||
return record_exists_sql("SELECT u.id
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_admins a
|
||||
WHERE u.id = a.user
|
||||
AND u.username = '$username'
|
||||
AND u.password = '$md5password'");
|
||||
@ -499,6 +560,31 @@ function get_site () {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_courses($category=0, $sort="fullname ASC") {
|
||||
/// Returns list of courses
|
||||
|
||||
if ($category > 0) { // Return all courses in one category
|
||||
return get_records("course", "category", $category, $sort);
|
||||
|
||||
} else if ($category < 0) { // Return all courses, even the site
|
||||
return get_records("course", "", "", $sort);
|
||||
|
||||
} else { // Return all courses, except site
|
||||
return get_records_select("course", "category > 0", $sort);
|
||||
}
|
||||
}
|
||||
|
||||
function get_categories() {
|
||||
return get_records("course_categories", "", "", "name");
|
||||
}
|
||||
|
||||
|
||||
function get_guest() {
|
||||
return get_user_info_from_db("username", "guest");
|
||||
}
|
||||
|
||||
|
||||
function get_admin () {
|
||||
/// Returns $user object of the main admin user
|
||||
|
||||
@ -581,9 +667,82 @@ function get_course_users($courseid, $sort="u.lastaccess DESC") {
|
||||
}
|
||||
|
||||
|
||||
function get_users_search($search, $sort="u.firstname ASC") {
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT * from {$CFG->prefix}user
|
||||
WHERE confirmed = 1
|
||||
AND deleted = 0
|
||||
AND (firstname LIKE '%$search%' OR
|
||||
lastname LIKE '%$search%' OR
|
||||
email LIKE '%$search%')
|
||||
AND username <> 'guest'
|
||||
AND username <> 'changeme'");
|
||||
}
|
||||
|
||||
|
||||
function get_users_count() {
|
||||
return count_record_select("user", "username <> 'guest' AND deleted <> 1");
|
||||
}
|
||||
|
||||
function get_users_listing($sort, $dir="ASC", $page=1, $recordsperpage=20) {
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT id, username, email, firstname, lastname, city, country, lastaccess
|
||||
FROM {$CFG->prefix}user
|
||||
WHERE username <> 'guest'
|
||||
AND deleted <> '1'
|
||||
ORDER BY $sort $dir
|
||||
LIMIT $page,$recordsperpage");
|
||||
|
||||
}
|
||||
|
||||
function get_users_confirmed() {
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}user
|
||||
WHERE confirmed = 1
|
||||
AND deleted = 0
|
||||
AND username <> 'guest'
|
||||
AND username <> 'changeme'");
|
||||
}
|
||||
|
||||
|
||||
function get_users_unconfirmed($cutofftime=999999999) {
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT *
|
||||
FROM {$CFG->prefix}user
|
||||
WHERE confirmed = 0
|
||||
AND firstaccess > 0
|
||||
AND firstaccess < '$cutofftime'");
|
||||
}
|
||||
|
||||
|
||||
function get_users_longtimenosee($cutofftime) {
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT u.*
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_students s
|
||||
WHERE lastaccess > '0'
|
||||
AND lastaccess < '$cutofftime'
|
||||
AND u.id = s.user
|
||||
GROUP BY u.id");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// MODULE FUNCTIONS /////////////////////////////////////////////////
|
||||
|
||||
function get_course_mods($courseid) {
|
||||
/// Just gets a raw list of all modules in a course
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT cm.*, m.name as modname
|
||||
FROM {$CFG->prefix}modules m, {$CFG->prefix}course_modules cm
|
||||
WHERE cm.course = '$courseid'
|
||||
AND cm.deleted = '0'
|
||||
AND cm.module = m.id ");
|
||||
}
|
||||
|
||||
function get_coursemodule_from_instance($modulename, $instance, $courseid) {
|
||||
/// Given an instance of a module, finds the coursemodule description
|
||||
|
||||
@ -619,4 +778,75 @@ function get_all_instances_in_course($modulename, $courseid, $sort="cw.section")
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// LOG FUNCTIONS /////////////////////////////////////////////////////
|
||||
|
||||
|
||||
function add_to_log($course, $module, $action, $url="", $info="") {
|
||||
/// Add an entry to the log table. These are "action" focussed rather
|
||||
/// than web server hits, and provide a way to easily reconstruct what
|
||||
/// any particular student has been doing.
|
||||
///
|
||||
/// course = the course id
|
||||
/// module = forum, journal, resource, course, user etc
|
||||
/// action = view, edit, post (often but not always the same as the file.php)
|
||||
/// url = the file and parameters used to see the results of the action
|
||||
/// info = additional description information
|
||||
|
||||
global $db, $USER, $REMOTE_ADDR;
|
||||
|
||||
if (isset($USER->realuser)) { // Don't log
|
||||
return;
|
||||
}
|
||||
|
||||
$timenow = time();
|
||||
$info = addslashes($info);
|
||||
|
||||
$result = $db->Execute("INSERT INTO log
|
||||
SET time = '$timenow',
|
||||
user = '$USER->id',
|
||||
course = '$course',
|
||||
ip = '$REMOTE_ADDR',
|
||||
module = '$module',
|
||||
action = '$action',
|
||||
url = '$url',
|
||||
info = '$info'");
|
||||
if (!$result) {
|
||||
echo "<P>Error: Could not insert a new entry to the Moodle log</P>"; // Don't throw an error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_logs($select, $order) {
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT l.*, u.firstname, u.lastname, u.picture
|
||||
FROM {$CFG->prefix}log l,
|
||||
{$CFG->prefix}user u
|
||||
$select $order");
|
||||
}
|
||||
|
||||
function get_logs_usercourse($userid, $courseid, $coursestart) {
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT floor((`time` - $coursestart)/86400) as day, count(*) as num
|
||||
FROM {$CFG->prefix}log
|
||||
WHERE user = '$userid'
|
||||
AND course = '$courseid'
|
||||
AND `time` > '$coursestart'
|
||||
GROUP BY day ");
|
||||
}
|
||||
|
||||
function get_logs_userday($userid, $courseid, $daystart) {
|
||||
global $CFG;
|
||||
|
||||
return get_records_sql("SELECT floor((`time` - $daystart)/3600) as hour, count(*) as num
|
||||
FROM {$CFG->prefix}log
|
||||
WHERE user = '$userid'
|
||||
AND course = '$courseid'
|
||||
AND `time` > '$daystart'
|
||||
GROUP BY hour ");
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -14,7 +14,7 @@
|
||||
# Table structure for table `config`
|
||||
#
|
||||
|
||||
CREATE TABLE `config` (
|
||||
CREATE TABLE `prefix_config` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
`value` varchar(255) NOT NULL default '',
|
||||
@ -27,7 +27,7 @@ CREATE TABLE `config` (
|
||||
# Table structure for table `course`
|
||||
#
|
||||
|
||||
CREATE TABLE `course` (
|
||||
CREATE TABLE `prefix_course` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`category` int(10) unsigned NOT NULL default '0',
|
||||
`password` varchar(50) NOT NULL default '',
|
||||
@ -56,7 +56,7 @@ CREATE TABLE `course` (
|
||||
# Table structure for table `course_categories`
|
||||
#
|
||||
|
||||
CREATE TABLE `course_categories` (
|
||||
CREATE TABLE `prefix_course_categories` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
@ -68,7 +68,7 @@ CREATE TABLE `course_categories` (
|
||||
# Table structure for table `course_modules`
|
||||
#
|
||||
|
||||
CREATE TABLE `course_modules` (
|
||||
CREATE TABLE `prefix_course_modules` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`module` int(10) unsigned NOT NULL default '0',
|
||||
@ -86,7 +86,7 @@ CREATE TABLE `course_modules` (
|
||||
# Table structure for table `course_sections`
|
||||
#
|
||||
|
||||
CREATE TABLE `course_sections` (
|
||||
CREATE TABLE `prefix_course_sections` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`section` int(10) unsigned NOT NULL default '0',
|
||||
@ -100,7 +100,7 @@ CREATE TABLE `course_sections` (
|
||||
# Table structure for table `log`
|
||||
#
|
||||
|
||||
CREATE TABLE `log` (
|
||||
CREATE TABLE `prefix_log` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`time` int(10) unsigned NOT NULL default '0',
|
||||
`user` int(10) unsigned NOT NULL default '0',
|
||||
@ -118,7 +118,7 @@ CREATE TABLE `log` (
|
||||
# Table structure for table `log_display`
|
||||
#
|
||||
|
||||
CREATE TABLE `log_display` (
|
||||
CREATE TABLE `prefix_log_display` (
|
||||
`module` varchar(20) NOT NULL default '',
|
||||
`action` varchar(20) NOT NULL default '',
|
||||
`mtable` varchar(20) NOT NULL default '',
|
||||
@ -130,7 +130,7 @@ CREATE TABLE `log_display` (
|
||||
# Table structure for table `modules`
|
||||
#
|
||||
|
||||
CREATE TABLE `modules` (
|
||||
CREATE TABLE `prefix_modules` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(20) NOT NULL default '',
|
||||
`version` int(10) NOT NULL default '0',
|
||||
@ -146,7 +146,7 @@ CREATE TABLE `modules` (
|
||||
# Table structure for table `user`
|
||||
#
|
||||
|
||||
CREATE TABLE `user` (
|
||||
CREATE TABLE `prefix_user` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`confirmed` tinyint(1) NOT NULL default '0',
|
||||
`deleted` tinyint(1) NOT NULL default '0',
|
||||
@ -189,7 +189,7 @@ CREATE TABLE `user` (
|
||||
# Table structure for table `user_admins`
|
||||
#
|
||||
|
||||
CREATE TABLE `user_admins` (
|
||||
CREATE TABLE `prefix_user_admins` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`user` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
@ -201,7 +201,7 @@ CREATE TABLE `user_admins` (
|
||||
# Table structure for table `user_students`
|
||||
#
|
||||
|
||||
CREATE TABLE `user_students` (
|
||||
CREATE TABLE `prefix_user_students` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`user` int(10) unsigned NOT NULL default '0',
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
@ -217,7 +217,7 @@ CREATE TABLE `user_students` (
|
||||
# Table structure for table `user_teachers`
|
||||
#
|
||||
|
||||
CREATE TABLE `user_teachers` (
|
||||
CREATE TABLE `prefix_user_teachers` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`user` int(10) unsigned NOT NULL default '0',
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
|
1673
lib/moodlelib.php
1673
lib/moodlelib.php
File diff suppressed because it is too large
Load Diff
@ -26,8 +26,9 @@
|
||||
|
||||
/// Load up standard libraries
|
||||
|
||||
require("$CFG->libdir/weblib.php"); // Standard web page functions
|
||||
require("$CFG->libdir/moodlelib.php"); // Various Moodle functions
|
||||
require("$CFG->libdir/weblib.php"); // Functions for producing HTML
|
||||
require("$CFG->libdir/datalib.php"); // Functions for accessing databases
|
||||
require("$CFG->libdir/moodlelib.php"); // Other general-purpose functions
|
||||
|
||||
|
||||
/// Set error reporting back to normal
|
||||
@ -36,7 +37,7 @@
|
||||
|
||||
/// Load up any configuration from the config table
|
||||
|
||||
if ($configs = get_records_sql("SELECT * FROM config")) {
|
||||
if ($configs = get_records("config")) {
|
||||
$CFG = (array)$CFG;
|
||||
foreach ($configs as $config) {
|
||||
$CFG[$config->name] = $config->value;
|
||||
@ -112,8 +113,10 @@
|
||||
if (! isset($_SESSION["USER"])) { $_SESSION["USER"] = new object; }
|
||||
extract($_SESSION); // Makes $SESSION and $USER available for read-only access
|
||||
|
||||
$FULLME = qualified_me();
|
||||
$ME = strip_querystring($FULLME);
|
||||
if (!$FULLME) {
|
||||
$FULLME = qualified_me();
|
||||
}
|
||||
$ME = strip_querystring($FULLME);
|
||||
|
||||
|
||||
/// Set language/locale of printed times. If user has chosen a language that
|
||||
|
595
lib/weblib.php
595
lib/weblib.php
@ -1,10 +1,33 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
// weblib.php
|
||||
//
|
||||
// Library of useful PHP functions and constants related to web pages.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// weblib.php - functions for web output
|
||||
//
|
||||
// Library of all general-purpose Moodle PHP functions and constants
|
||||
// that produce HTML output
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.com //
|
||||
// //
|
||||
// Copyright (C) 2001-2003 Martin Dougiamas http://dougiamas.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation; either version 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Constants
|
||||
|
||||
@ -496,4 +519,570 @@ function highlight($needle, $haystack) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// STANDARD WEB PAGE PARTS ///////////////////////////////////////////////////
|
||||
|
||||
function print_header ($title="", $heading="", $navigation="", $focus="", $meta="", $cache=true, $button=" ", $menu="") {
|
||||
// $title - appears top of window
|
||||
// $heading - appears top of page
|
||||
// $navigation - premade navigation string
|
||||
// $focus - indicates form element eg inputform.password
|
||||
// $meta - meta tags in the header
|
||||
// $cache - should this page be cacheable?
|
||||
// $button - HTML code for a button (usually for module editing)
|
||||
// $menu - HTML code for a popup menu
|
||||
global $USER, $CFG, $THEME;
|
||||
|
||||
if (file_exists("$CFG->dirroot/theme/$CFG->theme/styles.php")) {
|
||||
$styles = $CFG->stylesheet;
|
||||
} else {
|
||||
$styles = "$CFG->wwwroot/theme/standard/styles.php";
|
||||
}
|
||||
|
||||
if ($navigation == "home") {
|
||||
$home = true;
|
||||
$navigation = "";
|
||||
}
|
||||
|
||||
if ($button == "") {
|
||||
$button = " ";
|
||||
}
|
||||
|
||||
if (!$menu and $navigation) {
|
||||
if (isset($USER->id)) {
|
||||
$menu = "<FONT SIZE=2><A TARGET=_parent HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A></FONT>";
|
||||
} else {
|
||||
$menu = "<FONT SIZE=2><A TARGET=_parent HREF=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</A></FONT>";
|
||||
}
|
||||
}
|
||||
|
||||
// Specify character set ... default is iso-8859-1 but some languages might need something else
|
||||
// Could be optimised by carrying the charset variable around in $USER
|
||||
if (current_language() == "en") {
|
||||
$meta = "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n$meta\n";
|
||||
} else {
|
||||
$meta = "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=".get_string("thischarset")."\">\n$meta\n";
|
||||
}
|
||||
|
||||
if ($CFG->langdir == "RTL") {
|
||||
$direction = " DIR=\"RTL\"";
|
||||
} else {
|
||||
$direction = " DIR=\"LTR\"";
|
||||
}
|
||||
|
||||
if (!$cache) { // Do everything we can to prevent clients and proxies caching
|
||||
@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
@header("Pragma: no-cache");
|
||||
$meta .= "\n<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">";
|
||||
$meta .= "\n<META HTTP-EQUIV=\"Expires\" CONTENT=\"0\">";
|
||||
}
|
||||
|
||||
include ("$CFG->dirroot/theme/$CFG->theme/header.html");
|
||||
}
|
||||
|
||||
function print_footer ($course=NULL) {
|
||||
// Can provide a course object to make the footer contain a link to
|
||||
// to the course home page, otherwise the link will go to the site home
|
||||
global $USER, $CFG, $THEME;
|
||||
|
||||
|
||||
/// Course links
|
||||
if ($course) {
|
||||
if ($course == "home") { // special case for site home page - please do not remove
|
||||
$homelink = "<P ALIGN=center><A TITLE=\"Moodle $CFG->release ($CFG->version)\" HREF=\"http://moodle.com/\">";
|
||||
$homelink .= "<BR><IMG WIDTH=130 HEIGHT=19 SRC=\"pix/madewithmoodle2.gif\" BORDER=0></A></P>";
|
||||
$course = get_site();
|
||||
$homepage = true;
|
||||
} else {
|
||||
$homelink = "<A TARGET=_top HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>";
|
||||
}
|
||||
} else {
|
||||
$homelink = "<A TARGET=_top HREF=\"$CFG->wwwroot\">".get_string("home")."</A>";
|
||||
$course = get_site();
|
||||
}
|
||||
|
||||
/// User links
|
||||
if ($USER->realuser) {
|
||||
if ($realuser = get_record("user", "id", $USER->realuser)) {
|
||||
$realuserinfo = " [<A HREF=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=$realuser->id\">$realuser->firstname $realuser->lastname</A>] ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($USER->id) {
|
||||
$username = "<A HREF=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$USER->firstname $USER->lastname</A>";
|
||||
$loggedinas = $realuserinfo.get_string("loggedinas", "moodle", "$username").
|
||||
" (<A HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A>)";
|
||||
} else {
|
||||
$loggedinas = get_string("loggedinnot", "moodle").
|
||||
" (<A HREF=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</A>)";
|
||||
}
|
||||
|
||||
include ("$CFG->dirroot/theme/$CFG->theme/footer.html");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function print_navigation ($navigation) {
|
||||
global $CFG;
|
||||
|
||||
if ($navigation) {
|
||||
if (! $site = get_site()) {
|
||||
$site->shortname = get_string("home");;
|
||||
}
|
||||
echo "<A TARGET=_top HREF=\"$CFG->wwwroot/\">$site->shortname</A> -> $navigation";
|
||||
}
|
||||
}
|
||||
|
||||
function print_heading($text, $align="CENTER", $size=3) {
|
||||
echo "<P ALIGN=\"$align\"><FONT SIZE=\"$size\"><B>".stripslashes($text)."</B></FONT></P>";
|
||||
}
|
||||
|
||||
function print_heading_with_help($text, $helppage, $module="moodle") {
|
||||
// Centered heading with attached help button (same title text)
|
||||
echo "<P ALIGN=\"CENTER\"><FONT SIZE=\"3\"><B>".stripslashes($text);
|
||||
helpbutton($helppage, $text, $module);
|
||||
echo "</B></FONT></P>";
|
||||
}
|
||||
|
||||
function print_continue($link) {
|
||||
global $HTTP_REFERER;
|
||||
|
||||
if (!$link) {
|
||||
$link = $HTTP_REFERER;
|
||||
}
|
||||
|
||||
print_heading("<A HREF=\"$link\">".get_string("continue")."</A>");
|
||||
}
|
||||
|
||||
|
||||
function print_simple_box($message, $align="", $width="", $color="#FFFFFF", $padding=5, $class="generalbox") {
|
||||
print_simple_box_start($align, $width, $color, $padding, $class);
|
||||
echo stripslashes($message);
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
function print_simple_box_start($align="", $width="", $color="#FFFFFF", $padding=5, $class="generalbox") {
|
||||
global $THEME;
|
||||
|
||||
if ($align) {
|
||||
$tablealign = "ALIGN=\"$align\"";
|
||||
}
|
||||
if ($width) {
|
||||
$tablewidth = "WIDTH=\"$width\"";
|
||||
}
|
||||
echo "<table $tablealign $tablewidth class=\"$class\" border=\"0\" cellpadding=\"$padding\" cellspacing=\"0\"><tr><td bgcolor=\"$color\" class=\"$class"."content\">";
|
||||
}
|
||||
|
||||
function print_simple_box_end() {
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
|
||||
function print_single_button($link, $options, $label="OK") {
|
||||
echo "<FORM ACTION=\"$link\" METHOD=GET>";
|
||||
if ($options) {
|
||||
foreach ($options as $name => $value) {
|
||||
echo "<INPUT TYPE=hidden NAME=\"$name\" VALUE=\"$value\">";
|
||||
}
|
||||
}
|
||||
echo "<INPUT TYPE=submit VALUE=\"$label\"></FORM>";
|
||||
}
|
||||
|
||||
function print_spacer($height=1, $width=1, $br=true) {
|
||||
global $CFG;
|
||||
echo "<IMG HEIGHT=\"$height\" WIDTH=\"$width\" SRC=\"$CFG->wwwroot/pix/spacer.gif\" ALT=\"\">";
|
||||
if ($br) {
|
||||
echo "<BR \>\n";
|
||||
}
|
||||
}
|
||||
|
||||
function print_file_picture($path, $courseid=0, $height="", $width="", $link="") {
|
||||
// Given the path to a picture file in a course, or a URL,
|
||||
// this function includes the picture in the page.
|
||||
global $CFG;
|
||||
|
||||
if ($height) {
|
||||
$height = "HEIGHT=\"$height\"";
|
||||
}
|
||||
if ($width) {
|
||||
$width = "WIDTH=\"$width\"";
|
||||
}
|
||||
if ($link) {
|
||||
echo "<A HREF=\"$link\">";
|
||||
}
|
||||
if (substr(strtolower($path), 0, 7) == "http://") {
|
||||
echo "<IMG BORDER=0 $height $width SRC=\"$path\">";
|
||||
|
||||
} else if ($courseid) {
|
||||
echo "<IMG BORDER=0 $height $width SRC=\"";
|
||||
if ($CFG->slasharguments) { // Use this method if possible for better caching
|
||||
echo "$CFG->wwwroot/file.php/$courseid/$path";
|
||||
} else {
|
||||
echo "$CFG->wwwroot/file.php?file=$courseid/$path";
|
||||
}
|
||||
echo "\">";
|
||||
} else {
|
||||
echo "Error: must pass URL or course";
|
||||
}
|
||||
if ($link) {
|
||||
echo "</A>";
|
||||
}
|
||||
}
|
||||
|
||||
function print_user_picture($userid, $courseid, $picture, $large=false, $returnstring=false, $link=true) {
|
||||
global $CFG;
|
||||
|
||||
if ($link) {
|
||||
$output = "<A HREF=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">";
|
||||
} else {
|
||||
$output = "";
|
||||
}
|
||||
if ($large) {
|
||||
$file = "f1.jpg";
|
||||
$size = 100;
|
||||
} else {
|
||||
$file = "f2.jpg";
|
||||
$size = 35;
|
||||
}
|
||||
if ($picture) {
|
||||
if ($CFG->slasharguments) { // Use this method if possible for better caching
|
||||
$output .= "<IMG SRC=\"$CFG->wwwroot/user/pix.php/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
|
||||
} else {
|
||||
$output .= "<IMG SRC=\"$CFG->wwwroot/user/pix.php?file=/$userid/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
|
||||
}
|
||||
} else {
|
||||
$output .= "<IMG SRC=\"$CFG->wwwroot/user/default/$file\" BORDER=0 WIDTH=$size HEIGHT=$size ALT=\"\">";
|
||||
}
|
||||
if ($link) {
|
||||
$output .= "</A>";
|
||||
}
|
||||
|
||||
if ($returnstring) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
function print_table($table) {
|
||||
// Prints a nicely formatted table.
|
||||
// $table is an object with several properties.
|
||||
// $table->head is an array of heading names.
|
||||
// $table->align is an array of column alignments
|
||||
// $table->size is an array of column sizes
|
||||
// $table->data[] is an array of arrays containing the data.
|
||||
// $table->width is an percentage of the page
|
||||
// $table->cellpadding padding on each cell
|
||||
// $table->cellspacing spacing between cells
|
||||
|
||||
if (isset($table->align)) {
|
||||
foreach ($table->align as $key => $aa) {
|
||||
if ($aa) {
|
||||
$align[$key] = " ALIGN=\"$aa\"";
|
||||
} else {
|
||||
$align[$key] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($table->size)) {
|
||||
foreach ($table->size as $key => $ss) {
|
||||
if ($ss) {
|
||||
$size[$key] = " WIDTH=\"$ss\"";
|
||||
} else {
|
||||
$size[$key] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$table->width) {
|
||||
$table->width = "80%";
|
||||
}
|
||||
|
||||
if (!$table->cellpadding) {
|
||||
$table->cellpadding = "5";
|
||||
}
|
||||
|
||||
if (!$table->cellspacing) {
|
||||
$table->cellspacing = "1";
|
||||
}
|
||||
|
||||
print_simple_box_start("CENTER", "$table->width", "#FFFFFF", 0);
|
||||
echo "<TABLE WIDTH=100% BORDER=0 valign=top align=center ";
|
||||
echo " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" class=\"generaltable\">\n";
|
||||
|
||||
if ($table->head) {
|
||||
echo "<TR>";
|
||||
foreach ($table->head as $key => $heading) {
|
||||
echo "<TH VALIGN=top ".$align[$key].$size[$key]." NOWRAP class=\"generaltableheader\">$heading</TH>";
|
||||
}
|
||||
echo "</TR>\n";
|
||||
}
|
||||
|
||||
foreach ($table->data as $row) {
|
||||
echo "<TR VALIGN=TOP>";
|
||||
foreach ($row as $key => $item) {
|
||||
echo "<TD ".$align[$key].$size[$key]." class=\"generaltablecell\">$item</TD>";
|
||||
}
|
||||
echo "</TR>\n";
|
||||
}
|
||||
echo "</TABLE>\n";
|
||||
print_simple_box_end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function print_editing_switch($courseid) {
|
||||
global $CFG, $USER;
|
||||
|
||||
if (isteacher($courseid)) {
|
||||
if ($USER->editing) {
|
||||
echo "<A HREF=\"$CFG->wwwroot/course/view.php?id=$courseid&edit=off\">Turn editing off</A>";
|
||||
} else {
|
||||
echo "<A HREF=\"$CFG->wwwroot/course/view.php?id=$courseid&edit=on\">Turn editing on</A>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function print_textarea($richedit, $rows, $cols, $width, $height, $name, $value="") {
|
||||
global $CFG, $THEME;
|
||||
|
||||
if ($richedit) {
|
||||
echo "<object id=richedit style=\"BACKGROUND-COLOR: buttonface\"";
|
||||
echo " data=\"$CFG->wwwroot/lib/rte/richedit.html\"";
|
||||
echo " width=\"$width\" height=\"$height\" ";
|
||||
echo " type=\"text/x-scriptlet\" VIEWASTEXT></object>\n";
|
||||
echo "<TEXTAREA style=\"display:none\" NAME=\"$name\" ROWS=1 COLS=1>";
|
||||
p($value);
|
||||
echo "</TEXTAREA>\n";
|
||||
} else {
|
||||
echo "<TEXTAREA name=\"$name\" rows=\"$rows\" cols=\"$cols\" wrap=virtual>";
|
||||
p($value);
|
||||
echo "</TEXTAREA>\n";
|
||||
}
|
||||
}
|
||||
|
||||
function print_richedit_javascript($form, $name, $source="no") {
|
||||
echo "<SCRIPT language=\"JavaScript\" event=\"onload\" for=\"window\">\n";
|
||||
echo " document.richedit.options = \"history=no;source=$source\";";
|
||||
echo " document.richedit.docHtml = $form.$name.innerText;";
|
||||
echo "</SCRIPT>";
|
||||
}
|
||||
|
||||
|
||||
function update_course_icon($courseid) {
|
||||
// Used to be an icon, but it's now a simple form button
|
||||
global $CFG, $USER;
|
||||
|
||||
if (isteacher($courseid)) {
|
||||
if ($USER->editing) {
|
||||
$string = get_string("turneditingoff");
|
||||
$edit = "off";
|
||||
} else {
|
||||
$string = get_string("turneditingon");
|
||||
$edit = "on";
|
||||
}
|
||||
return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/view.php\">".
|
||||
"<INPUT TYPE=hidden NAME=id VALUE=\"$courseid\">".
|
||||
"<INPUT TYPE=hidden NAME=edit VALUE=\"$edit\">".
|
||||
"<INPUT TYPE=submit VALUE=\"$string\"></FORM>";
|
||||
}
|
||||
}
|
||||
|
||||
function update_module_button($moduleid, $courseid, $string) {
|
||||
// Prints the editing button on a module "view" page
|
||||
global $CFG;
|
||||
|
||||
if (isteacher($courseid)) {
|
||||
$string = get_string("updatethis", "", $string);
|
||||
return "<FORM TARGET=_parent METHOD=GET ACTION=\"$CFG->wwwroot/course/mod.php\">".
|
||||
"<INPUT TYPE=hidden NAME=update VALUE=\"$moduleid\">".
|
||||
"<INPUT TYPE=hidden NAME=return VALUE=\"true\">".
|
||||
"<INPUT TYPE=submit VALUE=\"$string\"></FORM>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function navmenu($course, $cm=NULL) {
|
||||
// Given a course and a (current) coursemodule
|
||||
// This function returns a small popup menu with all the
|
||||
// course activity modules in it, as a navigation menu
|
||||
// The data is taken from the serialised array stored in
|
||||
// the course record
|
||||
|
||||
global $CFG;
|
||||
|
||||
if ($cm) {
|
||||
$cm = $cm->id;
|
||||
}
|
||||
|
||||
if ($course->format == 'weeks') {
|
||||
$strsection = get_string("week");
|
||||
} else {
|
||||
$strsection = get_string("topic");
|
||||
}
|
||||
|
||||
if (!$modinfo = unserialize($course->modinfo)) {
|
||||
return "";
|
||||
}
|
||||
$section = -1;
|
||||
$selected = "";
|
||||
foreach ($modinfo as $mod) {
|
||||
if ($mod->section > 0 and $section <> $mod->section) {
|
||||
$menu[] = "-------------- $strsection $mod->section --------------";
|
||||
}
|
||||
$section = $mod->section;
|
||||
$url = "$mod->mod/view.php?id=$mod->cm";
|
||||
if ($cm == $mod->cm) {
|
||||
$selected = $url;
|
||||
}
|
||||
$mod->name = urldecode($mod->name);
|
||||
if (strlen($mod->name) > 55) {
|
||||
$mod->name = substr($mod->name, 0, 50)."...";
|
||||
}
|
||||
$menu[$url] = $mod->name;
|
||||
}
|
||||
|
||||
return popup_form("$CFG->wwwroot/mod/", $menu, "navmenu", $selected, get_string("jumpto"), "", "", true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function print_date_selector($day, $month, $year, $currenttime=0) {
|
||||
// Currenttime is a default timestamp in GMT
|
||||
// Prints form items with the names $day, $month and $year
|
||||
|
||||
if (!$currenttime) {
|
||||
$currenttime = time();
|
||||
}
|
||||
$currentdate = usergetdate($currenttime);
|
||||
|
||||
for ($i=1; $i<=31; $i++) {
|
||||
$days[$i] = "$i";
|
||||
}
|
||||
for ($i=1; $i<=12; $i++) {
|
||||
$months[$i] = date("F", mktime(0,0,0,$i,1,2000));
|
||||
}
|
||||
for ($i=2000; $i<=2010; $i++) {
|
||||
$years[$i] = $i;
|
||||
}
|
||||
choose_from_menu($days, $day, $currentdate[mday], "");
|
||||
choose_from_menu($months, $month, $currentdate[mon], "");
|
||||
choose_from_menu($years, $year, $currentdate[year], "");
|
||||
}
|
||||
|
||||
function print_time_selector($hour, $minute, $currenttime=0) {
|
||||
// Currenttime is a default timestamp in GMT
|
||||
// Prints form items with the names $hour and $minute
|
||||
|
||||
if (!$currenttime) {
|
||||
$currenttime = time();
|
||||
}
|
||||
$currentdate = usergetdate($currenttime);
|
||||
for ($i=0; $i<=23; $i++) {
|
||||
$hours[$i] = sprintf("%02d",$i);
|
||||
}
|
||||
for ($i=0; $i<=59; $i++) {
|
||||
$minutes[$i] = sprintf("%02d",$i);
|
||||
}
|
||||
choose_from_menu($hours, $hour, $currentdate[hours], "");
|
||||
choose_from_menu($minutes, $minute, $currentdate[minutes], "");
|
||||
}
|
||||
|
||||
function error ($message, $link="") {
|
||||
global $CFG, $SESSION;
|
||||
|
||||
print_header(get_string("error"));
|
||||
echo "<BR>";
|
||||
print_simple_box($message, "center", "", "#FFBBBB");
|
||||
|
||||
if (!$link) {
|
||||
if ( !empty($SESSION->fromurl) ) {
|
||||
$link = "$SESSION->fromurl";
|
||||
unset($SESSION->fromurl);
|
||||
save_session("SESSION");
|
||||
} else {
|
||||
$link = "$CFG->wwwroot";
|
||||
}
|
||||
}
|
||||
print_continue($link);
|
||||
print_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
function helpbutton ($page, $title="", $module="moodle", $image=true, $linktext=false, $text="") {
|
||||
// $page = the keyword that defines a help page
|
||||
// $title = the title of links, rollover tips, alt tags etc
|
||||
// $module = which module is the page defined in
|
||||
// $image = use a help image for the link? (true/false/"both")
|
||||
// $text = if defined then this text is used in the page, and
|
||||
// the $page variable is ignored.
|
||||
global $CFG;
|
||||
|
||||
if ($module == "") {
|
||||
$module = "moodle";
|
||||
}
|
||||
|
||||
if ($image) {
|
||||
if ($linktext) {
|
||||
$linkobject = "$title<IMG align=\"absmiddle\" BORDER=0 HEIGHT=17 WIDTH=22 ALT=\"\" SRC=\"$CFG->wwwroot/pix/help.gif\">";
|
||||
} else {
|
||||
$linkobject = "<IMG align=\"absmiddle\" BORDER=0 HEIGHT=17 WIDTH=22 ALT=\"$title\" SRC=\"$CFG->wwwroot/pix/help.gif\">";
|
||||
}
|
||||
} else {
|
||||
$linkobject = $title;
|
||||
}
|
||||
if ($text) {
|
||||
$url = "/help.php?module=$module&text=".htmlentities(urlencode($text));
|
||||
} else {
|
||||
$url = "/help.php?module=$module&file=$page.html";
|
||||
}
|
||||
link_to_popup_window ($url, "popup", $linkobject, 400, 500, $title);
|
||||
}
|
||||
|
||||
function notice ($message, $link="") {
|
||||
global $THEME, $HTTP_REFERER;
|
||||
|
||||
if (!$link) {
|
||||
$link = $HTTP_REFERER;
|
||||
}
|
||||
|
||||
echo "<BR>";
|
||||
print_simple_box($message, "center", "", "$THEME->cellheading");
|
||||
print_heading("<A HREF=\"$link\">".get_string("continue")."</A>");
|
||||
print_footer(get_site());
|
||||
die;
|
||||
}
|
||||
|
||||
function notice_yesno ($message, $linkyes, $linkno) {
|
||||
global $THEME;
|
||||
|
||||
print_simple_box_start("center", "", "$THEME->cellheading");
|
||||
echo "<P ALIGN=CENTER><FONT SIZE=3>$message</FONT></P>";
|
||||
echo "<P ALIGN=CENTER><FONT SIZE=3><B>";
|
||||
echo "<A HREF=\"$linkyes\">".get_string("yes")."</A>";
|
||||
echo " ";
|
||||
echo "<A HREF=\"$linkno\">".get_string("no")."</A>";
|
||||
echo "</B></FONT></P>";
|
||||
print_simple_box_end();
|
||||
}
|
||||
|
||||
function redirect($url, $message="", $delay=0) {
|
||||
// Uses META tags to redirect the user, after printing a notice
|
||||
|
||||
echo "<META HTTP-EQUIV='Refresh' CONTENT='$delay; URL=$url'>";
|
||||
|
||||
if (!empty($message)) {
|
||||
print_header();
|
||||
echo "<CENTER>";
|
||||
echo "<P>$message</P>";
|
||||
echo "<P>( <A HREF=\"$url\">".get_string("continue")."</A> )</P>";
|
||||
echo "</CENTER>";
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
function notify ($message) {
|
||||
echo "<P align=center><B><FONT COLOR=#FF0000>$message</FONT></B></P>\n";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Table structure for table `assignment`
|
||||
#
|
||||
|
||||
CREATE TABLE `assignment` (
|
||||
CREATE TABLE `prefix_assignment` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
@ -22,7 +22,7 @@ CREATE TABLE `assignment` (
|
||||
# Table structure for table `assignment_submissions`
|
||||
#
|
||||
|
||||
CREATE TABLE `assignment_submissions` (
|
||||
CREATE TABLE `prefix_assignment_submissions` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`assignment` int(10) unsigned NOT NULL default '0',
|
||||
`user` int(10) unsigned NOT NULL default '0',
|
||||
@ -39,9 +39,9 @@ CREATE TABLE `assignment_submissions` (
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
INSERT INTO log_display VALUES ('assignment', 'view', 'assignment', 'name');
|
||||
INSERT INTO log_display VALUES ('assignment', 'add', 'assignment', 'name');
|
||||
INSERT INTO log_display VALUES ('assignment', 'update', 'assignment', 'name');
|
||||
INSERT INTO log_display VALUES ('assignment', 'view submissions', 'assignment', 'name');
|
||||
INSERT INTO log_display VALUES ('assignment', 'upload', 'assignment', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('assignment', 'view', 'assignment', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('assignment', 'add', 'assignment', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('assignment', 'update', 'assignment', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('assignment', 'view submissions', 'assignment', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('assignment', 'upload', 'assignment', 'name');
|
||||
|
||||
|
@ -112,11 +112,7 @@ function assignment_cron () {
|
||||
|
||||
$cutofftime = time() - $CFG->maxeditingtime;
|
||||
|
||||
if ($submissions = get_records_sql("SELECT s.*, a.course, a.name
|
||||
FROM assignment_submissions s, assignment a
|
||||
WHERE s.mailed = '0'
|
||||
AND s.timemarked < '$cutofftime' AND s.timemarked > 0
|
||||
AND s.assignment = a.id")) {
|
||||
if ($submissions = assignment_get_unmailed_submissions($cutofftime)) {
|
||||
$timenow = time();
|
||||
|
||||
foreach ($submissions as $submission) {
|
||||
@ -194,9 +190,7 @@ function assignment_print_recent_activity(&$logs, $isteacher=false) {
|
||||
|
||||
foreach ($logs as $log) {
|
||||
if ($log->module == "assignment" and $log->action == "upload") {
|
||||
$assignments[$log->info] = get_record_sql("SELECT a.name, u.firstname, u.lastname
|
||||
FROM assignment a, user u
|
||||
WHERE a.id = '$log->info' AND u.id = '$log->user'");
|
||||
$assignments[$log->info] = assignment_log_info($log);
|
||||
$assignments[$log->info]->time = $log->time;
|
||||
$assignments[$log->info]->url = $log->url;
|
||||
}
|
||||
@ -220,11 +214,62 @@ function assignment_print_recent_activity(&$logs, $isteacher=false) {
|
||||
function assignment_grades($assignmentid) {
|
||||
/// Must return an array of grades, indexed by user, and a max grade.
|
||||
|
||||
$return->grades = get_records_sql_menu("SELECT user,grade FROM assignment_submissions WHERE assignment = '$assignmentid'");
|
||||
$return->grades = get_records_menu("assignment_submissions", "assignment",
|
||||
$assignmentid, "", "user,grade");
|
||||
$return->maxgrade = get_field("assignment", "grade", "id", "$assignmentid");
|
||||
return $return;
|
||||
}
|
||||
|
||||
/// SQL STATEMENTS //////////////////////////////////////////////////////////////////
|
||||
|
||||
function assignment_log_info($log) {
|
||||
global $CFG;
|
||||
return get_record_sql("SELECT a.name, u.firstname, u.lastname
|
||||
FROM {$CFG->prefix}assignment a,
|
||||
{$CFG->prefix}user u
|
||||
WHERE a.id = '$log->info'
|
||||
AND u.id = '$log->user'");
|
||||
}
|
||||
|
||||
function assignment_get_all_submissions($assignment) {
|
||||
/// Return all assignment submissions by ENROLLED students
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT a.*
|
||||
FROM {$CFG->prefix}assignment_submissions a,
|
||||
{$CFG->prefix}user_students s
|
||||
WHERE a.user = s.user
|
||||
AND s.course = '$assignment->course'
|
||||
AND a.assignment = '$assignment->id'
|
||||
ORDER BY a.timemodified DESC");
|
||||
}
|
||||
|
||||
function assignment_get_users_done($assignment) {
|
||||
/// Return list of users who have done an assignment
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT u.*
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_students s,
|
||||
{$CFG->prefix}assignment_submissions a
|
||||
WHERE s.course = '$assignment->course'
|
||||
AND s.user = u.id
|
||||
AND u.id = a.user
|
||||
AND a.assignment = '$assignment->id'
|
||||
ORDER BY a.timemodified DESC");
|
||||
}
|
||||
|
||||
function assignment_get_unmailed_submissions($cutofftime) {
|
||||
/// Return list of marked submissions that have not been mailed out
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT s.*, a.course, a.name
|
||||
FROM {$CFG->prefix}assignment_submissions s,
|
||||
{$CFG->prefix}assignment a
|
||||
WHERE s.mailed = 0
|
||||
AND s.timemarked < $cutofftime
|
||||
AND s.timemarked > 0
|
||||
AND s.assignment = a.id");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function assignment_file_area_name($assignment, $user) {
|
||||
@ -239,24 +284,7 @@ function assignment_file_area($assignment, $user) {
|
||||
}
|
||||
|
||||
function assignment_get_submission($assignment, $user) {
|
||||
return get_record_sql("SELECT * from assignment_submissions
|
||||
WHERE assignment = '$assignment->id' AND user = '$user->id'");
|
||||
}
|
||||
|
||||
function assignment_get_all_submissions($assignment) {
|
||||
// Return all assignment submissions by ENROLLED students
|
||||
return get_records_sql("SELECT a.* FROM assignment_submissions a, user_students s
|
||||
WHERE a.user = s.user
|
||||
AND s.course = '$assignment->course'
|
||||
AND a.assignment = '$assignment->id'
|
||||
ORDER BY a.timemodified DESC");
|
||||
}
|
||||
|
||||
function assignment_get_users_done($assignment) {
|
||||
return get_records_sql("SELECT u.* FROM user u, user_students s, assignment_submissions a
|
||||
WHERE s.course = '$assignment->course' AND s.user = u.id
|
||||
AND u.id = a.user AND a.assignment = '$assignment->id'
|
||||
ORDER BY a.timemodified DESC");
|
||||
return get_record("assignment_submissions", "assignment", $assignment->id, "user", $user->id);
|
||||
}
|
||||
|
||||
function assignment_print_difference($time) {
|
||||
|
@ -51,9 +51,8 @@
|
||||
echo "<P align=right><A HREF=\"submissions.php?id=$assignment->id\">".
|
||||
get_string("viewfeedback", "assignment")."</A></P>";
|
||||
} else {
|
||||
$count = count_records_sql("SELECT COUNT(*) FROM assignment_submissions
|
||||
WHERE assignment = '$assignment->id'
|
||||
AND timemodified > 0");
|
||||
$count = count_records_select("assignment_submissions",
|
||||
"assignment = '$assignment->id' AND timemodified > 0");
|
||||
echo "<P align=right><A HREF=\"submissions.php?id=$assignment->id\">".
|
||||
get_string("viewsubmissions", "assignment", $count)."</A></P>";
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
# Table structure for table `choice`
|
||||
#
|
||||
|
||||
CREATE TABLE choice (
|
||||
CREATE TABLE prefix_choice (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
course int(10) unsigned NOT NULL default '0',
|
||||
name varchar(255) NOT NULL default '',
|
||||
@ -37,7 +37,7 @@ CREATE TABLE choice (
|
||||
# Table structure for table `choice_answers`
|
||||
#
|
||||
|
||||
CREATE TABLE choice_answers (
|
||||
CREATE TABLE prefix_choice_answers (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
choice int(10) unsigned NOT NULL default '0',
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
@ -51,10 +51,10 @@ CREATE TABLE choice_answers (
|
||||
# Dumping data for table `log_display`
|
||||
#
|
||||
|
||||
INSERT INTO log_display VALUES ('choice', 'view', 'choice', 'name');
|
||||
INSERT INTO log_display VALUES ('choice', 'update', 'choice', 'name');
|
||||
INSERT INTO log_display VALUES ('choice', 'add', 'choice', 'name');
|
||||
INSERT INTO log_display VALUES ('choice', 'report', 'choice', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('choice', 'view', 'choice', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('choice', 'update', 'choice', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('choice', 'add', 'choice', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('choice', 'report', 'choice', 'name');
|
||||
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
notice("There are no choices", "../../course/view.php?id=$course->id");
|
||||
}
|
||||
|
||||
if ( $allanswers = get_records_sql("SELECT * FROM choice_answers WHERE user='$USER->id'")) {
|
||||
if ( $allanswers = get_records("choice_answers", "user", $USER->id)) {
|
||||
foreach ($allanswers as $aa) {
|
||||
$answers[$aa->choice] = $aa;
|
||||
}
|
||||
|
@ -3,8 +3,7 @@
|
||||
$CHOICE_MAX_NUMBER = 6;
|
||||
|
||||
function choice_user_outline($course, $user, $mod, $choice) {
|
||||
if ($current = get_record_sql("SELECT * FROM choice_answers
|
||||
WHERE choice='$choice->id' AND user='$user->id'")) {
|
||||
if ($current = get_record("choice_answers", "choice", $choice->id, "user", $user->id)) {
|
||||
$result->info = "'".choice_get_answer($choice, $current->answer)."'";
|
||||
$result->time = $current->timemodified;
|
||||
return $result;
|
||||
@ -14,8 +13,7 @@ function choice_user_outline($course, $user, $mod, $choice) {
|
||||
|
||||
|
||||
function choice_user_complete($course, $user, $mod, $choice) {
|
||||
if ($current = get_record_sql("SELECT * FROM choice_answers
|
||||
WHERE choice='$choice->id' AND user='$user->id'")) {
|
||||
if ($current = get_record("choice_answers", "choice", $choice->id, "user", $user->id)) {
|
||||
$result->info = "'".choice_get_answer($choice, $current->answer)."'";
|
||||
$result->time = $current->timemodified;
|
||||
echo get_string("answered", "choice").": $result->info , last updated ".userdate($result->time);
|
||||
|
@ -19,8 +19,7 @@
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
if ($current = get_record_sql("SELECT * FROM choice_answers
|
||||
WHERE choice='$choice->id' AND user='$USER->id'")) {
|
||||
if ($current = get_record("choice_answers", "choice", $choice->id, "user", $USER->id)) {
|
||||
$answerchecked[$current->answer] = "CHECKED";
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Table structure for table `forum`
|
||||
#
|
||||
|
||||
CREATE TABLE forum (
|
||||
CREATE TABLE prefix_forum (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
course int(10) unsigned NOT NULL default '0',
|
||||
type enum('single','news','general','social','eachuser','teacher') NOT NULL default 'general',
|
||||
@ -21,7 +21,7 @@ CREATE TABLE forum (
|
||||
# Table structure for table `forum_discussions`
|
||||
#
|
||||
|
||||
CREATE TABLE forum_discussions (
|
||||
CREATE TABLE prefix_forum_discussions (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
course int(10) unsigned NOT NULL default '0',
|
||||
forum int(10) unsigned NOT NULL default '0',
|
||||
@ -37,7 +37,7 @@ CREATE TABLE forum_discussions (
|
||||
# Table structure for table `forum_posts`
|
||||
#
|
||||
|
||||
CREATE TABLE forum_posts (
|
||||
CREATE TABLE prefix_forum_posts (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
discussion int(10) unsigned NOT NULL default '0',
|
||||
parent int(10) unsigned NOT NULL default '0',
|
||||
@ -58,7 +58,7 @@ CREATE TABLE forum_posts (
|
||||
# Table structure for table `forum_ratings`
|
||||
#
|
||||
|
||||
CREATE TABLE forum_ratings (
|
||||
CREATE TABLE prefix_forum_ratings (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
post int(10) unsigned NOT NULL default '0',
|
||||
@ -72,7 +72,7 @@ CREATE TABLE forum_ratings (
|
||||
# Table structure for table `forum_subscriptions`
|
||||
#
|
||||
|
||||
CREATE TABLE forum_subscriptions (
|
||||
CREATE TABLE prefix_forum_subscriptions (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
forum int(10) unsigned NOT NULL default '0',
|
||||
@ -85,14 +85,14 @@ CREATE TABLE forum_subscriptions (
|
||||
# Dumping data for table `log_display`
|
||||
#
|
||||
|
||||
INSERT INTO log_display VALUES ('forum', 'add', 'forum', 'name');
|
||||
INSERT INTO log_display VALUES ('forum', 'update', 'forum', 'name');
|
||||
INSERT INTO log_display VALUES ('forum', 'add discussion', 'forum_discussions', 'name');
|
||||
INSERT INTO log_display VALUES ('forum', 'add post', 'forum_posts', 'subject');
|
||||
INSERT INTO log_display VALUES ('forum', 'update post', 'forum_posts', 'subject');
|
||||
INSERT INTO log_display VALUES ('forum', 'view subscribers', 'forum', 'name');
|
||||
INSERT INTO log_display VALUES ('forum', 'view discussion', 'forum_discussions', 'name');
|
||||
INSERT INTO log_display VALUES ('forum', 'view forum', 'forum', 'name');
|
||||
INSERT INTO log_display VALUES ('forum', 'subscribe', 'forum', 'name');
|
||||
INSERT INTO log_display VALUES ('forum', 'unsubscribe', 'forum', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'add', 'forum', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'update', 'forum', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'add discussion', 'forum_discussions', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'add post', 'forum_posts', 'subject');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'update post', 'forum_posts', 'subject');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'view subscribers', 'forum', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'view discussion', 'forum_discussions', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'view forum', 'forum', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'subscribe', 'forum', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('forum', 'unsubscribe', 'forum', 'name');
|
||||
|
||||
|
@ -402,6 +402,45 @@ function forum_grades($forumid) {
|
||||
}
|
||||
|
||||
|
||||
/// SQL FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
|
||||
function forum_search_posts($search, $courseid) {
|
||||
/// Returns a list of posts that were found
|
||||
global $CFG;
|
||||
|
||||
if (!isteacher($courseid)) {
|
||||
$notteacherforum = "AND f.type <> 'teacher'";
|
||||
} else {
|
||||
$notteacherforum = "";
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT p.*,u.firstname,u.lastname,u.email,u.picture,u.id as userid
|
||||
FROM {$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}user u,
|
||||
{$CFG->prefix}forum f
|
||||
WHERE (p.message LIKE '%$search%' OR p.subject LIKE '%$search%')
|
||||
AND p.user = u.id
|
||||
AND p.discussion = d.id
|
||||
AND d.course = '$courseid'
|
||||
AND d.forum = f.id
|
||||
$notteacherforum
|
||||
ORDER BY p.modified DESC LIMIT 0, 50");
|
||||
}
|
||||
|
||||
function forum_get_ratings($postid, $sort="u.firstname ASC") {
|
||||
/// Returns a list of ratings for a particular post - sorted.
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT u.*, r.rating, r.time
|
||||
FROM {$CFG->prefix}forum_ratings r,
|
||||
{$CFG->prefix}user u
|
||||
WHERE r.post='$postid'
|
||||
AND r.user=u.id
|
||||
ORDER BY $sort");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// OTHER FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ -1185,15 +1224,17 @@ function forum_subscribed_users($course, $forum) {
|
||||
}
|
||||
|
||||
function forum_subscribe($userid, $forumid) {
|
||||
global $db;
|
||||
/// Adds user to the subscriber list
|
||||
|
||||
return $db->Execute("INSERT INTO forum_subscriptions SET user = '$userid', forum = '$forumid'");
|
||||
$sub->user = $userid;
|
||||
$sub->forum = $forumid;
|
||||
|
||||
return insert_record("forum_subscriptions", $sub);
|
||||
}
|
||||
|
||||
function forum_unsubscribe($userid, $forumid) {
|
||||
global $db;
|
||||
|
||||
return $db->Execute("DELETE FROM forum_subscriptions WHERE user = '$userid' AND forum = '$forumid'");
|
||||
/// Removes user from the subscriber list
|
||||
return delete_records("forum_subscriptions", "user", $userid, "forum", $forumid)
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,9 +252,7 @@
|
||||
|
||||
|
||||
if ($post->discussion) {
|
||||
if (! $toppost = get_record_sql("SELECT * FROM forum_posts
|
||||
WHERE discussion='$post->discussion'
|
||||
AND parent = 0")) {
|
||||
if (! $toppost = get_record("forum_posts", "discussion", $post->discussion, "parent", 0)) {
|
||||
error("Could not find top parent of post $post->id");
|
||||
}
|
||||
} else {
|
||||
|
@ -25,17 +25,17 @@
|
||||
continue;
|
||||
}
|
||||
if ($rating) {
|
||||
if ($check = get_record_sql("SELECT COUNT(*) as count FROM forum_ratings
|
||||
WHERE user='$USER->id' AND post='$post'")){
|
||||
if ($check->count == 0) {
|
||||
$timenow = time();
|
||||
if (!$rs = $db->Execute("INSERT DELAYED INTO forum_ratings
|
||||
SET user='$USER->id', post='$post', time='$timenow', rating='$rating'")){
|
||||
error("Could not insert a new rating ($post = $rating)");
|
||||
}
|
||||
|
||||
} else {
|
||||
error("You've rated this question before ($post)");
|
||||
if (record_exists("forum_ratings", "user", $USER->id, "post", $post)) {
|
||||
error("You've rated this question before ($post)");
|
||||
} else {
|
||||
unset($newrating);
|
||||
$newrating->user = $USER->id;
|
||||
$newrating->time = time();
|
||||
$newrating->post = $post;
|
||||
$newrating->rating = $rating;
|
||||
|
||||
if (! insert_record("forum_ratings", $newrating)) {
|
||||
error("Could not insert a new rating ($post = $rating)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,7 @@
|
||||
|
||||
print_header("Ratings for: $post->subject");
|
||||
|
||||
if (!$ratings = get_records_sql("SELECT u.*, r.rating, r.time FROM forum_ratings r, user u
|
||||
WHERE r.post='$post->id' AND r.user=u.id ORDER BY $sort")) {
|
||||
if (!$ratings = forum_get_ratings($post->id, $sort)) {
|
||||
echo "No ratings for this post: \"$post->subject\"";
|
||||
die;
|
||||
} else {
|
||||
|
@ -39,21 +39,7 @@
|
||||
|
||||
if ($search) {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
$notteacherforum = "AND f.type <> 'teacher'";
|
||||
} else {
|
||||
$notteacherforum = "";
|
||||
}
|
||||
|
||||
$posts = get_records_sql("SELECT p.*,u.firstname,u.lastname,u.email,u.picture,u.id as userid
|
||||
FROM forum_posts p, forum_discussions d, user u, forum f
|
||||
WHERE (p.message LIKE '%$search%' OR p.subject LIKE '%$search%')
|
||||
AND p.user = u.id
|
||||
AND p.discussion = d.id AND d.course = '$course->id'
|
||||
AND d.forum = f.id $notteacherforum
|
||||
ORDER BY p.modified DESC LIMIT 0, 50 ");
|
||||
|
||||
if (!$posts) {
|
||||
if (!$posts = forum_search_posts($search, $course->id)) {
|
||||
print_heading("<BR>".get_string("nopostscontaining", "forum", $search));
|
||||
|
||||
} else {
|
||||
|
@ -14,7 +14,7 @@
|
||||
# Table structure for table `journal`
|
||||
#
|
||||
|
||||
CREATE TABLE journal (
|
||||
CREATE TABLE prefix_journal (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
course int(10) unsigned NOT NULL default '0',
|
||||
name varchar(255) default NULL,
|
||||
@ -30,7 +30,7 @@ CREATE TABLE journal (
|
||||
# Table structure for table `journal_entries`
|
||||
#
|
||||
|
||||
CREATE TABLE journal_entries (
|
||||
CREATE TABLE prefix_journal_entries (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
journal int(10) unsigned NOT NULL default '0',
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
@ -49,7 +49,7 @@ CREATE TABLE journal_entries (
|
||||
# Dumping data for table `log_display`
|
||||
#
|
||||
|
||||
INSERT INTO log_display VALUES ('journal', 'view', 'journal', 'name');
|
||||
INSERT INTO log_display VALUES ('journal', 'add entry', 'journal', 'name');
|
||||
INSERT INTO log_display VALUES ('journal', 'update entry', 'journal', 'name');
|
||||
INSERT INTO log_display VALUES ('journal', 'view responses', 'journal', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('journal', 'view', 'journal', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('journal', 'add entry', 'journal', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('journal', 'update entry', 'journal', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('journal', 'view responses', 'journal', 'name');
|
||||
|
@ -22,8 +22,7 @@
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
$entry = get_record_sql("SELECT * FROM journal_entries
|
||||
WHERE user='$USER->id' AND journal='$journal->id'");
|
||||
$entry = get_record("journal_entries", "user", $USER->id, "journal", $journal->id);
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
@ -49,8 +49,7 @@
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
|
||||
$entry = get_record_sql("SELECT text FROM journal_entries
|
||||
WHERE user='$USER->id' AND journal='$journal->id'");
|
||||
$entrytext = get_field("journal_entries", "text", "user", $USER->id, "journal", $journal->id");
|
||||
|
||||
$journal->timestart = $course->startdate + (($journal->section - 1) * 608400);
|
||||
if ($journal->daysopen) {
|
||||
@ -61,7 +60,7 @@
|
||||
$journalopen = ($journal->timestart < $timenow && $timenow < $journal->timefinish);
|
||||
|
||||
|
||||
$text = text_to_html($entry->text)."<P ALIGN=right><A HREF=\"view.php?id=$journal->coursemodule\">";
|
||||
$text = text_to_html($entrytext)."<P ALIGN=right><A HREF=\"view.php?id=$journal->coursemodule\">";
|
||||
if ($journalopen) {
|
||||
$text .= "$stredit</A></P>";
|
||||
} else {
|
||||
|
@ -9,8 +9,7 @@ $JOURNAL_RATING = array ("3" => get_string("journalrating3", "journal"),
|
||||
// STANDARD MODULE FUNCTIONS /////////////////////////////////////////////////////////
|
||||
|
||||
function journal_user_outline($course, $user, $mod, $journal) {
|
||||
if ($entry = get_record_sql("SELECT * FROM journal_entries
|
||||
WHERE user='$user->id' AND journal='$journal->id'")) {
|
||||
if ($entry = get_record("journal_entries", "user", $user->id, "journal", $journal->id)) {
|
||||
|
||||
$numwords = count(preg_split("/\w\b/", $entry->text)) - 1;
|
||||
|
||||
@ -24,8 +23,7 @@ function journal_user_outline($course, $user, $mod, $journal) {
|
||||
|
||||
function journal_user_complete($course, $user, $mod, $journal) {
|
||||
|
||||
if ($entry = get_record_sql("SELECT * FROM journal_entries
|
||||
WHERE user='$user->id' AND journal='$journal->id'")) {
|
||||
if ($entry = get_record("journal_entries", "user", $user->id, "journal", $journal->id)) {
|
||||
|
||||
print_simple_box_start();
|
||||
if ($entry->modified) {
|
||||
@ -53,11 +51,7 @@ function journal_cron () {
|
||||
|
||||
$cutofftime = time() - $CFG->maxeditingtime;
|
||||
|
||||
if ($entries = get_records_sql("SELECT e.*, j.course, j.name
|
||||
FROM journal_entries e, journal j
|
||||
WHERE e.mailed = '0'
|
||||
AND e.timemarked < '$cutofftime' AND e.timemarked > 0
|
||||
AND e.journal = j.id")) {
|
||||
if ($entries = journal_get_unmailed_graded($cutofftime)) {
|
||||
$timenow = time();
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
@ -135,10 +129,7 @@ function journal_print_recent_activity(&$logs, $isteacher=false) {
|
||||
if ($log->module == "journal") {
|
||||
if ($log->action == "add entry" or $log->action == "update entry") {
|
||||
if (!isset($journals[$log->info])) {
|
||||
$journals[$log->info] = get_record_sql("SELECT j.*, u.firstname, u.lastname
|
||||
FROM journal j, journal_entries e, user u
|
||||
WHERE e.id = '$log->info' AND e.journal = j.id
|
||||
AND e.user = u.id");
|
||||
$journals[$log->info] = journal_log_info($log);
|
||||
$journals[$log->info]->time = $log->time;
|
||||
$journals[$log->info]->url = $log->url;
|
||||
}
|
||||
@ -165,9 +156,7 @@ function journal_grades($journalid) {
|
||||
/// Must return an array of grades, indexed by user, and a max grade.
|
||||
global $JOURNAL_RATING;
|
||||
|
||||
if ($return->grades = get_records_sql_menu("SELECT user,rating
|
||||
FROM journal_entries
|
||||
WHERE journal = '$journalid'")) {
|
||||
if ($return->grades = get_records_menu("journal_entries", "journal", $journalid, "", "user,rating")) {
|
||||
foreach ($return->grades as $key => $value) {
|
||||
if ($value) {
|
||||
$return->grades[$key] = $JOURNAL_RATING[$value];
|
||||
@ -181,16 +170,47 @@ function journal_grades($journalid) {
|
||||
}
|
||||
|
||||
|
||||
// SQL FUNCTIONS ///////////////////////////////////////////////////////////////////
|
||||
|
||||
function journal_get_users_done($journal) {
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT u.*
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_students s,
|
||||
{$CFG->prefix}user_teachers t,
|
||||
{$CFG->prefix}journal_entries j
|
||||
WHERE ((s.course = '$journal->course' AND s.user = u.id)
|
||||
OR (t.course = '$journal->course' AND t.user = u.id))
|
||||
AND u.id = j.user
|
||||
AND j.journal = '$journal->id'
|
||||
ORDER BY j.modified DESC");
|
||||
}
|
||||
|
||||
function journal_get_unmailed_graded($cutofftime) {
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT e.*, j.course, j.name
|
||||
FROM {$CFG->prefix}journal_entries e,
|
||||
{$CFG->prefix}journal j
|
||||
WHERE e.mailed = '0'
|
||||
AND e.timemarked < '$cutofftime'
|
||||
AND e.timemarked > 0
|
||||
AND e.journal = j.id");
|
||||
}
|
||||
|
||||
function journal_log_info($log) {
|
||||
global $CFG;
|
||||
return get_record_sql("SELECT j.*, u.firstname, u.lastname
|
||||
FROM {$CFG->prefix}journal j,
|
||||
{$CFG->prefix}journal_entries e,
|
||||
{$CFG->prefix}user u
|
||||
WHERE e.id = '$log->info'
|
||||
AND e.journal = j.id
|
||||
AND e.user = u.id");
|
||||
}
|
||||
|
||||
// OTHER JOURNAL FUNCTIONS ///////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
function journal_get_users_done($journal) {
|
||||
return get_records_sql("SELECT u.* FROM user u, user_students s, user_teachers t, journal_entries j
|
||||
WHERE ((s.course = '$journal->course' AND s.user = u.id) OR
|
||||
(t.course = '$journal->course' AND t.user = u.id))
|
||||
AND u.id = j.user AND j.journal = '$journal->id'
|
||||
ORDER BY j.modified DESC");
|
||||
}
|
||||
|
||||
function journal_print_user_entry($course, $user, $entry, $teachers, $ratings) {
|
||||
global $THEME;
|
||||
|
@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
// make some easy ways to access the entries.
|
||||
if ( $eee = get_records_sql("SELECT * FROM journal_entries WHERE journal='$journal->id'")) {
|
||||
if ( $eee = get_records("journal_entries", "journal", $journal->id)) {
|
||||
foreach ($eee as $ee) {
|
||||
$entrybyuser[$ee->user] = $ee;
|
||||
$entrybyentry[$ee->id] = $ee;
|
||||
|
@ -80,8 +80,8 @@
|
||||
echo "</CENTER>";
|
||||
}
|
||||
|
||||
if ($entry = get_record_sql("SELECT * FROM journal_entries
|
||||
WHERE user='$USER->id' AND journal='$journal->id'")) {
|
||||
|
||||
if ($entry = get_record("journal_entries", "user", $USER->id, "journal", $journal->id)) {
|
||||
|
||||
if (empty($entry->text)) {
|
||||
echo "<P ALIGN=center><B>".get_string("blankentry","journal")."</B></P>";
|
||||
|
@ -13,7 +13,7 @@
|
||||
# Table structure for table `quiz`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz` (
|
||||
CREATE TABLE `prefix_quiz` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
@ -37,7 +37,7 @@ CREATE TABLE `quiz` (
|
||||
# Table structure for table `quiz_answers`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_answers` (
|
||||
CREATE TABLE `prefix_quiz_answers` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`question` int(10) unsigned NOT NULL default '0',
|
||||
`answer` varchar(255) NOT NULL default '',
|
||||
@ -52,7 +52,7 @@ CREATE TABLE `quiz_answers` (
|
||||
# Table structure for table `quiz_attempts`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_attempts` (
|
||||
CREATE TABLE `prefix_quiz_attempts` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`quiz` int(10) unsigned NOT NULL default '0',
|
||||
`user` int(10) unsigned NOT NULL default '0',
|
||||
@ -69,7 +69,7 @@ CREATE TABLE `quiz_attempts` (
|
||||
# Table structure for table `quiz_categories`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_categories` (
|
||||
CREATE TABLE `prefix_quiz_categories` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`course` int(10) unsigned NOT NULL default '0',
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
@ -83,7 +83,7 @@ CREATE TABLE `quiz_categories` (
|
||||
# Table structure for table `quiz_grades`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_grades` (
|
||||
CREATE TABLE `prefix_quiz_grades` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`quiz` int(10) unsigned NOT NULL default '0',
|
||||
`user` int(10) unsigned NOT NULL default '0',
|
||||
@ -97,7 +97,7 @@ CREATE TABLE `quiz_grades` (
|
||||
# Table structure for table `quiz_multichoice`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_multichoice` (
|
||||
CREATE TABLE `prefix_quiz_multichoice` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`question` int(10) unsigned NOT NULL default '0',
|
||||
`layout` tinyint(4) NOT NULL default '0',
|
||||
@ -112,7 +112,7 @@ CREATE TABLE `quiz_multichoice` (
|
||||
# Table structure for table `quiz_question_grades`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_question_grades` (
|
||||
CREATE TABLE `prefix_quiz_question_grades` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`quiz` int(10) unsigned NOT NULL default '0',
|
||||
`question` int(10) unsigned NOT NULL default '0',
|
||||
@ -125,7 +125,7 @@ CREATE TABLE `quiz_question_grades` (
|
||||
# Table structure for table `quiz_questions`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_questions` (
|
||||
CREATE TABLE `prefix_quiz_questions` (
|
||||
`id` int(10) NOT NULL auto_increment,
|
||||
`category` int(10) NOT NULL default '0',
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
@ -140,7 +140,7 @@ CREATE TABLE `quiz_questions` (
|
||||
# Table structure for table `quiz_responses`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_responses` (
|
||||
CREATE TABLE `prefix_quiz_responses` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`attempt` int(10) unsigned NOT NULL default '0',
|
||||
`question` int(10) unsigned NOT NULL default '0',
|
||||
@ -154,7 +154,7 @@ CREATE TABLE `quiz_responses` (
|
||||
# Table structure for table `quiz_shortanswer`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_shortanswer` (
|
||||
CREATE TABLE `prefix_quiz_shortanswer` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`question` int(10) unsigned NOT NULL default '0',
|
||||
`answers` varchar(255) NOT NULL default '',
|
||||
@ -168,7 +168,7 @@ CREATE TABLE `quiz_shortanswer` (
|
||||
# Table structure for table `quiz_truefalse`
|
||||
#
|
||||
|
||||
CREATE TABLE `quiz_truefalse` (
|
||||
CREATE TABLE `prefix_quiz_truefalse` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`question` int(10) unsigned NOT NULL default '0',
|
||||
`true` int(10) unsigned NOT NULL default '0',
|
||||
@ -178,8 +178,8 @@ CREATE TABLE `quiz_truefalse` (
|
||||
) TYPE=MyISAM COMMENT='Options for True-False questions';
|
||||
|
||||
|
||||
INSERT INTO log_display VALUES ('quiz', 'view', 'quiz', 'name');
|
||||
INSERT INTO log_display VALUES ('quiz', 'report', 'quiz', 'name');
|
||||
INSERT INTO log_display VALUES ('quiz', 'attempt', 'quiz', 'name');
|
||||
INSERT INTO log_display VALUES ('quiz', 'submit', 'quiz', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('quiz', 'view', 'quiz', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('quiz', 'report', 'quiz', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('quiz', 'attempt', 'quiz', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('quiz', 'submit', 'quiz', 'name');
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
# Table structure for table `resource`
|
||||
#
|
||||
|
||||
CREATE TABLE resource (
|
||||
CREATE TABLE prefix_resource (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
course tinyint(10) unsigned NOT NULL default '0',
|
||||
name varchar(255) NOT NULL default '',
|
||||
@ -32,4 +32,4 @@ CREATE TABLE resource (
|
||||
# Dumping data for table `log_display`
|
||||
#
|
||||
|
||||
INSERT INTO log_display VALUES ('resource', 'view', 'resource', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('resource', 'view', 'resource', 'name');
|
||||
|
@ -14,7 +14,7 @@
|
||||
# Table structure for table `survey`
|
||||
#
|
||||
|
||||
CREATE TABLE survey (
|
||||
CREATE TABLE prefix_survey (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
course int(10) unsigned NOT NULL default '0',
|
||||
template int(10) unsigned NOT NULL default '0',
|
||||
@ -31,10 +31,10 @@ CREATE TABLE survey (
|
||||
# Dumping data for table `survey`
|
||||
#
|
||||
|
||||
INSERT INTO `survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (1, 0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44');
|
||||
INSERT INTO `survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (2, 0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44');
|
||||
INSERT INTO `survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (3, 0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44');
|
||||
INSERT INTO `survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (4, 0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68');
|
||||
INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (1, 0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44');
|
||||
INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (2, 0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44');
|
||||
INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (3, 0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44');
|
||||
INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (4, 0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68');
|
||||
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ INSERT INTO `survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemo
|
||||
# Table structure for table `survey_analysis`
|
||||
#
|
||||
|
||||
CREATE TABLE survey_analysis (
|
||||
CREATE TABLE prefix_survey_analysis (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
survey int(10) unsigned NOT NULL default '0',
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
@ -61,7 +61,7 @@ CREATE TABLE survey_analysis (
|
||||
# Table structure for table `survey_answers`
|
||||
#
|
||||
|
||||
CREATE TABLE survey_answers (
|
||||
CREATE TABLE prefix_survey_answers (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
survey int(10) unsigned NOT NULL default '0',
|
||||
@ -83,7 +83,7 @@ CREATE TABLE survey_answers (
|
||||
# Table structure for table `survey_questions`
|
||||
#
|
||||
|
||||
CREATE TABLE `survey_questions` (
|
||||
CREATE TABLE `prefix_survey_questions` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`text` varchar(255) NOT NULL default '',
|
||||
`shorttext` varchar(30) NOT NULL default '',
|
||||
@ -98,73 +98,73 @@ CREATE TABLE `survey_questions` (
|
||||
# Dumping data for table `survey_questions`
|
||||
#
|
||||
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (1, 'colles1', 'colles1short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (2, 'colles2', 'colles2short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (3, 'colles3', 'colles3short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (4, 'colles4', 'colles4short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (5, 'colles5', 'colles5short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (6, 'colles6', 'colles6short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (7, 'colles7', 'colles7short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (8, 'colles8', 'colles8short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (9, 'colles9', 'colles9short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (10, 'colles10', 'colles10short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (11, 'colles11', 'colles11short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (12, 'colles12', 'colles12short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (13, 'colles13', 'colles13short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (14, 'colles14', 'colles14short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (15, 'colles15', 'colles15short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (16, 'colles16', 'colles16short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (17, 'colles17', 'colles17short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (18, 'colles18', 'colles18short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (19, 'colles19', 'colles19short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (20, 'colles20', 'colles20short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (21, 'colles21', 'colles21short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (22, 'colles22', 'colles22short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (23, 'colles23', 'colles23short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (24, 'colles24', 'colles24short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (25, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (26, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (27, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (28, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (29, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (30, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (31, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (32, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (33, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (34, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (35, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (36, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (37, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (38, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (39, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (40, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (41, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (42, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (43, 'howlong', '', '', '', 1, 'howlongoptions');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (44, 'othercomments', '', '', '', 0, '');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (64, 'attls20', 'attls20short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (58, 'attls14', 'attls14short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (59, 'attls15', 'attls15short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (60, 'attls16', 'attls16short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (61, 'attls17', 'attls17short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (62, 'attls18', 'attls18short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (63, 'attls19', 'attls19short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (56, 'attls12', 'attls12short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (57, 'attls13', 'attls13short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (55, 'attls11', 'attls11short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (54, 'attls10', 'attls10short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (53, 'attls9', 'attls9short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (52, 'attls8', 'attls8short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (51, 'attls7', 'attls7short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (50, 'attls6', 'attls6short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (49, 'attls5', 'attls5short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (48, 'attls4', 'attls4short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (47, 'attls3', 'attls3short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (45, 'attls1', 'attls1short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (46, 'attls2', 'attls2short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (65, 'attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (67, 'attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5');
|
||||
INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (68, 'attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (1, 'colles1', 'colles1short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (2, 'colles2', 'colles2short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (3, 'colles3', 'colles3short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (4, 'colles4', 'colles4short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (5, 'colles5', 'colles5short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (6, 'colles6', 'colles6short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (7, 'colles7', 'colles7short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (8, 'colles8', 'colles8short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (9, 'colles9', 'colles9short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (10, 'colles10', 'colles10short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (11, 'colles11', 'colles11short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (12, 'colles12', 'colles12short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (13, 'colles13', 'colles13short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (14, 'colles14', 'colles14short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (15, 'colles15', 'colles15short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (16, 'colles16', 'colles16short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (17, 'colles17', 'colles17short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (18, 'colles18', 'colles18short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (19, 'colles19', 'colles19short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (20, 'colles20', 'colles20short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (21, 'colles21', 'colles21short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (22, 'colles22', 'colles22short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (23, 'colles23', 'colles23short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (24, 'colles24', 'colles24short', '', '', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (25, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (26, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (27, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (28, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (29, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (30, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (31, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (32, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (33, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (34, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (35, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (36, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (37, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (38, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (39, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (40, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (41, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (42, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (43, 'howlong', '', '', '', 1, 'howlongoptions');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (44, 'othercomments', '', '', '', 0, '');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (64, 'attls20', 'attls20short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (58, 'attls14', 'attls14short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (59, 'attls15', 'attls15short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (60, 'attls16', 'attls16short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (61, 'attls17', 'attls17short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (62, 'attls18', 'attls18short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (63, 'attls19', 'attls19short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (56, 'attls12', 'attls12short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (57, 'attls13', 'attls13short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (55, 'attls11', 'attls11short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (54, 'attls10', 'attls10short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (53, 'attls9', 'attls9short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (52, 'attls8', 'attls8short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (51, 'attls7', 'attls7short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (50, 'attls6', 'attls6short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (49, 'attls5', 'attls5short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (48, 'attls4', 'attls4short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (47, 'attls3', 'attls3short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (45, 'attls1', 'attls1short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (46, 'attls2', 'attls2short', '', '', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (65, 'attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (67, 'attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5');
|
||||
INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (68, 'attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5');
|
||||
|
||||
|
||||
|
||||
@ -172,8 +172,8 @@ INSERT INTO `survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `ty
|
||||
# Dumping data for table `log_display`
|
||||
#
|
||||
|
||||
INSERT INTO log_display VALUES ('survey', 'download', 'survey', 'name');
|
||||
INSERT INTO log_display VALUES ('survey', 'view form', 'survey', 'name');
|
||||
INSERT INTO log_display VALUES ('survey', 'view graph', 'survey', 'name');
|
||||
INSERT INTO log_display VALUES ('survey', 'view report', 'survey', 'name');
|
||||
INSERT INTO log_display VALUES ('survey', 'submit', 'survey', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('survey', 'download', 'survey', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('survey', 'view form', 'survey', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('survey', 'view graph', 'survey', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('survey', 'view report', 'survey', 'name');
|
||||
INSERT INTO prefix_log_display VALUES ('survey', 'submit', 'survey', 'name');
|
||||
|
Loading…
x
Reference in New Issue
Block a user