mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Elimintate duplicated code and simplify some logic. Ironically, do it twice in two separate places, becuase there is some more large-scale code duplication in this file that I am not even going to attempt to fix.
This commit is contained in:
parent
3a5e1d064e
commit
49b53f26e0
1 changed files with 46 additions and 77 deletions
|
@ -216,24 +216,10 @@
|
||||||
$discussionlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">".$count."</a>";
|
$discussionlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">".$count."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
//If this forum has RSS activated, calculate it
|
$row = array ($forumlink, $forum->intro, $discussionlink);
|
||||||
$rsslink = '';
|
if ($usetracking) {
|
||||||
if ($show_rss) {
|
$row[] = $unreadlink;
|
||||||
if ($forum->rsstype and $forum->rssarticles) {
|
$row[] = $trackedlink; // Tracking.
|
||||||
//Calculate the tolltip text
|
|
||||||
if ($forum->rsstype == 1) {
|
|
||||||
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",format_string($forum->name));
|
|
||||||
} else {
|
|
||||||
$tooltiptext = get_string("rsssubscriberssposts","forum",format_string($forum->name));
|
|
||||||
}
|
|
||||||
if (empty($USER->id)) {
|
|
||||||
$userid = 0;
|
|
||||||
} else {
|
|
||||||
$userid = $USER->id;
|
|
||||||
}
|
|
||||||
//Get html code for RSS link
|
|
||||||
$rsslink = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($can_subscribe) {
|
if ($can_subscribe) {
|
||||||
|
@ -259,27 +245,27 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$row = array ($forumlink, $forum->intro, $discussionlink);
|
|
||||||
if ($usetracking) {
|
|
||||||
$row[] = $unreadlink;
|
|
||||||
$row[] = $trackedlink; // Tracking.
|
|
||||||
}
|
|
||||||
$row[] = $sublink;
|
$row[] = $sublink;
|
||||||
if ($show_rss) {
|
|
||||||
$row[] = $rsslink;
|
|
||||||
}
|
|
||||||
$generaltable->data[] = $row;
|
|
||||||
} else {
|
|
||||||
$row = array ($forumlink, $forum->intro, $discussionlink);
|
|
||||||
if ($usetracking) {
|
|
||||||
$row[] = $unreadlink;
|
|
||||||
$row[] = $trackedlink; // Tracking.
|
|
||||||
}
|
|
||||||
if ($show_rss) {
|
|
||||||
$row[] = $rsslink;
|
|
||||||
}
|
|
||||||
$generaltable->data[] = $row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If this forum has RSS activated, calculate it
|
||||||
|
if ($show_rss and $forum->rsstype and $forum->rssarticles) {
|
||||||
|
//Calculate the tolltip text
|
||||||
|
if ($forum->rsstype == 1) {
|
||||||
|
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",format_string($forum->name));
|
||||||
|
} else {
|
||||||
|
$tooltiptext = get_string("rsssubscriberssposts","forum",format_string($forum->name));
|
||||||
|
}
|
||||||
|
if (empty($USER->id)) {
|
||||||
|
$userid = 0;
|
||||||
|
} else {
|
||||||
|
$userid = $USER->id;
|
||||||
|
}
|
||||||
|
//Get html code for RSS link
|
||||||
|
$row[] = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
||||||
|
}
|
||||||
|
|
||||||
|
$generaltable->data[] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,24 +367,10 @@
|
||||||
$discussionlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">".$count."</a>";
|
$discussionlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">".$count."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
//If this forum has RSS activated, calculate it
|
$row = array ($printsection, $forumlink, $forum->intro, $discussionlink);
|
||||||
$rsslink = '';
|
if ($usetracking) {
|
||||||
if ($show_rss) {
|
$row[] = $unreadlink;
|
||||||
if ($forum->rsstype and $forum->rssarticles) {
|
$row[] = $trackedlink; // Tracking.
|
||||||
//Calculate the tolltip text
|
|
||||||
if ($forum->rsstype == 1) {
|
|
||||||
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",format_string($forum->name));
|
|
||||||
} else {
|
|
||||||
$tooltiptext = get_string("rsssubscriberssposts","forum",format_string($forum->name));
|
|
||||||
}
|
|
||||||
if (empty($USER->id)) {
|
|
||||||
$userid = 0;
|
|
||||||
} else {
|
|
||||||
$userid = $USER->id;
|
|
||||||
}
|
|
||||||
//Get html code for RSS link
|
|
||||||
$rsslink = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($can_subscribe) {
|
if ($can_subscribe) {
|
||||||
|
@ -422,29 +394,26 @@
|
||||||
$sublink = "<a title=\"$subtitle\" href=\"subscribe.php?id=$forum->id\">$subscribed</a>";
|
$sublink = "<a title=\"$subtitle\" href=\"subscribe.php?id=$forum->id\">$subscribed</a>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = array ($printsection, $forumlink, $forum->intro, $discussionlink);
|
|
||||||
if ($usetracking) {
|
|
||||||
$row[] = $unreadlink;
|
|
||||||
$row[] = $trackedlink; // Tracking.
|
|
||||||
}
|
|
||||||
$row[] = $sublink;
|
|
||||||
if ($show_rss) {
|
|
||||||
$row[] = $rsslink;
|
|
||||||
}
|
|
||||||
$learningtable->data[] = $row;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$row = array ($printsection, $forumlink, $forum->intro, $discussionlink);
|
|
||||||
if ($usetracking) {
|
|
||||||
$row[] = $unreadlink;
|
|
||||||
$row[] = $trackedlink; // Tracking.
|
|
||||||
}
|
|
||||||
if ($show_rss) {
|
|
||||||
$row[] = $rsslink;
|
|
||||||
}
|
|
||||||
$learningtable->data[] = $row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If this forum has RSS activated, calculate it
|
||||||
|
if ($show_rss and $forum->rsstype and $forum->rssarticles) {
|
||||||
|
//Calculate the tolltip text
|
||||||
|
if ($forum->rsstype == 1) {
|
||||||
|
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",format_string($forum->name));
|
||||||
|
} else {
|
||||||
|
$tooltiptext = get_string("rsssubscriberssposts","forum",format_string($forum->name));
|
||||||
|
}
|
||||||
|
if (empty($USER->id)) {
|
||||||
|
$userid = 0;
|
||||||
|
} else {
|
||||||
|
$userid = $USER->id;
|
||||||
|
}
|
||||||
|
//Get html code for RSS link
|
||||||
|
$row[] = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
||||||
|
}
|
||||||
|
|
||||||
|
$learningtable->data[] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue