All modules are now suitable for the site page. They now all follow the same rules, namely that any students enrolled in at least one course is considered to be a student on the site.
All the page headers work correctly also on the site course. On the site page the modules don't require login unless necessary or required by $CFG->forcelogin.
This commit is contained in:
@@ -42,6 +42,12 @@
|
||||
|
||||
redirect($destination);
|
||||
}
|
||||
|
||||
/// Users can't enroll to site course
|
||||
if (!$course->category) {
|
||||
print_header_simple();
|
||||
notice(get_string('enrollfirst'), $CFG->wwwroot);
|
||||
}
|
||||
|
||||
/// Double check just in case they are enrolled to start in the future
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ $string['choiceclose'] = 'Until';
|
||||
$string['choicename'] = 'Choice name';
|
||||
$string['choiceopen'] = 'Open';
|
||||
$string['choicetext'] = 'Choice text';
|
||||
$string['havetologin'] = 'You have to log in before you can submit your choice';
|
||||
$string['modulename'] = 'Choice';
|
||||
$string['modulenameplural'] = 'Choices';
|
||||
$string['mustchooseone'] = 'You must choose an answer before saving. Nothing was saved.';
|
||||
|
||||
@@ -378,6 +378,7 @@ $string['enable'] = 'Enable';
|
||||
$string['encryptedcode'] = 'Encrypted code';
|
||||
$string['enrolledincourse'] = 'Enrolled in course \"$a\"';
|
||||
$string['enrolledincoursenot'] = 'Not enrolled in course \"$a\"';
|
||||
$string['enrollfirst'] = 'You have to enroll in one of the courses before you can use the site activities';
|
||||
$string['enrolmentconfirmation'] = 'You are about to enroll yourself as a member of this course.<br />Are you sure you wish to do this?';
|
||||
$string['enrolmentkey'] = 'Enrolment key';
|
||||
$string['enrolmentkeyfrom'] = 'This course requires an \'enrolment key\' - a one-time<BR>
|
||||
|
||||
+11
-20
@@ -947,8 +947,8 @@ function get_user_info_from_db($field, $value) {
|
||||
$user->admin = true;
|
||||
}
|
||||
|
||||
if ($site = get_site()) { // Everyone is always a member of the top course
|
||||
$user->student[$site->id] = true;
|
||||
if ($site = get_site()) {
|
||||
$user->student[$site->id] = isstudent($site->id, $user->id);
|
||||
}
|
||||
|
||||
/// Determine enrolments based on current enrolment module
|
||||
@@ -1152,15 +1152,6 @@ function get_course_students($courseid, $sort="s.timeaccess", $dir="", $page=0,
|
||||
|
||||
global $CFG;
|
||||
|
||||
$site = get_site();
|
||||
if (!$courseid or $courseid == $site->id) {
|
||||
$sort = str_replace('s.timeaccess', 'lastaccess', $sort); // site users can't be sorted by timeaccess
|
||||
if ($sort) {
|
||||
$sort = "$sort $dir";
|
||||
}
|
||||
return get_site_users($sort, '', $exceptions);
|
||||
}
|
||||
|
||||
switch ($CFG->dbtype) {
|
||||
case "mysql":
|
||||
$fullname = " CONCAT(firstname,\" \",lastname) ";
|
||||
@@ -1179,7 +1170,15 @@ function get_course_students($courseid, $sort="s.timeaccess", $dir="", $page=0,
|
||||
}
|
||||
|
||||
$groupmembers = '';
|
||||
$select = "s.course = '$courseid' AND s.userid = u.id AND u.deleted = '0' ";
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$courseid' AND ";
|
||||
$site = get_site();
|
||||
if ($courseid == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
$select .= "s.userid = u.id AND u.deleted = '0' ";
|
||||
|
||||
if (!$fields) {
|
||||
$fields = 'u.id, u.confirmed, u.username, u.firstname, u.lastname, '.
|
||||
@@ -1306,19 +1305,11 @@ function get_course_teachers($courseid, $sort="t.authority ASC", $exceptions='')
|
||||
|
||||
/**
|
||||
* Returns all the users of a course: students and teachers
|
||||
*
|
||||
* If the "course" is actually the site, then return all site users.
|
||||
*
|
||||
* @param type description
|
||||
*/
|
||||
function get_course_users($courseid, $sort="timeaccess DESC", $exceptions='') {
|
||||
|
||||
$site = get_site();
|
||||
|
||||
if ($courseid == $site->id) {
|
||||
return get_site_users($sort, '', $exceptions);
|
||||
}
|
||||
|
||||
/// Using this method because the single SQL is too inefficient
|
||||
// Note that this has the effect that teachers and students are
|
||||
// sorted individually. Returns first all teachers, then all students
|
||||
|
||||
@@ -821,6 +821,14 @@ function main_upgrade($oldversion=0) {
|
||||
execute_sql("UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE id NOT IN ($adminlist)");
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2004082200) { // Making admins teachers on site course
|
||||
$site = get_site();
|
||||
$admins = get_admins();
|
||||
foreach ($admins as $admin) {
|
||||
add_teacher($admin->id, $site->id);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
|
||||
+28
-2
@@ -430,6 +430,19 @@ function require_login($courseid=0, $autologinguest=true) {
|
||||
}
|
||||
}
|
||||
|
||||
function require_course_login($course, $autologinguest=true) {
|
||||
// This is a weaker version of require_login which only requires login
|
||||
// when called from within a course rather than the site page, unless
|
||||
// the forcelogin option is turned on.
|
||||
global $CFG;
|
||||
if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
}
|
||||
if ($course->category) {
|
||||
require_login($course->id, $autologinguest);
|
||||
}
|
||||
}
|
||||
|
||||
function update_user_login_times() {
|
||||
global $USER;
|
||||
|
||||
@@ -583,8 +596,8 @@ function isstudent($courseid, $userid=0) {
|
||||
if (isguest($userid)) {
|
||||
return false;
|
||||
}
|
||||
return record_exists('user', 'id', $userid, 'confirmed', 1, 'deleted', 0);
|
||||
}
|
||||
return record_exists('user_students', 'userid', $userid);
|
||||
}
|
||||
|
||||
if (!$userid) {
|
||||
return !empty($USER->student[$courseid]);
|
||||
@@ -952,6 +965,15 @@ function add_admin($userid) {
|
||||
if (!record_exists("user_admins", "userid", $userid)) {
|
||||
if (record_exists("user", "id", $userid)) {
|
||||
$admin->userid = $userid;
|
||||
|
||||
// any admin is also a teacher on the site course
|
||||
$site = get_site();
|
||||
if (!record_exists('user_teachers', 'course', $site->id, 'userid', $userid)) {
|
||||
if (!add_teacher($userid, $site->id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return insert_record("user_admins", $admin);
|
||||
}
|
||||
return false;
|
||||
@@ -963,6 +985,10 @@ function remove_admin($userid) {
|
||||
/// Removes an admin from a site
|
||||
global $db;
|
||||
|
||||
// remove also from the list of site teachers
|
||||
$site = get_site();
|
||||
remove_teacher($userid, $site->id);
|
||||
|
||||
return delete_records("user_admins", "userid", $userid);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
add_to_log($course->id, "assignment", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
$strassignments = get_string("modulenameplural", "assignment");
|
||||
@@ -52,6 +52,7 @@
|
||||
$currentsection = "";
|
||||
|
||||
foreach ($assignments as $assignment) {
|
||||
$submitted = get_string("no");
|
||||
if (isteacher($course->id)) {
|
||||
if ($assignment->type == OFFLINE) {
|
||||
$submitted = "<a href=\"submissions.php?id=$assignment->id\">" .
|
||||
@@ -62,14 +63,14 @@
|
||||
get_string("viewsubmissions", "assignment", $count) . "</a>$groupname";
|
||||
}
|
||||
} else {
|
||||
if ($submission = assignment_get_submission($assignment, $USER)) {
|
||||
if ($submission->timemodified <= $assignment->timedue) {
|
||||
$submitted = userdate($submission->timemodified);
|
||||
} else {
|
||||
$submitted = "<font color=red>".userdate($submission->timemodified)."</font>";
|
||||
if (isset($USER->id)) {
|
||||
if ($submission = assignment_get_submission($assignment, $USER)) {
|
||||
if ($submission->timemodified <= $assignment->timedue) {
|
||||
$submitted = userdate($submission->timemodified);
|
||||
} else {
|
||||
$submitted = "<font color=red>".userdate($submission->timemodified)."</font>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$submitted = get_string("no");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-8
@@ -423,14 +423,18 @@ function assignment_count_real_submissions($assignment, $groupid=0) {
|
||||
AND a.timemodified > 0
|
||||
AND g.groupid = '$groupid'
|
||||
AND a.userid = g.userid ");
|
||||
} else {
|
||||
} else {
|
||||
$select = "s.course = '$assignment->course' AND";
|
||||
$site = get_site();
|
||||
if ($assignment->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
return count_records_sql("SELECT COUNT(*)
|
||||
FROM {$CFG->prefix}assignment_submissions a,
|
||||
{$CFG->prefix}user_students s
|
||||
WHERE a.assignment = '$assignment->id'
|
||||
AND a.timemodified > 0
|
||||
AND s.course = '$assignment->course'
|
||||
AND a.userid = s.userid ");
|
||||
AND $select a.userid = s.userid ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,26 +449,36 @@ function assignment_get_all_submissions($assignment, $sort="", $dir="DESC") {
|
||||
} else {
|
||||
$sort = "a.$sort $dir";
|
||||
}
|
||||
|
||||
$select = "s.course = '$assignment->course' AND";
|
||||
$site = get_site();
|
||||
if ($assignment->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
return get_records_sql("SELECT a.*
|
||||
FROM {$CFG->prefix}assignment_submissions a,
|
||||
{$CFG->prefix}user_students s,
|
||||
{$CFG->prefix}user u
|
||||
WHERE a.userid = s.userid
|
||||
AND u.id = a.userid
|
||||
AND s.course = '$assignment->course'
|
||||
AND a.assignment = '$assignment->id'
|
||||
AND $select a.assignment = '$assignment->id'
|
||||
ORDER BY $sort");
|
||||
}
|
||||
|
||||
function assignment_get_users_done($assignment) {
|
||||
/// Return list of users who have done an assignment
|
||||
global $CFG;
|
||||
|
||||
$select = "s.course = '$assignment->course' AND";
|
||||
$site = get_site();
|
||||
if ($assignment->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
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.userid = u.id
|
||||
WHERE $select s.userid = u.id
|
||||
AND u.id = a.userid
|
||||
AND a.assignment = '$assignment->id'
|
||||
ORDER BY a.timemodified DESC");
|
||||
@@ -473,7 +487,7 @@ function assignment_get_users_done($assignment) {
|
||||
function assignment_get_unmailed_submissions($cutofftime) {
|
||||
/// Return list of marked submissions that have not been mailed out for currently enrolled students
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT s.*, a.course, a.name
|
||||
$records = get_records_sql("SELECT s.*, a.course, a.name
|
||||
FROM {$CFG->prefix}assignment_submissions s,
|
||||
{$CFG->prefix}assignment a,
|
||||
{$CFG->prefix}user_students us
|
||||
@@ -483,6 +497,19 @@ function assignment_get_unmailed_submissions($cutofftime) {
|
||||
AND s.assignment = a.id
|
||||
AND s.userid = us.userid
|
||||
AND a.course = us.course");
|
||||
$site = get_site();
|
||||
if (record_exists('assignment', 'course', $site->id)) {
|
||||
$records += get_records_sql("SELECT s.*, a.course, a.name
|
||||
FROM {$CFG->prefix}assignment_submissions s,
|
||||
{$CFG->prefix}assignment a,
|
||||
{$CFG->prefix}user_students us
|
||||
WHERE s.mailed = 0
|
||||
AND s.timemarked < $cutofftime
|
||||
AND s.timemarked > 0
|
||||
AND s.assignment = a.id
|
||||
AND s.userid = us.userid
|
||||
AND a.course = $site->id");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "assignment", "view", "view.php?id=$cm->id", $assignment->id, $cm->id);
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
print_simple_box_end();
|
||||
echo "<br />";
|
||||
|
||||
if (!isteacher($course->id) and !isguest()) {
|
||||
if (isstudent($course->id)) {
|
||||
$submission = assignment_get_submission($assignment, $USER);
|
||||
|
||||
if ($assignment->type == OFFLINE) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "attendance", "viewall", "index.php?id=$course->id", "");
|
||||
|
||||
|
||||
+201
-195
@@ -31,44 +31,44 @@ function attendance_add_module(&$mod) {
|
||||
}
|
||||
|
||||
function attendance_add_instance($attendance) {
|
||||
global $mod;
|
||||
global $mod;
|
||||
$attendance->timemodified = time();
|
||||
$attendance->dynsection = !empty($attendance->dynsection) ? 1 : 0;
|
||||
$attendance->autoattend = !empty($attendance->autoattend) ? 1 : 0;
|
||||
$attendance->grade = !empty($attendance->grade) ? 1 : 0;
|
||||
if (empty($attendance->day)) {
|
||||
$attendance->day = make_timestamp($attendance->theyear,
|
||||
$attendance->themonth, $attendance->theday);
|
||||
$attendance->themonth, $attendance->theday);
|
||||
}
|
||||
$attendance->notes = $attendance->name;
|
||||
$attendance->name=userdate($attendance->day, get_string("strftimedate"));
|
||||
if ($attendance->notes) {
|
||||
$attendance->name = $attendance->name . " - " . $attendance->notes;
|
||||
}
|
||||
$attendance->edited = 0;
|
||||
if ($attendance->notes) {
|
||||
$attendance->name = $attendance->name . " - " . $attendance->notes;
|
||||
}
|
||||
$attendance->edited = 0;
|
||||
if ($attendance->dynsection) {
|
||||
if ($mod->course) {
|
||||
if (! $course = get_record("course", "id", $mod->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
}
|
||||
if ($mod->course) {
|
||||
if (! $course = get_record("course", "id", $mod->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
}
|
||||
if ($course->format =="weeks") {
|
||||
// floor($date_relative / 604800) + 1
|
||||
$attendance->section = floor(($attendance->day - $course->startdate)/604800) +1;
|
||||
if($attendance->section > $course->numsections){
|
||||
$attendance->section = 0;
|
||||
}
|
||||
$attendance->section = "$attendance->section";
|
||||
$mod->section = "$attendance->section";
|
||||
// floor($date_relative / 604800) + 1
|
||||
$attendance->section = floor(($attendance->day - $course->startdate)/604800) +1;
|
||||
if($attendance->section > $course->numsections){
|
||||
$attendance->section = 0;
|
||||
}
|
||||
$attendance->section = "$attendance->section";
|
||||
$mod->section = "$attendance->section";
|
||||
}
|
||||
}
|
||||
// insert the main record first
|
||||
return $attendance->id = insert_record("attendance", $attendance);
|
||||
// insert the main record first
|
||||
return $attendance->id = insert_record("attendance", $attendance);
|
||||
}
|
||||
|
||||
|
||||
function attendance_update_instance($attendance) {
|
||||
global $mod;
|
||||
global $mod;
|
||||
$attendance->edited = 1;
|
||||
$attendance->timemodified = time();
|
||||
// $attendance->oldid=$attendance->id;
|
||||
@@ -78,76 +78,76 @@ function attendance_update_instance($attendance) {
|
||||
$attendance->grade = !empty($attendance->grade) ? 1 : 0;
|
||||
|
||||
$attendance->day = make_timestamp($attendance->theyear,
|
||||
$attendance->themonth, $attendance->theday);
|
||||
$attendance->themonth, $attendance->theday);
|
||||
$attendance->notes = $attendance->name;
|
||||
$attendance->name=userdate($attendance->day, get_string("strftimedate"));
|
||||
if ($attendance->notes) {
|
||||
$attendance->name = $attendance->name . " - " . $attendance->notes;
|
||||
}
|
||||
if ($attendance->notes) {
|
||||
$attendance->name = $attendance->name . " - " . $attendance->notes;
|
||||
}
|
||||
if ($attendance->dynsection) {
|
||||
//get info about the course
|
||||
if ($attendance->course) {
|
||||
if (! $course = get_record("course", "id", $attendance->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
}
|
||||
//work out which section this should be in
|
||||
$attendance->section = floor(($attendance->day - $course->startdate)/604800) +1;
|
||||
if (($attendance->section > $course->numsections) || ($attendance->section < 0)){
|
||||
$attendance->section = 0;
|
||||
}
|
||||
// $attendance->section = "$attendance->section";
|
||||
}
|
||||
// get the data from the attendance grid
|
||||
//get info about the course
|
||||
if ($attendance->course) {
|
||||
if (! $course = get_record("course", "id", $attendance->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
}
|
||||
//work out which section this should be in
|
||||
$attendance->section = floor(($attendance->day - $course->startdate)/604800) +1;
|
||||
if (($attendance->section > $course->numsections) || ($attendance->section < 0)){
|
||||
$attendance->section = 0;
|
||||
}
|
||||
// $attendance->section = "$attendance->section";
|
||||
}
|
||||
// get the data from the attendance grid
|
||||
if ($data = data_submitted()) {
|
||||
// Peel out all the data from variable names.
|
||||
$attrec->dayid = $attendance->id;
|
||||
if ($data) foreach ($data as $key => $val) {
|
||||
$pieces = explode('_',$key);
|
||||
if ($pieces[0] == 'student') {
|
||||
$attrec->userid=$pieces[1];
|
||||
$attrec->userid=$pieces[1];
|
||||
$attrec->hour=$pieces[2];
|
||||
$attrec->status=$val;
|
||||
// clear out any old records for the student
|
||||
delete_records("attendance_roll",
|
||||
delete_records("attendance_roll",
|
||||
"dayid",$attrec->dayid,
|
||||
"hour", $attrec->hour,
|
||||
"userid",$attrec->userid);
|
||||
if ($attrec->status != 0) {
|
||||
// student is registered as absent or tardy
|
||||
insert_record("attendance_roll",$attrec, false);
|
||||
insert_record("attendance_roll",$attrec, false);
|
||||
}
|
||||
} // if we have a piece of the student roll data
|
||||
} // if we have a piece of the student roll data
|
||||
} // foreach for all form variables
|
||||
} // if
|
||||
} // if
|
||||
|
||||
|
||||
if(!update_record("attendance", $attendance)){
|
||||
error("Couldn't update record");
|
||||
}
|
||||
|
||||
if ($attendance->dynsection) {
|
||||
//get section info
|
||||
$section = get_record("course_sections", "course", $attendance->course, "section", $attendance->section);
|
||||
|
||||
//remove module from the current section
|
||||
if (! delete_mod_from_section($attendance->coursemodule, $mod->section)) {
|
||||
notify("Could not delete module from existing section");
|
||||
}
|
||||
|
||||
//update course with new module location
|
||||
if(! set_field("course_modules", "section", $section->id, "id", $attendance->coursemodule)){
|
||||
notify("Could not update course module list");
|
||||
}
|
||||
|
||||
//add module to the new section
|
||||
if (! add_mod_to_section($attendance, NULL)) {
|
||||
notify("Could not add module to new section");
|
||||
}
|
||||
|
||||
rebuild_course_cache($section->course);
|
||||
}
|
||||
return true;
|
||||
if(!update_record("attendance", $attendance)){
|
||||
error("Couldn't update record");
|
||||
}
|
||||
|
||||
if ($attendance->dynsection) {
|
||||
//get section info
|
||||
$section = get_record("course_sections", "course", $attendance->course, "section", $attendance->section);
|
||||
|
||||
//remove module from the current section
|
||||
if (! delete_mod_from_section($attendance->coursemodule, $mod->section)) {
|
||||
notify("Could not delete module from existing section");
|
||||
}
|
||||
|
||||
//update course with new module location
|
||||
if(! set_field("course_modules", "section", $section->id, "id", $attendance->coursemodule)){
|
||||
notify("Could not update course module list");
|
||||
}
|
||||
|
||||
//add module to the new section
|
||||
if (! add_mod_to_section($attendance, NULL)) {
|
||||
notify("Could not add module to new section");
|
||||
}
|
||||
|
||||
rebuild_course_cache($section->course);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function attendance_delete_instance($id) {
|
||||
@@ -174,46 +174,46 @@ function attendance_user_outline($course, $user, $mod, $attendance) {
|
||||
/// $return->time = the time they did it
|
||||
/// $return->info = a short text description
|
||||
/// for attendance, this would be a list present and tardy for every hour of the day
|
||||
$tardies=count_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "status", 1);
|
||||
$absences=count_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "status", 2);
|
||||
|
||||
$tardies=count_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "status", 1);
|
||||
$absences=count_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "status", 2);
|
||||
|
||||
// build longer string for tardies
|
||||
if ($tardies > 0) {
|
||||
$tardyrecs=attendance_get_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "status", 1, "hour ASC");
|
||||
if ($tardies == 1) {
|
||||
$tardystring = "Tardy in hour " . $tardyrecs[0]->hour . ". ";
|
||||
} elseif ($tardies == $attendance->hours) {
|
||||
$tardystring = "Tardy in all hours. (" . $attendance->hours . ") ";
|
||||
} else {
|
||||
// build array of all tardies
|
||||
$tarr = array();
|
||||
if ($tardyrecs) foreach ($tardyrecs as $tardyrec) {
|
||||
array_push($tarr, $tardyrec->hour);
|
||||
$tardystring = $tardystring . ", " . $tardyrec->hour;
|
||||
}
|
||||
$end=array_pop($tarr);
|
||||
$tardystring = "Tardy in hours " . implode(", ", $tarr) . " and ". $end . ". ";
|
||||
}
|
||||
} else { $tardystring = "";}
|
||||
if ($tardies > 0) {
|
||||
$tardyrecs=attendance_get_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "status", 1, "hour ASC");
|
||||
if ($tardies == 1) {
|
||||
$tardystring = "Tardy in hour " . $tardyrecs[0]->hour . ". ";
|
||||
} elseif ($tardies == $attendance->hours) {
|
||||
$tardystring = "Tardy in all hours. (" . $attendance->hours . ") ";
|
||||
} else {
|
||||
// build array of all tardies
|
||||
$tarr = array();
|
||||
if ($tardyrecs) foreach ($tardyrecs as $tardyrec) {
|
||||
array_push($tarr, $tardyrec->hour);
|
||||
$tardystring = $tardystring . ", " . $tardyrec->hour;
|
||||
}
|
||||
$end=array_pop($tarr);
|
||||
$tardystring = "Tardy in hours " . implode(", ", $tarr) . " and ". $end . ". ";
|
||||
}
|
||||
} else { $tardystring = "";}
|
||||
// build longer string for absences
|
||||
if ($absences > 0) {
|
||||
$absrecs=attendance_get_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "status", 2, "hour ASC");
|
||||
if ($absences == 1) {
|
||||
$absstring = "Absent in hour " . $absrecs[0]->hour . ".";
|
||||
} elseif ($absences == $attendance->hours) {
|
||||
$absstring = "Absent in all hours. (" . $attendance->hours . ")";
|
||||
} else {
|
||||
// build array of all absences
|
||||
$aarr = array();
|
||||
if ($absrecs) foreach ($absrecs as $absrec) {
|
||||
array_push($aarr, $absrec->hour);
|
||||
}
|
||||
$end=array_pop($aarr);
|
||||
$absstring = "Absent in hours " . implode(", ", $aarr) . " and ". $end . ".";
|
||||
}
|
||||
} else { $absstring = "";}
|
||||
$return->info=$tardystring . $absstring;
|
||||
if ($return->info == "") $return->info = "No Tardies or Absences";
|
||||
if ($absences > 0) {
|
||||
$absrecs=attendance_get_records("attendance_roll", "dayid", $attendance->id, "userid", $user->id, "status", 2, "hour ASC");
|
||||
if ($absences == 1) {
|
||||
$absstring = "Absent in hour " . $absrecs[0]->hour . ".";
|
||||
} elseif ($absences == $attendance->hours) {
|
||||
$absstring = "Absent in all hours. (" . $attendance->hours . ")";
|
||||
} else {
|
||||
// build array of all absences
|
||||
$aarr = array();
|
||||
if ($absrecs) foreach ($absrecs as $absrec) {
|
||||
array_push($aarr, $absrec->hour);
|
||||
}
|
||||
$end=array_pop($aarr);
|
||||
$absstring = "Absent in hours " . implode(", ", $aarr) . " and ". $end . ".";
|
||||
}
|
||||
} else { $absstring = "";}
|
||||
$return->info=$tardystring . $absstring;
|
||||
if ($return->info == "") $return->info = "No Tardies or Absences";
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -232,17 +232,17 @@ function attendance_user_complete($course, $user, $mod, $attendance) {
|
||||
if ($attrecs) { foreach ($attrecs as $attrec) { $grid[$attrec->hour]=$attrec->status; } }
|
||||
echo "<table><tr><th>Hour:</th>\n";
|
||||
// echo out the table header
|
||||
for($j=1;$j<=$attendance->hours;$j++) {
|
||||
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$j."</th>\n";
|
||||
}
|
||||
echo "</tr><tr><th>Status:</th>";
|
||||
for($j=1;$j<=$attendance->hours;$j++) {
|
||||
for($j=1;$j<=$attendance->hours;$j++) {
|
||||
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$j."</th>\n";
|
||||
}
|
||||
echo "</tr><tr><th>Status:</th>";
|
||||
for($j=1;$j<=$attendance->hours;$j++) {
|
||||
// set the attendance defaults for each student
|
||||
if (isset($grid[$j])) {
|
||||
$status = (($grid[$j] == 1) ? $T : $A);
|
||||
} else {$status=$P;}
|
||||
if (isset($grid[$j])) {
|
||||
$status = (($grid[$j] == 1) ? $T : $A);
|
||||
} else {$status=$P;}
|
||||
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$status."</td>\n";
|
||||
} /// for loop
|
||||
} /// for loop
|
||||
echo "</tr></table>\n";
|
||||
|
||||
|
||||
@@ -266,42 +266,42 @@ function attendance_cron () {
|
||||
global $CFG;
|
||||
echo "Attendance: Performing automatic attendance logging\n";
|
||||
// look for all attendance instances set to autoattend
|
||||
if (!$attendances = get_records("attendance", "autoattend", 1, "course ASC")) {
|
||||
if (!$attendances = get_records("attendance", "autoattend", 1, "course ASC")) {
|
||||
return true;
|
||||
}
|
||||
$td = attendance_find_today(time());
|
||||
$tm = attendance_find_tomorrow(time());
|
||||
if ($attendances) foreach($attendances as $attendance) {
|
||||
$td = attendance_find_today(time());
|
||||
$tm = attendance_find_tomorrow(time());
|
||||
if ($attendances) foreach($attendances as $attendance) {
|
||||
if (($attendance->day >=$td ) && ($attendance->day < $tm)) {
|
||||
echo "Attendance: Taking attendance for $attendance->name\n";
|
||||
|
||||
if(!isset($courses[$attendance->course]->students)) {
|
||||
$courses[$attendance->course]->students =
|
||||
attendance_get_course_students($attendance->course, "u.lastname ASC");
|
||||
}
|
||||
if(!isset($courses[$attendance->course]->students)) {
|
||||
$courses[$attendance->course]->students =
|
||||
attendance_get_course_students($attendance->course, "u.lastname ASC");
|
||||
}
|
||||
if ($courses[$attendance->course]->students) {
|
||||
foreach ($courses[$attendance->course]->students as $student) {
|
||||
// first, clear out the records that may be there already
|
||||
delete_records("attendance_roll",
|
||||
"dayid",$attendance->id,
|
||||
"userid",$student->id);
|
||||
$wc = "userid = " . $student->id . " AND course = " . $attendance->course .
|
||||
" AND time >= " . $td . " AND time < " . $tm;
|
||||
$count = get_record_select("log",$wc,"COUNT(*) as c");
|
||||
if ($count->c == "0") { // then the student hasn't done anything today, so mark him absent
|
||||
$attrec->dayid = $attendance->id;
|
||||
$attrec->userid = $student->id;
|
||||
$attrec->status = 2; // status 2 is absent
|
||||
// mark ALL hours as absent for first version
|
||||
for ($i=1;$i<=$attendance->hours;$i++) {
|
||||
$attrec->hour = $i;
|
||||
insert_record("attendance_roll",$attrec, false);
|
||||
} // for loop to mark all hours absent
|
||||
} // if student has no activity
|
||||
} // foreach student in the list
|
||||
} // if students exist
|
||||
foreach ($courses[$attendance->course]->students as $student) {
|
||||
// first, clear out the records that may be there already
|
||||
delete_records("attendance_roll",
|
||||
"dayid",$attendance->id,
|
||||
"userid",$student->id);
|
||||
$wc = "userid = " . $student->id . " AND course = " . $attendance->course .
|
||||
" AND time >= " . $td . " AND time < " . $tm;
|
||||
$count = get_record_select("log",$wc,"COUNT(*) as c");
|
||||
if ($count->c == "0") { // then the student hasn't done anything today, so mark him absent
|
||||
$attrec->dayid = $attendance->id;
|
||||
$attrec->userid = $student->id;
|
||||
$attrec->status = 2; // status 2 is absent
|
||||
// mark ALL hours as absent for first version
|
||||
for ($i=1;$i<=$attendance->hours;$i++) {
|
||||
$attrec->hour = $i;
|
||||
insert_record("attendance_roll",$attrec, false);
|
||||
} // for loop to mark all hours absent
|
||||
} // if student has no activity
|
||||
} // foreach student in the list
|
||||
} // if students exist
|
||||
} // if the attendance roll is for today
|
||||
} // for each attendance in the system
|
||||
} // for each attendance in the system
|
||||
return true;
|
||||
} // function cron
|
||||
|
||||
@@ -313,21 +313,21 @@ function attendance_grades($attendanceid) {
|
||||
if ($attendance->grade == "1") {
|
||||
$students = get_course_students($attendance->course);
|
||||
if ($students) {
|
||||
foreach ($students as $student) {
|
||||
$rolls = attendance_get_records("attendance_roll",
|
||||
"dayid",$attendance->id,
|
||||
"userid",$student->id);
|
||||
$abs=$tar=0;
|
||||
if ($rolls) {
|
||||
foreach ($rolls as $roll) {
|
||||
if ($roll->status == 1) {$tar++;}
|
||||
elseif ($roll->status == 2) {$abs++;}
|
||||
} // if rolls
|
||||
$total = $attendance->hours - attendance_tally_overall_absences_decimal($abs, $tar);
|
||||
$percent = ($total != 0)?$total/$attendance->hours:0;
|
||||
$return->grades[$student->id] = ($percent == 0)?0.0:$attendance->maxgrade * $percent;
|
||||
} else { $return->grades[$student->id] = $attendance->maxgrade; }
|
||||
} // foreach student
|
||||
foreach ($students as $student) {
|
||||
$rolls = attendance_get_records("attendance_roll",
|
||||
"dayid",$attendance->id,
|
||||
"userid",$student->id);
|
||||
$abs=$tar=0;
|
||||
if ($rolls) {
|
||||
foreach ($rolls as $roll) {
|
||||
if ($roll->status == 1) {$tar++;}
|
||||
elseif ($roll->status == 2) {$abs++;}
|
||||
} // if rolls
|
||||
$total = $attendance->hours - attendance_tally_overall_absences_decimal($abs, $tar);
|
||||
$percent = ($total != 0)?$total/$attendance->hours:0;
|
||||
$return->grades[$student->id] = ($percent == 0)?0.0:$attendance->maxgrade * $percent;
|
||||
} else { $return->grades[$student->id] = $attendance->maxgrade; }
|
||||
} // foreach student
|
||||
} // if students
|
||||
$return->maxgrade = $attendance->maxgrade;
|
||||
} else { // if attendance->grade == "1"
|
||||
@@ -376,20 +376,26 @@ function attendance_get_participants($attendanceid) {
|
||||
* STUDENT ID INTO THE RECORDSET
|
||||
* if courseid = 0 then return ALL students in all courses
|
||||
*
|
||||
* @param int $courseid the id of the course
|
||||
* @param string $sort a field name and ASC or DESC for a SQL 'ORDER BY' clause (optional)
|
||||
* @return array(recorset) a list of all students in the specified course
|
||||
* @param int $courseid the id of the course
|
||||
* @param string $sort a field name and ASC or DESC for a SQL 'ORDER BY' clause (optional)
|
||||
* @return array(recorset) a list of all students in the specified course
|
||||
Returns
|
||||
*/
|
||||
function attendance_get_course_students($courseid, $sort="u.lastaccess DESC") {
|
||||
|
||||
global $CFG;
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$courseid' AND";
|
||||
$site = get_site();
|
||||
if ($courseid == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
return get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat,
|
||||
u.email, u.city, u.country, u.lastaccess, u.lastlogin, u.picture, u.idnumber
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_students s
|
||||
WHERE s.course = '$courseid' AND s.userid = u.id AND u.deleted = '0'
|
||||
WHERE $select s.userid = u.id AND u.deleted = '0'
|
||||
ORDER BY $sort");
|
||||
}
|
||||
|
||||
@@ -400,15 +406,15 @@ function attendance_get_course_students($courseid, $sort="u.lastaccess DESC") {
|
||||
* Given a number of tardies and absences, determine the total
|
||||
* number of equivalent absences it adds up to.
|
||||
*
|
||||
* @param int $absences the total number of absences for a span of time
|
||||
* @param int $tardies the total number of tardies for a span of time
|
||||
* @return float the number of absences it adds up to - may be a decimal!
|
||||
* @param int $absences the total number of absences for a span of time
|
||||
* @param int $tardies the total number of tardies for a span of time
|
||||
* @return float the number of absences it adds up to - may be a decimal!
|
||||
*/
|
||||
function attendance_tally_overall_absences_decimal($absences, $tardies) {
|
||||
global $CFG;
|
||||
if (isset($CFG->attendance_tardies_per_absence) && ($CFG->attendance_tardies_per_absence>0)) {
|
||||
return $absences + ($tardies/$CFG->attendance_tardies_per_absence);
|
||||
} else { return $absences; }
|
||||
if (isset($CFG->attendance_tardies_per_absence) && ($CFG->attendance_tardies_per_absence>0)) {
|
||||
return $absences + ($tardies/$CFG->attendance_tardies_per_absence);
|
||||
} else { return $absences; }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -418,23 +424,23 @@ function attendance_tally_overall_absences_decimal($absences, $tardies) {
|
||||
* number of equivalent absences it adds up to and express it as a string with
|
||||
* a possible fractional remainder
|
||||
*
|
||||
* @param int $absences the total number of absences for a span of time
|
||||
* @param int $tardies the total number of tardies for a span of time
|
||||
* @return string the number of absences it adds up to - may have a fractional component!
|
||||
* @param int $absences the total number of absences for a span of time
|
||||
* @param int $tardies the total number of tardies for a span of time
|
||||
* @return string the number of absences it adds up to - may have a fractional component!
|
||||
*/
|
||||
function attendance_tally_overall_absences_fraction($absences, $tardies) {
|
||||
global $CFG;
|
||||
if (isset($CFG->attendance_tardies_per_absence) && ($CFG->attendance_tardies_per_absence>0)) {
|
||||
$whole = floor($tardies/$CFG->attendance_tardies_per_absence);
|
||||
$fractional=$tardies-($whole * $CFG->attendance_tardies_per_absence);
|
||||
if ($absences + $whole > 0) {
|
||||
return ($absences + $whole) . (($fractional > 0) ? " ". $fractional. "/". $CFG->attendance_tardies_per_absence : "");
|
||||
} else {
|
||||
return (($fractional > 0) ? $fractional. "/". $CFG->attendance_tardies_per_absence : "0");
|
||||
}
|
||||
} else {
|
||||
return $absences."";
|
||||
}
|
||||
if (isset($CFG->attendance_tardies_per_absence) && ($CFG->attendance_tardies_per_absence>0)) {
|
||||
$whole = floor($tardies/$CFG->attendance_tardies_per_absence);
|
||||
$fractional=$tardies-($whole * $CFG->attendance_tardies_per_absence);
|
||||
if ($absences + $whole > 0) {
|
||||
return ($absences + $whole) . (($fractional > 0) ? " ". $fractional. "/". $CFG->attendance_tardies_per_absence : "");
|
||||
} else {
|
||||
return (($fractional > 0) ? $fractional. "/". $CFG->attendance_tardies_per_absence : "0");
|
||||
}
|
||||
} else {
|
||||
return $absences."";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,9 +496,9 @@ function attendance_get_records($table, $field1="", $value1="", $field2="", $val
|
||||
* first what section the specified attendance instance in the course is in, then all the
|
||||
* attendance records that are in the same section, regardless of the format of the course
|
||||
*
|
||||
* @param int $instance id of the attendance instance in course_modules
|
||||
* @param int $courseid the id of the course for which we're getting records
|
||||
* @return (object)recordset associative array of records containing the attendance records we wanted
|
||||
* @param int $instance id of the attendance instance in course_modules
|
||||
* @param int $courseid the id of the course for which we're getting records
|
||||
* @return (object)recordset associative array of records containing the attendance records we wanted
|
||||
*/
|
||||
function get_attendance_for_section($instance, $courseid) {
|
||||
global $CFG;
|
||||
@@ -548,9 +554,9 @@ AND md.name = 'attendance' AND md.id = cm.module AND m.id = cm.instance;
|
||||
* function will work with non-weekly formatted courses, though the results won't easily
|
||||
* correlate with the course view. But it will work regardless.
|
||||
*
|
||||
* @param int $id the id of the attendance record we're using as a basis for the query
|
||||
* @param int $courseid the id of the course for which we're getting records
|
||||
* @return (object)recordset associative array of records containing the attendance records we wanted
|
||||
* @param int $id the id of the attendance record we're using as a basis for the query
|
||||
* @param int $courseid the id of the course for which we're getting records
|
||||
* @return (object)recordset associative array of records containing the attendance records we wanted
|
||||
*/
|
||||
function get_attendance_for_week($id, $courseid) {
|
||||
global $CFG;
|
||||
@@ -576,8 +582,8 @@ function get_attendance_for_week($id, $courseid) {
|
||||
*
|
||||
* This function returns the timestamp for midnight of the day specified in the timestamp
|
||||
*
|
||||
* @param timestamp $d The time to find the beginning of the day for
|
||||
* @return timestamp midnight for that day
|
||||
* @param timestamp $d The time to find the beginning of the day for
|
||||
* @return timestamp midnight for that day
|
||||
*/
|
||||
function attendance_find_today($d) {
|
||||
// $da = getdate($d);
|
||||
@@ -594,8 +600,8 @@ function attendance_find_today($d) {
|
||||
*
|
||||
* This function returns the timestamp for midnight of the day after the timestamp specified
|
||||
*
|
||||
* @param timestamp $d The time to find the next day of
|
||||
* @return timestamp midnight of the next day
|
||||
* @param timestamp $d The time to find the next day of
|
||||
* @return timestamp midnight of the next day
|
||||
*/
|
||||
function attendance_find_tomorrow($d) {
|
||||
// add 24 hours to the current time - to solve end of month date issues
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "chat", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "chat", "view", "view.php?id=$cm->id", $chat->id, $cm->id);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "choice", "view all", "index?id=$course->id", "");
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
notice("There are no choices", "../../course/view.php?id=$course->id");
|
||||
}
|
||||
|
||||
if ( $allanswers = get_records("choice_answers", "userid", $USER->id)) {
|
||||
if ( isset($USER->id) and $allanswers = get_records("choice_answers", "userid", $USER->id)) {
|
||||
foreach ($allanswers as $aa) {
|
||||
$answers[$aa->choice] = $aa;
|
||||
}
|
||||
|
||||
+6
-2
@@ -13,7 +13,7 @@
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
if (!$choice = choice_get_choice($cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
@@ -22,8 +22,10 @@
|
||||
for ($i=1; $i <= $CHOICE_MAX_NUMBER; $i++) {
|
||||
$answerchecked[$i] = '';
|
||||
}
|
||||
if ($current = get_record("choice_answers", "choice", $choice->id, "userid", $USER->id)) {
|
||||
if (isset($USER->id) and $current = get_record("choice_answers", "choice", $choice->id, "userid", $USER->id)) {
|
||||
$answerchecked[$current->answer] = 'CHECKED';
|
||||
} else {
|
||||
$current = false;
|
||||
}
|
||||
|
||||
if ($form = data_submitted()) {
|
||||
@@ -113,6 +115,8 @@
|
||||
echo "<INPUT type=hidden name=id value=\"$cm->id\">";
|
||||
if (isstudent($course->id) or isteacher($course->id, 0, false)) {
|
||||
echo "<INPUT type=submit value=\"".get_string("savemychoice","choice")."\">";
|
||||
} else {
|
||||
print_string('havetologin', 'choice');
|
||||
}
|
||||
echo "</P></FORM></CENTER>";
|
||||
|
||||
|
||||
@@ -232,16 +232,46 @@ global $USER;
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function dialogue_get_users_done($dialogue) {
|
||||
global $CFG;
|
||||
return get_records_sql("SELECT u.*
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$dialogue->course' AND";
|
||||
$site = get_site();
|
||||
if ($courseid == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
if (!$students = get_records_sql("SELECT u.*
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_students s,
|
||||
{$CFG->prefix}user_teachers t,
|
||||
{$CFG->prefix}user_students s,
|
||||
{$CFG->prefix}dialogue_entries j
|
||||
WHERE ((s.course = '$dialogue->course' AND s.userid = u.id)
|
||||
OR (t.course = '$dialogue->course' AND t.userid = u.id))
|
||||
WHERE ($select s.userid = u.id)
|
||||
AND u.id = j.userid
|
||||
AND j.dialogue = '$dialogue->id'
|
||||
ORDER BY j.modified DESC");
|
||||
ORDER BY j.modified DESC")) {
|
||||
$students = array();
|
||||
}
|
||||
if (!$teachers = get_records_sql("SELECT u.*
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_teachers s,
|
||||
{$CFG->prefix}dialogue_entries j
|
||||
WHERE (s.course = '$dialogue->course' AND s.userid = u.id)
|
||||
AND u.id = j.userid
|
||||
AND j.dialogue = '$dialogue->id'
|
||||
ORDER BY j.modified DESC")) {
|
||||
$teachers = array();
|
||||
}
|
||||
return $teachers + $students;
|
||||
|
||||
// The following original version is very inefficient on large sites
|
||||
// return get_records_sql("SELECT u.*
|
||||
// FROM {$CFG->prefix}user u,
|
||||
// {$CFG->prefix}user_students s,
|
||||
// {$CFG->prefix}user_teachers t,
|
||||
// {$CFG->prefix}dialogue_entries j
|
||||
// WHERE ((s.course = '$dialogue->course' AND s.userid = u.id)
|
||||
// OR (t.course = '$dialogue->course' AND t.userid = u.id))
|
||||
// AND u.id = j.userid
|
||||
// AND j.dialogue = '$dialogue->id'
|
||||
// ORDER BY j.modified DESC");
|
||||
}
|
||||
|
||||
|
||||
|
||||
+62
-18
@@ -236,10 +236,16 @@ function exercise_count_assessments_by_teacher($exercise, $teacher) {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function exercise_count_student_submissions($exercise) {
|
||||
global $CFG;
|
||||
|
||||
return count_records_sql("SELECT count(*) FROM {$CFG->prefix}exercise_submissions s, {$CFG->prefix}user_students u
|
||||
WHERE u.course = $exercise->course
|
||||
AND s.userid = u.userid
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return count_records_sql("SELECT count(*) FROM {$CFG->prefix}exercise_submissions s, {$CFG->prefix}user_students u
|
||||
WHERE $select s.userid = u.userid
|
||||
AND s.exerciseid = $exercise->id
|
||||
AND timecreated > 0");
|
||||
}
|
||||
@@ -480,12 +486,18 @@ function exercise_delete_user_files($exercise, $user, $exception) {
|
||||
function exercise_get_best_submission_grades($exercise) {
|
||||
// Returns the grades of students' best submissions
|
||||
global $CFG;
|
||||
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT DISTINCT u.userid, MAX(a.grade) AS grade FROM
|
||||
{$CFG->prefix}exercise_submissions s,
|
||||
{$CFG->prefix}exercise_assessments a, {$CFG->prefix}user_students u
|
||||
WHERE u.course = $exercise->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND s.exerciseid = $exercise->id
|
||||
AND s.late = 0
|
||||
AND a.submissionid = s.id
|
||||
@@ -528,11 +540,18 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
|
||||
// just look at a single group
|
||||
if ($order == "grade") {
|
||||
// allow for multiple assessments of submissions (coming from different teachers)
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT s.*, AVG(a.grade) AS grade FROM {$CFG->prefix}user_students u,
|
||||
{$CFG->prefix}groups_members g, {$CFG->prefix}exercise_submissions s,
|
||||
{$CFG->prefix}exercise_assessments a
|
||||
WHERE u.course = $exercise->course
|
||||
AND g.groupid = $groupid
|
||||
WHERE $select g.groupid = $groupid
|
||||
AND u.userid = g.userid
|
||||
AND s.userid = u.userid
|
||||
AND s.exerciseid = $exercise->id
|
||||
@@ -549,10 +568,16 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
|
||||
$order = "s.timecreated";
|
||||
}
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT s.* FROM {$CFG->prefix}user_students u, {$CFG->prefix}user n,
|
||||
{$CFG->prefix}groups_members g, {$CFG->prefix}exercise_submissions s
|
||||
WHERE u.course = $exercise->course
|
||||
AND g.groupid = $groupid
|
||||
WHERE $select g.groupid = $groupid
|
||||
AND u.userid = g.userid
|
||||
AND s.userid = u.userid
|
||||
AND n.id = u.userid
|
||||
@@ -563,10 +588,17 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
|
||||
else { // no group - all users
|
||||
if ($order == "grade") {
|
||||
// allow for multiple assessments of submissions (coming from different teachers)
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT s.*, AVG(a.grade) AS grade FROM {$CFG->prefix}exercise_submissions s,
|
||||
{$CFG->prefix}user_students u, {$CFG->prefix}exercise_assessments a
|
||||
WHERE u.course = $exercise->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND s.exerciseid = $exercise->id
|
||||
AND a.submissionid = s.id
|
||||
GROUP BY s.id
|
||||
@@ -581,10 +613,16 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
|
||||
$order = "s.timecreated";
|
||||
}
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT s.* FROM {$CFG->prefix}exercise_submissions s,
|
||||
{$CFG->prefix}user_students u, {$CFG->prefix}user n
|
||||
WHERE u.course = $exercise->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND n.id = u.userid
|
||||
AND s.exerciseid = $exercise->id
|
||||
ORDER BY $order");
|
||||
@@ -629,12 +667,18 @@ function exercise_get_ungraded_assessments($exercise) {
|
||||
function exercise_get_ungraded_assessments_student($exercise) {
|
||||
global $CFG;
|
||||
// Return all assessments which have not been graded or just graded of student's submissions
|
||||
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
$cutofftime =time() - $CFG->maxeditingtime;
|
||||
return get_records_sql("SELECT a.* FROM {$CFG->prefix}exercise_submissions s, {$CFG->prefix}user_students u,
|
||||
{$CFG->prefix}exercise_assessments a
|
||||
WHERE u.course = $exercise->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND s.exerciseid = $exercise->id
|
||||
AND a.submissionid = s.id
|
||||
AND (a.timegraded = 0 OR a.timegraded > $cutofftime)
|
||||
|
||||
+2
-3
@@ -406,9 +406,8 @@
|
||||
|
||||
$course = get_record('course', 'id', $forum->course);
|
||||
$strforums = get_string("modulenameplural", "forum");
|
||||
print_header("$course->shortname: $discussion->name: $post->subject", "$course->fullname",
|
||||
"<a href=../../course/view.php?id=$course->id>$course->shortname</a> ->
|
||||
<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
print_header_simple("$discussion->name: $post->subject", "",
|
||||
"<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"view.php?f=$forum->id\">$forum->name</a> ->
|
||||
<a href=\"discuss.php?d=$discussion->id\">$post->subject</a> -> ".
|
||||
get_string("prune", "forum"), '', "", true, "", navmenu($course, $cm));
|
||||
|
||||
@@ -38,9 +38,8 @@
|
||||
$searchform = forum_print_search_form($course, $search, true, "plain");
|
||||
|
||||
if (!$search) {
|
||||
print_header("$course->shortname: $strsearch", "$course->fullname",
|
||||
"<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->
|
||||
<A HREF=\"index.php?id=$course->id\">$strforums</A> -> $strsearch", "search.search",
|
||||
print_header_simple("$strsearch", "",
|
||||
"<A HREF=\"index.php?id=$course->id\">$strforums</A> -> $strsearch", "search.search",
|
||||
"", "", " ", navmenu($course));
|
||||
|
||||
print_simple_box_start("center");
|
||||
@@ -59,9 +58,8 @@
|
||||
if (!$posts = forum_search_posts($searchterms, $course->id, $page*$perpage, $perpage, $totalcount)) {
|
||||
|
||||
|
||||
print_header("$course->shortname: $strsearchresults", "$course->fullname",
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"index.php?id=$course->id\">$strforums</a> ->
|
||||
print_header_simple("$strsearchresults", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"search.php?id=$course->id\">$strsearch</a> -> \"$search\"", "search.search",
|
||||
"", "", " ", navmenu($course));
|
||||
print_heading(get_string("nopostscontaining", "forum", $search));
|
||||
@@ -79,9 +77,8 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
print_header("$course->shortname: $strsearchresults", "$course->fullname",
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"index.php?id=$course->id\">$strforums</a> ->
|
||||
print_header_simple("$strsearchresults", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strforums</a> ->
|
||||
<a href=\"search.php?id=$course->id\">$strsearch</a> -> \"$search\"", "search.search",
|
||||
"", "", $searchform, navmenu($course));
|
||||
|
||||
|
||||
@@ -72,9 +72,8 @@ if ( $confirm ) {
|
||||
$onsubmit = "";
|
||||
}
|
||||
|
||||
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->
|
||||
<A HREF=\"index.php?id=$course->id\">$strglossaries</A> ->
|
||||
print_header_simple(strip_tags("$glossary->name"), "",
|
||||
"<A HREF=\"index.php?id=$course->id\">$strglossaries</A> ->
|
||||
<A HREF=\"view.php?id=$cm->id\">$glossary->name</A> -> $stredit", "form.text",
|
||||
"", true, "", navmenu($course, $cm));
|
||||
|
||||
@@ -247,9 +246,8 @@ if ($usehtmleditor = can_use_richtext_editor()) {
|
||||
$onsubmit = "";
|
||||
}
|
||||
|
||||
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->
|
||||
<A HREF=\"index.php?id=$course->id\">$strglossaries</A> ->
|
||||
print_header_simple(strip_tags("$glossary->name"), "",
|
||||
"<A HREF=\"index.php?id=$course->id\">$strglossaries</A> ->
|
||||
<A HREF=\"view.php?id=$cm->id\">$glossary->name</A> -> $stredit", "",
|
||||
"", true, "", navmenu($course, $cm));
|
||||
|
||||
|
||||
+12
-12
@@ -7,7 +7,7 @@
|
||||
|
||||
require_variable($id);
|
||||
optional_variable($mode);
|
||||
|
||||
|
||||
require_login();
|
||||
if ( !isadmin() ) {
|
||||
error("You must be an admin to use this page.");
|
||||
@@ -52,7 +52,7 @@
|
||||
$strmodulename = get_string("modulename", "glossary");
|
||||
$strdisplayformats = get_string("displayformats","glossary");
|
||||
|
||||
print_header("$site->shortname: $strmodulename: $strconfiguration", $site->fullname,
|
||||
print_header("$strmodulename: $strconfiguration", $site->fullname,
|
||||
"<a href=\"../../admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"../../admin/configure.php\">$strconfiguration</a> -> ".
|
||||
"<a href=\"../../admin/modules.php\">$strmanagemodules</a> -> <a href=\"../../admin/module.php?module=glossary\">$strmodulename</a> -> $strdisplayformats");
|
||||
@@ -70,11 +70,11 @@
|
||||
echo '<form method="post" action="formats.php" name="form">';
|
||||
echo '<table width="90%" align="center" bgcolor="' . $THEME->cellheading . '" class="generalbox">';
|
||||
?>
|
||||
<tr>
|
||||
<td colspan=3 align=center><strong>
|
||||
<?php echo get_string('displayformat'.$displayformat->name,"glossary"); ?>
|
||||
<tr>
|
||||
<td colspan=3 align=center><strong>
|
||||
<?php echo get_string('displayformat'.$displayformat->name,"glossary"); ?>
|
||||
</strong></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align="right" width="20%"><?PHP print_string('popupformat','glossary'); ?></td>
|
||||
<td>
|
||||
@@ -255,14 +255,14 @@
|
||||
<?php print_string("cnfshowgroup", "glossary") ?><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=3 align=center>
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=3 align=center>
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
</tr>
|
||||
<input type="hidden" name=id value="<?php p($id) ?>">
|
||||
<input type="hidden" name=mode value="edit">
|
||||
<?PHP
|
||||
|
||||
<?PHP
|
||||
|
||||
print_simple_box_end();
|
||||
echo '</form>';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "glossary", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
$entriesbypage = $CFG->glossary_entbypage;
|
||||
}
|
||||
|
||||
print_header(strip_tags("$course->shortname: $glossary->name"));
|
||||
print_header_simple(strip_tags("$glossary->name"));
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
/// printpivot indicate if the pivot should be printed or not
|
||||
switch ($CFG->dbtype) {
|
||||
case 'postgres7':
|
||||
$as = 'as';
|
||||
$as = 'as';
|
||||
break;
|
||||
case 'mysql':
|
||||
$as = '';
|
||||
$as = '';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
$fullpivot = 1;
|
||||
|
||||
$userid = '';
|
||||
if ( $USER->id ) {
|
||||
if ( isset($USER->id) ) {
|
||||
$userid = "OR ge.userid = $USER->id";
|
||||
}
|
||||
switch ($tab) {
|
||||
@@ -218,12 +218,12 @@
|
||||
$sqllimit = '';
|
||||
|
||||
if ( $offset >= 0 ) {
|
||||
switch ($CFG->dbtype) {
|
||||
switch ($CFG->dbtype) {
|
||||
case 'postgres7':
|
||||
$sqllimit = " LIMIT $entriesbypage OFFSET $offset";
|
||||
$sqllimit = " LIMIT $entriesbypage OFFSET $offset";
|
||||
break;
|
||||
case 'mysql':
|
||||
$sqllimit = " LIMIT $offset, $entriesbypage";
|
||||
$sqllimit = " LIMIT $offset, $entriesbypage";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,9 @@
|
||||
$CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds && $glossary->rsstype and $glossary->rssarticles) {
|
||||
echo '<table width="100%" border="0" cellpadding="3" cellspacing="0"><tr valign="top"><td align="right">';
|
||||
$tooltiptext = get_string("rsssubscriberss","glossary",$glossary->name);
|
||||
rss_print_link($course->id, $USER->id, "glossary", $glossary->id, $tooltiptext);
|
||||
if (isset($USER->id)) {
|
||||
rss_print_link($course->id, $USER->id, "glossary", $glossary->id, $tooltiptext);
|
||||
}
|
||||
echo '</td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
+18
-19
@@ -1,6 +1,6 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("../../config.php");
|
||||
|
||||
require_variable($id); // Course Module ID
|
||||
|
||||
@@ -29,34 +29,34 @@
|
||||
|
||||
if ($form = data_submitted()) {
|
||||
|
||||
$timenow = time();
|
||||
$timenow = time();
|
||||
|
||||
$form->text = clean_text($form->text, $form->format);
|
||||
|
||||
if ($entry) {
|
||||
if ($entry) {
|
||||
$newentry->id = $entry->id;
|
||||
$newentry->text = $form->text;
|
||||
$newentry->format = $form->format;
|
||||
$newentry->modified = $timenow;
|
||||
if (! update_record("journal_entries", $newentry)) {
|
||||
error("Could not update your journal");
|
||||
}
|
||||
if (! update_record("journal_entries", $newentry)) {
|
||||
error("Could not update your journal");
|
||||
}
|
||||
add_to_log($course->id, "journal", "update entry", "view.php?id=$cm->id", "$newentry->id", $cm->id);
|
||||
} else {
|
||||
} else {
|
||||
$newentry->userid = $USER->id;
|
||||
$newentry->journal = $journal->id;
|
||||
$newentry->text = $form->text;
|
||||
$newentry->format = $form->format;
|
||||
$newentry->modified = $timenow;
|
||||
if (! $newentry->id = insert_record("journal_entries", $newentry)) {
|
||||
error("Could not insert a new journal entry");
|
||||
}
|
||||
if (! $newentry->id = insert_record("journal_entries", $newentry)) {
|
||||
error("Could not insert a new journal entry");
|
||||
}
|
||||
add_to_log($course->id, "journal", "add entry", "view.php?id=$cm->id", "$newentry->id", $cm->id);
|
||||
}
|
||||
|
||||
redirect("view.php?id=$cm->id");
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
redirect("view.php?id=$cm->id");
|
||||
die;
|
||||
}
|
||||
|
||||
/// Otherwise fill and print the form.
|
||||
|
||||
@@ -75,9 +75,8 @@
|
||||
$entry->format = $defaultformat;
|
||||
}
|
||||
|
||||
print_header("$course->shortname: $journal->name", "$course->fullname",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->
|
||||
<A HREF=\"index.php?id=$course->id\">$strjournals</A> ->
|
||||
print_header_simple("$journal->name", "",
|
||||
"<A HREF=\"index.php?id=$course->id\">$strjournals</A> ->
|
||||
<A HREF=\"view.php?id=$cm->id\">$journal->name</A> -> $stredit", "",
|
||||
"", true, "", navmenu($course, $cm));
|
||||
|
||||
@@ -87,7 +86,7 @@
|
||||
|
||||
echo "<br />";
|
||||
|
||||
include("edit.html");
|
||||
include("edit.html");
|
||||
|
||||
if ($usehtmleditor) {
|
||||
use_html_editor("text");
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
$strjournal = get_string("modulename", "journal");
|
||||
|
||||
+47
-31
@@ -68,36 +68,39 @@ function journal_user_complete_index($course, $user, $journal, $journalopen, $he
|
||||
print_simple_box_end();
|
||||
echo "<br clear=all />";
|
||||
echo "<br />";
|
||||
|
||||
if (isstudent($course->id) or isteacher($course->id)) {
|
||||
|
||||
print_simple_box_start("right", "90%");
|
||||
|
||||
if ($journalopen) {
|
||||
echo "<p align=right><a href=\"edit.php?id=$journal->coursemodule\">";
|
||||
echo get_string("edit")."</a></p>";
|
||||
} else {
|
||||
echo "<p align=right><a href=\"view.php?id=$journal->coursemodule\">";
|
||||
echo get_string("view")."</a></p>";
|
||||
print_simple_box_start("right", "90%");
|
||||
|
||||
if ($journalopen) {
|
||||
echo "<p align=right><a href=\"edit.php?id=$journal->coursemodule\">";
|
||||
echo get_string("edit")."</a></p>";
|
||||
} else {
|
||||
echo "<p align=right><a href=\"view.php?id=$journal->coursemodule\">";
|
||||
echo get_string("view")."</a></p>";
|
||||
}
|
||||
|
||||
if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) {
|
||||
if ($entry->modified) {
|
||||
echo "<p align=\"center\"><font size=1>".get_string("lastedited").": ".userdate($entry->modified)."</font></p>";
|
||||
}
|
||||
if ($entry->text) {
|
||||
echo format_text($entry->text, $entry->format);
|
||||
}
|
||||
if ($entry->teacher) {
|
||||
$grades = make_grades_menu($journal->assessed);
|
||||
journal_print_feedback($course, $entry, $grades);
|
||||
}
|
||||
} else {
|
||||
print_string("noentry", "journal");
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
echo "<br clear=all />";
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) {
|
||||
if ($entry->modified) {
|
||||
echo "<p align=\"center\"><font size=1>".get_string("lastedited").": ".userdate($entry->modified)."</font></p>";
|
||||
}
|
||||
if ($entry->text) {
|
||||
echo format_text($entry->text, $entry->format);
|
||||
}
|
||||
if ($entry->teacher) {
|
||||
$grades = make_grades_menu($journal->assessed);
|
||||
journal_print_feedback($course, $entry, $grades);
|
||||
}
|
||||
} else {
|
||||
print_string("noentry", "journal");
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
echo "<br clear=all />";
|
||||
echo "<br />";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -311,14 +314,20 @@ function journal_scale_used ($journalid,$scaleid) {
|
||||
function journal_get_users_done($journal) {
|
||||
global $CFG;
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$journal->course' AND";
|
||||
$site = get_site();
|
||||
if ($journal->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
$studentjournals = get_records_sql ("SELECT u.*
|
||||
FROM {$CFG->prefix}journal_entries j,
|
||||
{$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_students s
|
||||
WHERE j.userid = u.id
|
||||
AND s.userid = u.id
|
||||
AND j.journal = $journal->id
|
||||
AND s.course = $journal->course
|
||||
AND $select j.journal = $journal->id
|
||||
ORDER BY j.modified DESC");
|
||||
|
||||
$teacherjournals = get_records_sql ("SELECT u.*
|
||||
@@ -357,14 +366,21 @@ function journal_count_entries($journal, $groupid=0) {
|
||||
AND j.userid = g.userid");
|
||||
|
||||
} else { /// Count all the entries from the whole course
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$journal->course' AND";
|
||||
$site = get_site();
|
||||
if ($journal->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
$studentjournals = count_records_sql("SELECT COUNT(*)
|
||||
FROM {$CFG->prefix}journal_entries j,
|
||||
{$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_students s
|
||||
WHERE j.userid = u.id
|
||||
AND s.userid = u.id
|
||||
AND j.journal = $journal->id
|
||||
AND s.course = $journal->course ");
|
||||
AND $select j.journal = $journal->id");
|
||||
|
||||
$teacherjournals = count_records_sql("SELECT COUNT(*)
|
||||
FROM {$CFG->prefix}journal_entries j,
|
||||
|
||||
@@ -38,9 +38,8 @@
|
||||
$strentries = get_string("entries", "journal");
|
||||
$strjournals = get_string("modulenameplural", "journal");
|
||||
|
||||
print_header("$course->shortname: $strjournals", "$course->fullname",
|
||||
"<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"index.php?id=$course->id\">$strjournals</a> ->
|
||||
print_header_simple("$strjournals", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strjournals</a> ->
|
||||
<a href=\"view.php?id=$cm->id\">$journal->name</a> -> $strentries", "", "", true);
|
||||
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
$strimportquestions = get_string("importquestions", "lesson");
|
||||
$strlessons = get_string("modulenameplural", "lesson");
|
||||
|
||||
print_header("$course->shortname: $strimportquestions", "$course->shortname: $strimportquestions",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> -> ".
|
||||
print_header_simple("$strimportquestions", " $strimportquestions",
|
||||
"<A HREF=index.php?id=$course->id>$strlessons</A> -> <a href=\"view.php?id=$cm->id\">$lesson->name</a>-> $strimportquestions");
|
||||
|
||||
if ($form = data_submitted()) { /// Filename
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "lesson", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
@@ -68,10 +68,11 @@
|
||||
$due = "<FONT COLOR=\"red\">".userdate($lesson->deadline)."</FONT>";
|
||||
}
|
||||
|
||||
$grade_value = '';
|
||||
if ($course->format == "weeks" or $course->format == "topics") {
|
||||
if (isteacher($course->id)) {
|
||||
$grade_value = $lesson->grade;
|
||||
} else {
|
||||
} elseif (isstudent($course->id)) {
|
||||
// it's a student, show their mean or maximum grade
|
||||
if ($lesson->usemaxgrade) {
|
||||
$grade = get_record_sql("SELECT MAX(grade) as grade FROM {$CFG->prefix}lesson_grades
|
||||
@@ -83,8 +84,6 @@
|
||||
if ($grade) {
|
||||
// grades are stored as percentages
|
||||
$grade_value = number_format($grade->grade * $lesson->grade / 100, 1);
|
||||
} else {
|
||||
$grade_value = 0;
|
||||
}
|
||||
}
|
||||
$table->data[] = array ($lesson->section, $link, $grade_value, $due);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?PHP // $Id$
|
||||
// Allows a teacher to create, edit and delete categories
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
require_variable($id); // course
|
||||
|
||||
@@ -39,9 +39,8 @@
|
||||
"quiz");
|
||||
$streditcategories = get_string("editcategories", "quiz");
|
||||
|
||||
print_header("$course->shortname: $streditcategories", "$course->shortname: $streditcategories",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
|
||||
-> <A HREF=\"edit.php\">$streditingquiz</A> -> $streditcategories");
|
||||
print_header_simple("$streditcategories", " $streditcategories",
|
||||
"<A HREF=\"edit.php\">$streditingquiz</A> -> $streditcategories");
|
||||
|
||||
|
||||
/// Delete category if the user wants to delete it
|
||||
@@ -120,7 +119,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Get the existing categories
|
||||
|
||||
+1
-2
@@ -164,8 +164,7 @@
|
||||
$strediting = get_string(isset($modform->instance) ? "editingquiz" : "editquestions", "quiz");
|
||||
$strheading = empty($modform->name) ? $strediting : $modform->name;
|
||||
|
||||
print_header("$course->shortname: $strediting", "$course->shortname: $strheading",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> ".
|
||||
print_header_simple("$strediting", "$strheading",
|
||||
"<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a> -> $strediting");
|
||||
|
||||
// Print basic page layout.
|
||||
|
||||
+9
-10
@@ -27,16 +27,15 @@
|
||||
$strquizzes = get_string('modulenameplural', 'quiz');
|
||||
$streditingquiz = get_string(isset($SESSION->modform->instance) ? "editingquiz" : "editquestions", "quiz");
|
||||
|
||||
print_header("$course->shortname: $strexportquestions", "$course->shortname: $strexportquestions",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
|
||||
"-> <a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
print_header_simple("$strexportquestions", "$strexportquestions",
|
||||
"<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
" -> <a href=\"edit.php\">$streditingquiz</a> -> $strexportquestions");
|
||||
|
||||
if ($form = data_submitted()) { /// Filename
|
||||
|
||||
|
||||
if (! is_readable("format/$form->format/format.php")) {
|
||||
error("Format not known ($form->format)");
|
||||
error("Format not known ($form->format)");
|
||||
}
|
||||
|
||||
require("format.php"); // Parent class
|
||||
@@ -45,18 +44,18 @@
|
||||
$format = new quiz_file_format();
|
||||
|
||||
if (! $format->exportpreprocess($category, $course)) { // Do anything before that we need to
|
||||
error("Error occurred during pre-processing!",
|
||||
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
|
||||
error("Error occurred during pre-processing!",
|
||||
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
|
||||
}
|
||||
|
||||
if (! $format->exportprocess($exportfilename)) { // Process the export data
|
||||
error("Error occurred during processing!",
|
||||
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
|
||||
error("Error occurred during processing!",
|
||||
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
|
||||
}
|
||||
|
||||
if (! $format->exportpostprocess()) { // In case anything needs to be done after
|
||||
error("Error occurred during post-processing!",
|
||||
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
|
||||
error("Error occurred during post-processing!",
|
||||
"$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
|
||||
}
|
||||
|
||||
echo "<hr>";
|
||||
|
||||
+2
-3
@@ -27,9 +27,8 @@
|
||||
$strquizzes = get_string('modulenameplural', 'quiz');
|
||||
$streditingquiz = get_string(isset($SESSION->modform->instance) ? "editingquiz" : "editquestions", "quiz");
|
||||
|
||||
print_header("$course->shortname: $strimportquestions", "$course->shortname: $strimportquestions",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
|
||||
"-> <a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
print_header_simple("$strimportquestions", "$strimportquestions",
|
||||
"<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
" -> <a href=\"edit.php\">$streditingquiz</a> -> $strimportquestions");
|
||||
|
||||
if ($form = data_submitted()) { /// Filename
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?PHP // $Id$
|
||||
// A quick way to add lots of questions to a category (and a quiz)
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
require_variable($category);
|
||||
|
||||
@@ -100,9 +100,8 @@
|
||||
$streditingquiz = get_string(isset($SESSION->modform->instance) ? "editingquiz" : "editquestions", "quiz");
|
||||
$strcreatemultiple = get_string("createmultiple", "quiz");
|
||||
|
||||
print_header("$course->shortname: $strcreatemultiple", "$course->shortname: $strcreatemultiple",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
|
||||
" -> <a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
print_header_simple("$strcreatemultiple", "$strcreatemultiple",
|
||||
"<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
" -> <a href=\"edit.php\">$streditingquiz</a> -> $strcreatemultiple");
|
||||
|
||||
|
||||
|
||||
@@ -58,9 +58,8 @@
|
||||
$streditingquiz = get_string(isset($SESSION->modform->instance) ? "editingquiz" : "editquestions", "quiz");
|
||||
$streditingquestion = get_string("editingquestion", "quiz");
|
||||
|
||||
print_header("$course->shortname: $streditingquestion", "$course->shortname: $streditingquestion",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
|
||||
"-> <a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
print_header_simple("$streditingquestion", "$streditingquestion",
|
||||
"<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a>".
|
||||
" -> <a href=\"edit.php\">$streditingquiz</a> -> $streditingquestion");
|
||||
|
||||
if (isset($delete)) {
|
||||
|
||||
@@ -31,9 +31,8 @@
|
||||
$strdefinedataset = get_string("datasetdefinitions", "quiz", $category->name);
|
||||
$strquestions = get_string("questions", "quiz");
|
||||
|
||||
print_header("$course->shortname: $strdefinedataset", "$course->shortname: $strdefinedataset",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
|
||||
-> <A HREF=\"../../edit.php\">$streditingquiz</A> -> $strdefinedataset");
|
||||
print_header_simple("$strdefinedataset", "$strdefinedataset",
|
||||
"<A HREF=\"../../edit.php\">$streditingquiz</A> -> $strdefinedataset");
|
||||
|
||||
if ($form = data_submitted()) { /// Filename
|
||||
|
||||
|
||||
+155
-155
@@ -19,20 +19,20 @@
|
||||
$strediting = get_string("validateascorm", "scorm");
|
||||
$strname = get_string("name");
|
||||
|
||||
print_header("$course->shortname: $strediting", "$course->shortname: $strediting",
|
||||
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> -> $strediting");
|
||||
print_header_simple("$strediting", "$strediting",
|
||||
"$strediting");
|
||||
|
||||
if (!$form->name or !$form->reference or !$form->summary) {
|
||||
error(get_string("filloutallfields"), $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
//
|
||||
// Create a temporary directory to unzip package and validate imsmanifest
|
||||
//
|
||||
|
||||
//
|
||||
// Create a temporary directory to unzip package and validate imsmanifest
|
||||
//
|
||||
|
||||
$coursedir = "$CFG->dataroot/$course->id";
|
||||
$coursedir = "$CFG->dataroot/$course->id";
|
||||
|
||||
if ($scormdir = make_upload_directory("$course->id/$CFG->moddata/scorm")) {
|
||||
if ($scormdir = make_upload_directory("$course->id/$CFG->moddata/scorm")) {
|
||||
if ($tempdir = scorm_datadir($scormdir, $form->datadir)) {
|
||||
copy ("$coursedir/$form->reference", $tempdir."/".basename($form->reference));
|
||||
if (empty($CFG->unzip)) { // Use built-in php-based unzip function
|
||||
@@ -49,145 +49,145 @@
|
||||
} else {
|
||||
$result = "packagedir";
|
||||
}
|
||||
} else {
|
||||
$result = "datadir";
|
||||
}
|
||||
$errorlogs = '';
|
||||
if (($result != "regular") && ($result != "found")) {
|
||||
if ($CFG->scorm_validate == 'domxml') {
|
||||
foreach ($errors as $error) {
|
||||
$errorlogs .= get_string($error->type,"scorm",$error->data) . ".\n";
|
||||
}
|
||||
}
|
||||
//
|
||||
// Delete files and temporary directory
|
||||
//
|
||||
if (is_dir($tempdir))
|
||||
scorm_delete_files($tempdir);
|
||||
} else {
|
||||
//
|
||||
// Delete package file
|
||||
//
|
||||
unlink ($tempdir."/".basename($form->reference));
|
||||
if ($form->mode == "update") {
|
||||
$fp = fopen($coursedir."/".$form->reference,"r");
|
||||
$fstat = fstat($fp);
|
||||
fclose($fp);
|
||||
if (get_field("scorm","timemodified","id",$form->instance) < $fstat["mtime"])
|
||||
$form->launch = 0;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Print validation result
|
||||
//
|
||||
print_simple_box_start("center", "", "$THEME->cellheading");
|
||||
echo "<table cellpadding=\"5\" align=\"center\">\n";
|
||||
echo " <tr><td align=\"right\" nowrap><p><b>$strname:</b></p></td><td><p>$form->name</p></a></td></tr>\n";
|
||||
echo " <tr><td align=\"right\" nowrap><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></a></td></tr>\n";
|
||||
if ($errorlogs != '') {
|
||||
$lines = round(count($errors)/4);
|
||||
if ($lines < 5) {
|
||||
$lines = 5;
|
||||
}
|
||||
echo " <tr><td align=\"right\" nowrap><p><b>".get_string("errorlogs","scorm").":</b></p></td><td><textarea rows=\"".$lines."\" cols=\"30\" readonly>".$errorlogs."</textarea></a></td></tr>\n";
|
||||
}
|
||||
if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance)))
|
||||
echo " <tr><td align=\"center\" colspan=\"2\" nowrap><p><b>".get_string("trackingloose","scorm")."</b></p></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
if (($result == "regular") || ($result == "found")){
|
||||
if (empty($form->auto)) {
|
||||
$form->auto = "";
|
||||
}
|
||||
if (empty($form->maxgrade)) {
|
||||
$form->maxgrade = "";
|
||||
}
|
||||
if (empty($form->grademethod)) {
|
||||
$form->grademethod = "0";
|
||||
}
|
||||
echo "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n";
|
||||
|
||||
//$form->popup = $CFG->scorm_popup;
|
||||
$strnewwindow = get_string("newwindow", "scorm");
|
||||
} else {
|
||||
$result = "datadir";
|
||||
}
|
||||
$errorlogs = '';
|
||||
if (($result != "regular") && ($result != "found")) {
|
||||
if ($CFG->scorm_validate == 'domxml') {
|
||||
foreach ($errors as $error) {
|
||||
$errorlogs .= get_string($error->type,"scorm",$error->data) . ".\n";
|
||||
}
|
||||
}
|
||||
//
|
||||
// Delete files and temporary directory
|
||||
//
|
||||
if (is_dir($tempdir))
|
||||
scorm_delete_files($tempdir);
|
||||
} else {
|
||||
//
|
||||
// Delete package file
|
||||
//
|
||||
unlink ($tempdir."/".basename($form->reference));
|
||||
if ($form->mode == "update") {
|
||||
$fp = fopen($coursedir."/".$form->reference,"r");
|
||||
$fstat = fstat($fp);
|
||||
fclose($fp);
|
||||
if (get_field("scorm","timemodified","id",$form->instance) < $fstat["mtime"])
|
||||
$form->launch = 0;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Print validation result
|
||||
//
|
||||
print_simple_box_start("center", "", "$THEME->cellheading");
|
||||
echo "<table cellpadding=\"5\" align=\"center\">\n";
|
||||
echo " <tr><td align=\"right\" nowrap><p><b>$strname:</b></p></td><td><p>$form->name</p></a></td></tr>\n";
|
||||
echo " <tr><td align=\"right\" nowrap><p><b>".get_string("validation","scorm").":</b></p></td><td><p>".get_string($result,"scorm")."</p></a></td></tr>\n";
|
||||
if ($errorlogs != '') {
|
||||
$lines = round(count($errors)/4);
|
||||
if ($lines < 5) {
|
||||
$lines = 5;
|
||||
}
|
||||
echo " <tr><td align=\"right\" nowrap><p><b>".get_string("errorlogs","scorm").":</b></p></td><td><textarea rows=\"".$lines."\" cols=\"30\" readonly>".$errorlogs."</textarea></a></td></tr>\n";
|
||||
}
|
||||
if (($form->mode == "update") && ($form->launch == 0) && (get_records("scorm_sco_users","scormid",$form->instance)))
|
||||
echo " <tr><td align=\"center\" colspan=\"2\" nowrap><p><b>".get_string("trackingloose","scorm")."</b></p></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
if (($result == "regular") || ($result == "found")){
|
||||
if (empty($form->auto)) {
|
||||
$form->auto = "";
|
||||
}
|
||||
if (empty($form->maxgrade)) {
|
||||
$form->maxgrade = "";
|
||||
}
|
||||
if (empty($form->grademethod)) {
|
||||
$form->grademethod = "0";
|
||||
}
|
||||
echo "<form name=\"theform\" method=\"post\" action=\"$form->destination\">\n";
|
||||
|
||||
//$form->popup = $CFG->scorm_popup;
|
||||
$strnewwindow = get_string("newwindow", "scorm");
|
||||
$strnewwindowopen = get_string("newwindowopen", "scorm");
|
||||
foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
|
||||
$stringname = "str$optionname";
|
||||
$$stringname = get_string("new$optionname", "scorm");
|
||||
$window->$optionname = "";
|
||||
$jsoption[] = "\"$optionname\"";
|
||||
foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
|
||||
$stringname = "str$optionname";
|
||||
$$stringname = get_string("new$optionname", "scorm");
|
||||
$window->$optionname = "";
|
||||
$jsoption[] = "\"$optionname\"";
|
||||
}
|
||||
$alljsoptions = implode(",", $jsoption);
|
||||
|
||||
|
||||
if ($form->instance) { // Re-editing
|
||||
if ($form->popup == "") {
|
||||
if ($form->popup == "") {
|
||||
$newwindow = ""; // Disable the new window
|
||||
foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
|
||||
$defaultvalue = "scorm_popup$optionname";
|
||||
$window->$optionname = $CFG->$defaultvalue;
|
||||
}
|
||||
} else {
|
||||
$newwindow = "checked";
|
||||
$defaultvalue = "scorm_popup$optionname";
|
||||
$window->$optionname = $CFG->$defaultvalue;
|
||||
}
|
||||
} else {
|
||||
$newwindow = "checked";
|
||||
$rawoptions = explode(',', $form->popup);
|
||||
foreach ($rawoptions as $rawoption) {
|
||||
$option = explode('=', trim($rawoption));
|
||||
if (($option[0] != 'location') && ($option[0] != 'menubar') && ($option[0] != 'toolbar')) {
|
||||
$optionname = $option[0];
|
||||
$optionvalue = $option[1];
|
||||
if ($optionname == "height" or $optionname == "width") {
|
||||
$window->$optionname = $optionvalue;
|
||||
} else if ($optionvalue == 1) {
|
||||
$window->$optionname = "checked";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
|
||||
$option = explode('=', trim($rawoption));
|
||||
if (($option[0] != 'location') && ($option[0] != 'menubar') && ($option[0] != 'toolbar')) {
|
||||
$optionname = $option[0];
|
||||
$optionvalue = $option[1];
|
||||
if ($optionname == "height" or $optionname == "width") {
|
||||
$window->$optionname = $optionvalue;
|
||||
} else if ($optionvalue == 1) {
|
||||
$window->$optionname = "checked";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($SCORM_WINDOW_OPTIONS as $optionname) {
|
||||
$defaultvalue = "scorm_popup$optionname";
|
||||
$window->$optionname = $CFG->$defaultvalue;
|
||||
}
|
||||
$newwindow = $CFG->scorm_popup;
|
||||
}
|
||||
|
||||
}
|
||||
$newwindow = $CFG->scorm_popup;
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellpadding="5" align="center">
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php print_string("grademethod", "scorm") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
$options = array();
|
||||
$options[0] = get_string("gradescoes", "scorm");
|
||||
$options[1] = get_string("gradehighest", "scorm");
|
||||
$options[2] = get_string("gradeaverage", "scorm");
|
||||
choose_from_menu($SCORM_GRADE_METHOD, "grademethod", "$form->grademethod", "");
|
||||
helpbutton("grademethod", get_string("grademethod","scorm"), "scorm");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php print_string("maximumgrade") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
<table cellpadding="5" align="center">
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php print_string("grademethod", "scorm") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
$options = array();
|
||||
$options[0] = get_string("gradescoes", "scorm");
|
||||
$options[1] = get_string("gradehighest", "scorm");
|
||||
$options[2] = get_string("gradeaverage", "scorm");
|
||||
choose_from_menu($SCORM_GRADE_METHOD, "grademethod", "$form->grademethod", "");
|
||||
helpbutton("grademethod", get_string("grademethod","scorm"), "scorm");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php print_string("maximumgrade") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
|
||||
choose_from_menu($grades, "maxgrade", "$form->maxgrade", "");
|
||||
helpbutton("maxgrade", get_string("maximumgrade"), "scorm");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
$options = array();
|
||||
$options[0]=get_string("no");
|
||||
$options[1]=get_string("yes");
|
||||
choose_from_menu ($options, "auto", $form->auto);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
choose_from_menu($grades, "maxgrade", "$form->maxgrade", "");
|
||||
helpbutton("maxgrade", get_string("maximumgrade"), "scorm");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php print_string("autocontinue","scorm") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
$options = array();
|
||||
$options[0]=get_string("no");
|
||||
$options[1]=get_string("yes");
|
||||
choose_from_menu ($options, "auto", $form->auto);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" nowrap>
|
||||
<p><b><?php p($strnewwindow) ?></b></p>
|
||||
</td>
|
||||
@@ -239,32 +239,32 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="reference" value="<?php p($form->reference) ?>" />
|
||||
<input type="hidden" name="datadir" value="<?php p(substr($tempdir,strlen($scormdir))) ?>" />
|
||||
<input type="hidden" name="summary" value="<?php p($form->summary) ?>" />
|
||||
<input type="hidden" name="name" value="<?php p($form->name) ?>" />
|
||||
<input type="hidden" name="launch" value="<?php p($form->launch) ?>" />
|
||||
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
|
||||
<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
|
||||
<input type="hidden" name="section" value="<?php p($form->section) ?>" />
|
||||
<input type="hidden" name="module" value="<?php p($form->module) ?>" />
|
||||
<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
|
||||
<input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
|
||||
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
|
||||
<div align="center">
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" />
|
||||
<input type="submit" name=cancel value="<?php print_string("cancel") ?>" />
|
||||
</div>
|
||||
<input type="hidden" name="reference" value="<?php p($form->reference) ?>" />
|
||||
<input type="hidden" name="datadir" value="<?php p(substr($tempdir,strlen($scormdir))) ?>" />
|
||||
<input type="hidden" name="summary" value="<?php p($form->summary) ?>" />
|
||||
<input type="hidden" name="name" value="<?php p($form->name) ?>" />
|
||||
<input type="hidden" name="launch" value="<?php p($form->launch) ?>" />
|
||||
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
|
||||
<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
|
||||
<input type="hidden" name="section" value="<?php p($form->section) ?>" />
|
||||
<input type="hidden" name="module" value="<?php p($form->module) ?>" />
|
||||
<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
|
||||
<input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
|
||||
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
|
||||
<div align="center">
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" />
|
||||
<input type="submit" name=cancel value="<?php print_string("cancel") ?>" />
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
} else {
|
||||
?>
|
||||
<center>
|
||||
<center>
|
||||
<input type="button" value="<?php print_string("continue") ?>" onClick="document.location='<?php echo $CFG->wwwroot ?>/course/view.php?id=<?php echo $course->id ?>';">
|
||||
</center>
|
||||
<?php
|
||||
}
|
||||
print_simple_box_end();
|
||||
}
|
||||
print_simple_box_end();
|
||||
print_footer($course);
|
||||
} else {
|
||||
error("This script was called incorrectly");
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
$streditingasurvey = get_string("editingasurvey", "survey");
|
||||
$strsurveys = get_string("modulenameplural", "survey");
|
||||
|
||||
print_header("$course->shortname: $streditingasurvey", "$course->fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>".
|
||||
" -> <a href=\"index.php?id=$course->id\">$strsurveys</a>".
|
||||
print_header_simple("$streditingasurvey", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strsurveys</a>".
|
||||
" -> $form->name ($streditingasurvey)");
|
||||
|
||||
if (!$form->name or !$form->template) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "survey", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
$currentsection = '';
|
||||
|
||||
foreach ($surveys as $survey) {
|
||||
if (survey_already_done($survey->id, $USER->id)) {
|
||||
if (isset($USER->id) and survey_already_done($survey->id, $USER->id)) {
|
||||
$ss = $strdone;
|
||||
} else {
|
||||
$ss = $strnotdone;
|
||||
|
||||
+4
-5
@@ -1,7 +1,7 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require_once('../../config.php');
|
||||
require_once('lib.php');
|
||||
require_once('../../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
|
||||
// Make sure this is a legitimate posting
|
||||
@@ -89,9 +89,8 @@
|
||||
$strsurveys = get_string("modulenameplural", "survey");
|
||||
$strsurveysaved = get_string("surveysaved", "survey");
|
||||
|
||||
print_header("$course->shortname: $strsurveysaved", "$course->fullname",
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
|
||||
<a href=\"index.php?id=$course->id\">$strsurveys</a> -> $survey->name -> $strsurveysaved", "");
|
||||
print_header_simple("$strsurveysaved", "",
|
||||
"<a href=\"index.php?id=$course->id\">$strsurveys</a> -> $survey->name -> $strsurveysaved", "");
|
||||
|
||||
|
||||
notice(get_string("thanksforanswers","survey", $USER->firstname), "$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_course_login($course);
|
||||
|
||||
add_to_log($course->id, "wiki", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
|
||||
@@ -1202,10 +1202,17 @@ function workshop_get_student_submissions($workshop, $order = "title") {
|
||||
if ($order == "grade") {
|
||||
$order = "$workshop->teacherweight * s.teachergrade + $workshop->peerweight * s.peergrade DESC";
|
||||
}
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT s.* FROM {$CFG->prefix}workshop_submissions s,
|
||||
{$CFG->prefix}user_students u, {$CFG->prefix}user a
|
||||
WHERE u.course = $workshop->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND a.id = u.userid
|
||||
AND s.workshopid = $workshop->id
|
||||
AND s.timecreated > 0
|
||||
|
||||
+46
-14
@@ -247,11 +247,17 @@ function workshop_count_self_assessments($workshop, $user) {
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_count_student_submissions($workshop) {
|
||||
global $CFG;
|
||||
|
||||
return count_records_sql("SELECT count(*) FROM {$CFG->prefix}workshop_submissions s,
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return count_records_sql("SELECT count(*) FROM {$CFG->prefix}workshop_submissions s,
|
||||
{$CFG->prefix}user_students u
|
||||
WHERE u.course = $workshop->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND s.workshopid = $workshop->id
|
||||
AND timecreated > 0");
|
||||
}
|
||||
@@ -506,12 +512,18 @@ function workshop_get_comments($assessment) {
|
||||
function workshop_get_student_assessments($workshop, $user) {
|
||||
// Return all assessments on the student submissions by a user, order by youngest first, oldest last
|
||||
global $CFG;
|
||||
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT a.* FROM {$CFG->prefix}workshop_submissions s,
|
||||
{$CFG->prefix}user_students u,
|
||||
{$CFG->prefix}workshop_assessments a
|
||||
WHERE u.course = $workshop->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND s.workshopid = $workshop->id
|
||||
AND a.submissionid = s.id
|
||||
AND a.userid = $user->id
|
||||
@@ -523,11 +535,17 @@ function workshop_get_student_assessments($workshop, $user) {
|
||||
function workshop_get_student_submission_assessments($workshop) {
|
||||
// Return all assessments on the student submissions, order by youngest first, oldest last
|
||||
global $CFG;
|
||||
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT a.* FROM {$CFG->prefix}workshop_submissions s,
|
||||
{$CFG->prefix}user_students u, {$CFG->prefix}workshop_assessments a
|
||||
WHERE u.course = $workshop->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND s.workshopid = $workshop->id
|
||||
AND a.submissionid = s.id
|
||||
ORDER BY a.timecreated DESC");
|
||||
@@ -587,12 +605,18 @@ function workshop_get_ungraded_assessments($workshop) {
|
||||
function workshop_get_ungraded_assessments_student($workshop) {
|
||||
global $CFG;
|
||||
// Return all assessments which have not been graded or just graded of student's submissions
|
||||
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
$cutofftime = time() - $CFG->maxeditingtime;
|
||||
return get_records_sql("SELECT a.* FROM {$CFG->prefix}workshop_submissions s,
|
||||
{$CFG->prefix}user_students u, {$CFG->prefix}workshop_assessments a
|
||||
WHERE u.course = $workshop->course
|
||||
AND s.userid = u.userid
|
||||
WHERE $select s.userid = u.userid
|
||||
AND s.workshopid = $workshop->id
|
||||
AND a.submissionid = s.id
|
||||
AND (a.timegraded = 0 OR a.timegraded > $cutofftime)
|
||||
@@ -641,10 +665,18 @@ function workshop_get_user_assessments_done($workshop, $user) {
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_get_users_done($workshop) {
|
||||
global $CFG;
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT u.*
|
||||
FROM {$CFG->prefix}user u, {$CFG->prefix}user_students s,
|
||||
{$CFG->prefix}workshop_submissions a
|
||||
WHERE s.course = '$workshop->course' AND s.user = u.id
|
||||
WHERE $select s.user = u.id
|
||||
AND u.id = a.user AND a.workshop = '$workshop->id'
|
||||
ORDER BY a.timemodified DESC");
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
// database to determine whether upgrades should
|
||||
// be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2004082100; // The current version is a date (YYYYMMDDXX)
|
||||
$version = 2004082200; // The current version is a date (YYYYMMDDXX)
|
||||
|
||||
$release = "1.4 aiming-for-beta-soon"; // User-friendly version number
|
||||
|
||||
|
||||
Reference in New Issue
Block a user