diff --git a/lang/en/forum.php b/lang/en/forum.php index 61f9547f71e..1e44b5d1ae9 100644 --- a/lang/en/forum.php +++ b/lang/en/forum.php @@ -4,6 +4,7 @@ $string['addanewdiscussion'] = 'Add a new discussion topic'; +$string['addanewquestion'] = 'Add a new question'; $string['addanewtopic'] = 'Add a new topic'; $string['advancedsearch'] = 'Advanced search'; $string['allforums'] = 'All forums'; @@ -41,6 +42,8 @@ $string['digestmailheader'] = 'This is your daily digest of new posts from the $ $string['digestmailprefs'] = 'your user profile'; $string['digestmailsubject'] = '$a: forum digest'; $string['digestsentusers'] = 'Email digests successfully sent to $a users.'; +$string['disallowsubscribe'] = 'Subscriptions not allowed'; +$string['disallowsubscribeteacher'] = 'Subscriptions not allowed (except for teachers)'; $string['discussion'] = 'Discussion'; $string['discussionmoved'] = 'This discussion has been moved to \'$a\'.'; $string['discussionname'] = 'Discussion name'; @@ -66,6 +69,9 @@ $string['forumintro'] = 'Forum introduction'; $string['forumname'] = 'Forum name'; $string['forumposts'] = 'Forum posts'; $string['forums'] = 'Forums'; +$string['forumbodyhidden'] = 'This post cannot be viewed by you, probably because you have not posted in the discussion yet.'; +$string['forumauthorhidden'] = 'Author (hidden)'; +$string['forumsubjecthidden'] = 'Subject (hidden)'; $string['forumtype'] = 'Forum type'; $string['generalforum'] = 'Standard forum for general use'; $string['generalforums'] = 'General forums'; @@ -105,6 +111,7 @@ $string['nomorepostscontaining'] = 'No more posts containing \'$a\' were found'; $string['nonews'] = 'No news has been posted yet'; $string['noposts'] = 'No posts'; $string['nopostscontaining'] = 'No posts containing \'$a\' were found'; +$string['noquestions'] = 'There are no questions yet in this forum'; $string['nosubscribers'] = 'There are no subscribers yet for this forum'; $string['nothingnew'] = 'Nothing new for $a'; $string['notingroup'] = 'Sorry, but you need to be part of a group to see this forum.'; @@ -143,6 +150,9 @@ $string['processingpost'] = 'Processing post $a'; $string['prune'] = 'Split'; $string['prunedpost'] = 'A new discussion has been created from that post'; $string['pruneheading'] = 'Split the discussion and move this post to a new discussion'; +$string['qandaforum'] = 'Q and A forum'; +$string['qandanotify'] = 'This is a Question and Answer forum. In order to see other responses to these Questions, you must first post your Answer'; +$string['cannotviewpostyet'] = 'You cannot read other students questions in this discussion yet because you haven\'t posted'; $string['rate'] = 'Rate'; $string['rating'] = 'Rating'; $string['ratingeveryone'] = 'Everyone can rate posts'; @@ -212,6 +222,7 @@ $string['yesforever'] = 'Yes, forever'; $string['yesinitially'] = 'Yes, initially'; $string['youratedthis'] = 'You rated this'; $string['yournewtopic'] = 'Your new discussion topic'; +$string['yournewquestion'] = 'Your new question'; $string['yourreply'] = 'Your reply'; ?> diff --git a/lang/en/help/forum/forumtype.html b/lang/en/help/forum/forumtype.html index feca4331b98..fdf65b8c6e0 100644 --- a/lang/en/help/forum/forumtype.html +++ b/lang/en/help/forum/forumtype.html @@ -13,4 +13,10 @@ new discussion topic (everyone can reply to them though). This is useful when you want each student to start a discussion about, say, their reflections on the week's topic, and everyone else responds to these.
+Q And A Forum - The Q & A forum requires students to post their +perspectives before viewing other students' postings. After the initial posting, + students can view and respond to others' postings. This feature allows equal +initial posting opportunity among all students, thus encouraging original and +independent thinking.
+(More development to come in future versions of Moodle)
diff --git a/mod/forum/db/mysql.php b/mod/forum/db/mysql.php index cc788f67014..5bec6b50ec8 100644 --- a/mod/forum/db/mysql.php +++ b/mod/forum/db/mysql.php @@ -209,6 +209,10 @@ function forum_upgrade($oldversion) { table_column('forum_discussions','','timestart','integer'); table_column('forum_discussions','','timeend','integer'); } + + if ($oldversion < 2006011600) { + execute_sql("alter table mdl_forum change column type type enum('single','news','general','social','eachuser','teacher','qanda') not null default 'general'"); + } return true; diff --git a/mod/forum/db/mysql.sql b/mod/forum/db/mysql.sql index 6f1ccf9ba5d..92b188bf915 100644 --- a/mod/forum/db/mysql.sql +++ b/mod/forum/db/mysql.sql @@ -5,7 +5,7 @@ CREATE TABLE prefix_forum ( id int(10) unsigned NOT NULL auto_increment, course int(10) unsigned NOT NULL default '0', - type enum('single','news','general','social','eachuser','teacher') NOT NULL default 'general', + type enum('single','news','general','social','eachuser','teacher','qanda') NOT NULL default 'general', name varchar(255) NOT NULL default '', intro text NOT NULL, open tinyint(2) unsigned NOT NULL default '2', diff --git a/mod/forum/db/postgres7.php b/mod/forum/db/postgres7.php index ccc39df333a..d67c0d94bbf 100644 --- a/mod/forum/db/postgres7.php +++ b/mod/forum/db/postgres7.php @@ -155,6 +155,11 @@ function forum_upgrade($oldversion) { table_column('forum_discussions','','timeend','integer'); } + if ($oldversion < 2006011600) { + execute_sql("ALTER TABLE {$CFG->prefix}forum DROP CONSTRAINT {$CFG->prefix}forum_type"); + execute_sql("ALTER TABLE {$CFG->prefix}forum ADD CONSTRAINT {$CFG->prefix}forum_type CHECK (type IN ('single','news','general','social','eachuser','teacher','qanda')) "); + } + return true; } diff --git a/mod/forum/db/postgres7.sql b/mod/forum/db/postgres7.sql index b812944e77d..dec23ed0768 100644 --- a/mod/forum/db/postgres7.sql +++ b/mod/forum/db/postgres7.sql @@ -5,7 +5,7 @@ CREATE TABLE prefix_forum ( id SERIAL PRIMARY KEY, course integer NOT NULL default '0', - type varchar(10) CHECK (type IN ('single','news','general','social','eachuser','teacher')) NOT NULL default 'general', + type varchar(10) CHECK (type IN ('single','news','general','social','eachuser','teacher','qanda')) NOT NULL default 'general', name varchar(255) NOT NULL default '', intro text NOT NULL default '', open integer NOT NULL default '2', diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index 8c3c0454371..03faa17b92a 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -218,6 +218,10 @@ } echo ""; + if ($forum->type == 'qanda' && !isteacher($forum->course) && !forum_user_has_posted($forum->id,$discussion->id,$USER->id)) { + notify(get_string('qandanotify','forum')); + } + if (isset($discussionmoved)) { notify(get_string("discussionmoved", "forum", format_string($forum->name,true))); } diff --git a/mod/forum/index.php b/mod/forum/index.php index 24f2433a773..624eeb5a05c 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -237,7 +237,11 @@ $subscribed = $strno; $subtitle = get_string("subscribe", "forum"); } - $sublink = "id\">$subscribed"; + if ($forum->forcesubscribe == FORUM_DISALLOWSUBSCRIBE && !isteacher($forum->course)) { + $sublink = '-'; + } else { + $sublink = "id\">$subscribed"; + } } } $row = array ($forumlink, $forum->intro, $discussionlink); diff --git a/mod/forum/lib.php b/mod/forum/lib.php index d37834b0c3e..4b72e5cb185 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -11,6 +11,7 @@ define('FORUM_MODE_NESTED', 3); define('FORUM_FORCESUBSCRIBE', 1); define('FORUM_INITIALSUBSCRIBE', 2); +define('FORUM_DISALLOWSUBSCRIBE',3); define('FORUM_TRACKING_OFF', 0); define('FORUM_TRACKING_OPTIONAL', 1); @@ -24,7 +25,9 @@ $FORUM_LAYOUT_MODES = array ( FORUM_MODE_FLATOLDEST => get_string('modeflatoldes // These are course content forums that can be added to the course manually $FORUM_TYPES = array ('general' => get_string('generalforum', 'forum'), 'eachuser' => get_string('eachuserforum', 'forum'), - 'single' => get_string('singleforum', 'forum') ); + 'single' => get_string('singleforum', 'forum'), + 'qanda' => get_string('qandaforum', 'forum') + ); $FORUM_OPEN_MODES = array ('2' => get_string('openmode2', 'forum'), '1' => get_string('openmode1', 'forum'), @@ -328,6 +331,11 @@ function forum_cron () { } } } + + // make sure we're allowed to see it... + if (!forum_user_can_see_post($forum,$discussion,$post,$userto)) { + continue; + } if ($userto->maildigest > 0) { // This user wants the mails to be in digest form @@ -1641,12 +1649,43 @@ function forum_make_mail_post(&$post, $user, $touser, $course, function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link=false, $ratings=NULL, $footer="", $highlight="", $post_read=-99) { - global $USER, $CFG; + global $USER, $CFG, $SESSION; static $stredit, $strdelete, $strreply, $strparent, $strprune, $strpruneheading, $threadedmode, $isteacher, $adminedit; static $strmarkread, $strmarkunread, $istracked; + if (!forum_user_can_see_post($post->forum,$post->discussion,$post)) { + if (empty($SESSION->forum_search)) { + // just viewing, return + return; + } + echo ''; + echo '| '; + // print_user_picture($post->userid, $courseid, $post->picture); + echo ' | '; + if ($post->parent) { + echo ''; + } else { + echo ' | ';
+ }
+ echo ' '.get_string('forumsubjecthidden','forum').' ';
+ echo ' |
| '; + echo ' '; + + /// Actual content + + echo ' | '."\n"; + echo get_string('forumbodyhidden','forum'); + echo ' |