mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00

Basically the changes are: - I've merged the 'discuss' module into the forum module which makes the interface MUCH clearer for everyone - I've added a new 'single' forum type that replicates what the old discuss course modules used to look like. - I've got rid of the "discussion" forum type - it will still exist in upgraded courses but as a normal forum. - the 'discuss' module is completely deleted - gone. - the 'chat' module is completely deleted - gone. - The upgrading system has been improved, and all code is stored in version.php. - I've put in upgrading commands to do the best I can (right now) to upgrade courses that used the discuss module. It should mostly work, just leaving some "orphan" coursemodules on you course front page. You can easily delete these using the little 'x'. I may have forgotten something - I've only tested on my testing server and I'm about to test on my production server to see how it goes. - Forums have a lot of little new features and fixes. The main one is the subscription process. Teachers can 'force' subscriptions on any forum. This disallows everyone from choosing their own mail subscription - it's just on. - The assignment module is half-finished and not working yet I've still some massive changes to do, mostly involving making all the lib.php function names more standardised, so consider this is an interim checkin to do some tests.
51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?PHP // $Id$
|
|
|
|
// Collect ratings, store them, then return to where we came from
|
|
// Need to do some tricky business and store variables in the
|
|
// SESSION variable, just in case
|
|
|
|
|
|
require("../../config.php");
|
|
require("lib.php");
|
|
|
|
if (isguest()) {
|
|
error("Guests are not allowed to rate posts.", $HTTP_REFERER);
|
|
}
|
|
|
|
require_variable($id); // The course these ratings are part of
|
|
|
|
if (! $course = get_record("course", "id", $id)) {
|
|
error("Course ID was incorrect");
|
|
}
|
|
|
|
require_login($course->id);
|
|
|
|
if (isset($HTTP_POST_VARS)) { // form submitted
|
|
|
|
foreach ($HTTP_POST_VARS as $post => $rating) {
|
|
if ($post == "id") {
|
|
continue;
|
|
}
|
|
if ($rating) {
|
|
if ($check = get_record_sql("SELECT COUNT(*) as count FROM forum_ratings
|
|
WHERE user='$USER->id' AND post='$post'")){
|
|
if ($check->count == 0) {
|
|
$timenow = time();
|
|
if (!$rs = $db->Execute("INSERT DELAYED INTO forum_ratings
|
|
SET user='$USER->id', post='$post', time='$timenow', rating='$rating'")){
|
|
error("Could not insert a new rating ($post = $rating)");
|
|
}
|
|
|
|
} else {
|
|
error("You've rated this question before ($post)");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
redirect($HTTP_REFERER, "Ratings saved");
|
|
|
|
} else {
|
|
error("This page was not accessed correctly");
|
|
}
|
|
|
|
?>
|