mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-29663 forum: Replace constant FORUM_TRACKING_ON with FORUM_TRACKING_FORCED
Commit for MDL-29663 that renames the FORUM_TRACKING_ON constant to FORUM_TRACKING_FORCED to allow easier and more consistant reading. FORUM_TRACKING_ON retained but marked depreciated.
This commit is contained in:
parent
20e6782f10
commit
bd8f5d459d
@ -44,7 +44,7 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
// Specific values to the Forum module.
|
||||
$moduleinfo->forcesubscribe = FORUM_INITIALSUBSCRIBE;
|
||||
$moduleinfo->type = 'single';
|
||||
$moduleinfo->trackingtype = FORUM_TRACKING_ON;
|
||||
$moduleinfo->trackingtype = FORUM_TRACKING_FORCED;
|
||||
$moduleinfo->maxbytes = 10240;
|
||||
$moduleinfo->maxattachments = 2;
|
||||
|
||||
@ -360,7 +360,7 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
// Specific values to the Forum module.
|
||||
$moduleinfo->forcesubscribe = FORUM_INITIALSUBSCRIBE;
|
||||
$moduleinfo->type = 'single';
|
||||
$moduleinfo->trackingtype = FORUM_TRACKING_ON;
|
||||
$moduleinfo->trackingtype = FORUM_TRACKING_FORCED;
|
||||
$moduleinfo->maxbytes = 10240;
|
||||
$moduleinfo->maxattachments = 2;
|
||||
|
||||
|
@ -230,7 +230,7 @@ if ($generalforums) {
|
||||
$unreadlink = '<span class="read">0</span>';
|
||||
}
|
||||
|
||||
if (($forum->trackingtype == FORUM_TRACKING_ON) && ($CFG->forum_allowforcedreadtracking)) {
|
||||
if (($forum->trackingtype == FORUM_TRACKING_FORCED) && ($CFG->forum_allowforcedreadtracking)) {
|
||||
$trackedlink = $stryes;
|
||||
} else if ($forum->trackingtype === FORUM_TRACKING_OFF || ($USER->trackforums == 0)) {
|
||||
$trackedlink = '-';
|
||||
@ -369,7 +369,7 @@ if ($course->id != SITEID) { // Only real courses have learning forums
|
||||
$unreadlink = '<span class="read">0</span>';
|
||||
}
|
||||
|
||||
if (($forum->trackingtype == FORUM_TRACKING_ON) && ($CFG->forum_allowforcedreadtracking)) {
|
||||
if (($forum->trackingtype == FORUM_TRACKING_FORCED) && ($CFG->forum_allowforcedreadtracking)) {
|
||||
$trackedlink = $stryes;
|
||||
} else if ($forum->trackingtype === FORUM_TRACKING_OFF || ($USER->trackforums == 0)) {
|
||||
$trackedlink = '-';
|
||||
|
@ -40,8 +40,26 @@ define('FORUM_FORCESUBSCRIBE', 1);
|
||||
define('FORUM_INITIALSUBSCRIBE', 2);
|
||||
define('FORUM_DISALLOWSUBSCRIBE',3);
|
||||
|
||||
/**
|
||||
* FORUM_TRACKING_OFF - Tracking is not available for this forum.
|
||||
*/
|
||||
define('FORUM_TRACKING_OFF', 0);
|
||||
|
||||
/**
|
||||
* FORUM_TRACKING_OPTIONAL - Tracking is based on user preference.
|
||||
*/
|
||||
define('FORUM_TRACKING_OPTIONAL', 1);
|
||||
|
||||
/**
|
||||
* FORUM_TRACKING_FORCED - Tracking is on, regardless of user setting.
|
||||
* Treated as FORUM_TRACKING_OPTIONAL if $CFG->forum_allowforcedreadtracking is off.
|
||||
*/
|
||||
define('FORUM_TRACKING_FORCED', 2);
|
||||
|
||||
/**
|
||||
* FORUM_TRACKING_ON - deprecated alias for FORUM_TRACKING_FORCED.
|
||||
* @deprecated since 2.6
|
||||
*/
|
||||
define('FORUM_TRACKING_ON', 2);
|
||||
|
||||
define('FORUM_MAILED_PENDING', 0);
|
||||
@ -6270,10 +6288,10 @@ function forum_tp_mark_posts_read($user, $postids) {
|
||||
$params[] = $cutoffdate;
|
||||
|
||||
if ($CFG->forum_allowforcedreadtracking) {
|
||||
$trackingsql = "AND (f.trackingtype = ".FORUM_TRACKING_ON."
|
||||
$trackingsql = "AND (f.trackingtype = ".FORUM_TRACKING_FORCED."
|
||||
OR (f.trackingtype = ".FORUM_TRACKING_OPTIONAL." AND tf.id IS NULL))";
|
||||
} else {
|
||||
$trackingsql = "AND ((f.trackingtype = ".FORUM_TRACKING_OPTIONAL." OR f.trackingtype = ".FORUM_TRACKING_ON.")
|
||||
$trackingsql = "AND ((f.trackingtype = ".FORUM_TRACKING_OPTIONAL." OR f.trackingtype = ".FORUM_TRACKING_FORCED.")
|
||||
AND tf.id IS NULL)";
|
||||
}
|
||||
|
||||
@ -6622,11 +6640,11 @@ function forum_tp_get_course_unread_posts($userid, $courseid) {
|
||||
}
|
||||
|
||||
if ($CFG->forum_allowforcedreadtracking) {
|
||||
$trackingsql = "AND (f.trackingtype = ".FORUM_TRACKING_ON."
|
||||
$trackingsql = "AND (f.trackingtype = ".FORUM_TRACKING_FORCED."
|
||||
OR (f.trackingtype = ".FORUM_TRACKING_OPTIONAL." AND tf.id IS NULL
|
||||
AND (SELECT trackforums FROM {user} WHERE id = ?) = 1))";
|
||||
} else {
|
||||
$trackingsql = "AND ((f.trackingtype = ".FORUM_TRACKING_OPTIONAL." OR f.trackingtype = ".FORUM_TRACKING_ON.")
|
||||
$trackingsql = "AND ((f.trackingtype = ".FORUM_TRACKING_OPTIONAL." OR f.trackingtype = ".FORUM_TRACKING_FORCED.")
|
||||
AND tf.id IS NULL
|
||||
AND (SELECT trackforums FROM {user} WHERE id = ?) = 1)";
|
||||
}
|
||||
@ -6789,7 +6807,7 @@ function forum_tp_get_untracked_forums($userid, $courseid) {
|
||||
OR (SELECT trackforums FROM {user} WHERE id = ?) = 0)))";
|
||||
} else {
|
||||
$trackingsql = "AND (f.trackingtype = ".FORUM_TRACKING_OFF."
|
||||
OR ((f.trackingtype = ".FORUM_TRACKING_OPTIONAL." OR f.trackingtype = ".FORUM_TRACKING_ON.")
|
||||
OR ((f.trackingtype = ".FORUM_TRACKING_OPTIONAL." OR f.trackingtype = ".FORUM_TRACKING_FORCED.")
|
||||
AND (ft.id IS NOT NULL
|
||||
OR (SELECT trackforums FROM {user} WHERE id = ?) = 0)))";
|
||||
}
|
||||
@ -6856,7 +6874,7 @@ function forum_tp_can_track_forums($forum=false, $user=false) {
|
||||
}
|
||||
|
||||
$forumallows = ($forum->trackingtype == FORUM_TRACKING_OPTIONAL);
|
||||
$forumforced = ($forum->trackingtype == FORUM_TRACKING_ON);
|
||||
$forumforced = ($forum->trackingtype == FORUM_TRACKING_FORCED);
|
||||
|
||||
if ($CFG->forum_allowforcedreadtracking) {
|
||||
// If we allow forcing, then forced forums takes procidence over user setting.
|
||||
@ -6900,7 +6918,7 @@ function forum_tp_is_tracked($forum, $user=false) {
|
||||
}
|
||||
|
||||
$forumallows = ($forum->trackingtype == FORUM_TRACKING_OPTIONAL);
|
||||
$forumforced = ($forum->trackingtype == FORUM_TRACKING_ON);
|
||||
$forumforced = ($forum->trackingtype == FORUM_TRACKING_FORCED);
|
||||
$userpref = $DB->get_record('forum_track_prefs', array('userid' => $user->id, 'forumid' => $forum->id));
|
||||
|
||||
if ($CFG->forum_allowforcedreadtracking) {
|
||||
@ -7718,7 +7736,7 @@ function forum_extend_settings_navigation(settings_navigation $settingsnav, navi
|
||||
|
||||
if ($enrolled && forum_tp_can_track_forums($forumobject)) { // keep tracking info for users with suspended enrolments
|
||||
if ($forumobject->trackingtype == FORUM_TRACKING_OPTIONAL
|
||||
|| ((!$CFG->forum_allowforcedreadtracking) && $forumobject->trackingtype == FORUM_TRACKING_ON)) {
|
||||
|| ((!$CFG->forum_allowforcedreadtracking) && $forumobject->trackingtype == FORUM_TRACKING_FORCED)) {
|
||||
if (forum_tp_is_tracked($forumobject)) {
|
||||
$linktext = get_string('notrackforum', 'forum');
|
||||
} else {
|
||||
|
@ -87,12 +87,12 @@ class mod_forum_mod_form extends moodleform_mod {
|
||||
$options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
|
||||
$options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
|
||||
if ($CFG->forum_allowforcedreadtracking) {
|
||||
$options[FORUM_TRACKING_ON] = get_string('trackingon', 'forum');
|
||||
$options[FORUM_TRACKING_FORCED] = get_string('trackingon', 'forum');
|
||||
}
|
||||
$mform->addElement('select', 'trackingtype', get_string('trackingtype', 'forum'), $options);
|
||||
$mform->addHelpButton('trackingtype', 'trackingtype', 'forum');
|
||||
$default = $CFG->forum_trackingtype;
|
||||
if ((!$CFG->forum_allowforcedreadtracking) && ($default == FORUM_TRACKING_ON)) {
|
||||
if ((!$CFG->forum_allowforcedreadtracking) && ($default == FORUM_TRACKING_FORCED)) {
|
||||
$default = FORUM_TRACKING_OPTIONAL;
|
||||
}
|
||||
$mform->setDefault('trackingtype', $default);
|
||||
|
@ -61,7 +61,7 @@ if ($ADMIN->fulltree) {
|
||||
$options = array();
|
||||
$options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
|
||||
$options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
|
||||
$options[FORUM_TRACKING_ON] = get_string('trackingon', 'forum');
|
||||
$options[FORUM_TRACKING_FORCED] = get_string('trackingon', 'forum');
|
||||
$settings->add(new admin_setting_configselect('forum_trackingtype', get_string('trackingtype', 'forum'),
|
||||
get_string('configtrackingtype', 'forum'), FORUM_TRACKING_OPTIONAL, $options));
|
||||
|
||||
|
@ -174,7 +174,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
|
||||
$record = new stdClass();
|
||||
$record->course = $course2->id;
|
||||
$record->type = 'qanda';
|
||||
$record->trackingtype = FORUM_TRACKING_ON;
|
||||
$record->trackingtype = FORUM_TRACKING_FORCED;
|
||||
$forum2 = self::getDataGenerator()->create_module('forum', $record);
|
||||
|
||||
// Third forum where we will only have one discussion with no replies.
|
||||
|
@ -216,7 +216,7 @@ class mod_forum_lib_testcase extends advanced_testcase {
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OFF); // Off.
|
||||
$forumoff = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_ON); // On.
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_FORCED); // On.
|
||||
$forumforce = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OPTIONAL); // Optional.
|
||||
@ -292,7 +292,7 @@ class mod_forum_lib_testcase extends advanced_testcase {
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OFF); // Off.
|
||||
$forumoff = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_ON); // On.
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_FORCED); // On.
|
||||
$forumforce = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OPTIONAL); // Optional.
|
||||
@ -411,7 +411,7 @@ class mod_forum_lib_testcase extends advanced_testcase {
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OFF); // Off.
|
||||
$forumoff = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_ON); // On.
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_FORCED); // On.
|
||||
$forumforce = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OPTIONAL); // Optional.
|
||||
@ -534,7 +534,7 @@ class mod_forum_lib_testcase extends advanced_testcase {
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OFF); // Off.
|
||||
$forumoff = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_ON); // On.
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_FORCED); // On.
|
||||
$forumforce = $this->getDataGenerator()->create_module('forum', $options);
|
||||
|
||||
$options = array('course' => $course->id, 'trackingtype' => FORUM_TRACKING_OPTIONAL); // Optional.
|
||||
|
@ -8,6 +8,9 @@ information provided here is intended especially for developers.
|
||||
* The function forum_shorten_post() has been deprecated. It was doing a poor
|
||||
job of shortening forum post text and the shorten_text() function does a
|
||||
much better job.
|
||||
* The constant FORUM_TRACKING_ON has been depreciated and replaced by
|
||||
FORUM_TRACKING_FORCED. The value between them is maintained, so they are
|
||||
interchangeable, but code should migrate to the new name.
|
||||
|
||||
=== 2.5 ===
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user